Monorepo for Tangled tangled.org

appview/notify: add `DeleteIssue` event

Signed-off-by: Seongmin Lee <git@boltless.me>

authored by boltless.me and committed by Tangled 2d4cf51d 552fa4b9

Changed files
+25
appview
+4
appview/indexer/issues/indexer.go
··· 216 216 return batch.Flush() 217 217 } 218 218 219 + func (ix *Indexer) Delete(ctx context.Context, issueId int64) error { 220 + return ix.indexer.Delete(base36.Encode(issueId)) 221 + } 222 + 219 223 // Search searches for issues 220 224 func (ix *Indexer) Search(ctx context.Context, opts models.IssueSearchOptions) (*SearchResult, error) { 221 225 var queries []query.Query
+9
appview/indexer/notifier.go
··· 18 18 l.Error("failed to index an issue", "err", err) 19 19 } 20 20 } 21 + 22 + func (ix *Indexer) DeleteIssue(ctx context.Context, issue *models.Issue) { 23 + l := log.FromContext(ctx).With("notifier", "indexer.DeleteIssue", "issue", issue) 24 + l.Debug("deleting an issue") 25 + err := ix.Issues.Delete(ctx, issue.Id) 26 + if err != nil { 27 + l.Error("failed to delete an issue", "err", err) 28 + } 29 + }
+2
appview/issues/issues.go
··· 263 263 return 264 264 } 265 265 266 + rp.notifier.DeleteIssue(r.Context(), issue) 267 + 266 268 // return to all issues page 267 269 rp.pages.HxRedirect(w, "/"+f.RepoInfo(user).FullName()+"/issues") 268 270 }
+4
appview/notify/db/db.go
··· 151 151 ) 152 152 } 153 153 154 + func (n *databaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) { 155 + // no-op for now 156 + } 157 + 154 158 func (n *databaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) { 155 159 actorDid := syntax.DID(follow.UserDid) 156 160 recipients := []syntax.DID{syntax.DID(follow.SubjectDid)}
+4
appview/notify/merged_notifier.go
··· 60 60 m.fanout("NewIssueClosed", ctx, issue) 61 61 } 62 62 63 + func (m *mergedNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) { 64 + m.fanout("DeleteIssue", ctx, issue) 65 + } 66 + 63 67 func (m *mergedNotifier) NewFollow(ctx context.Context, follow *models.Follow) { 64 68 m.fanout("NewFollow", ctx, follow) 65 69 }
+2
appview/notify/notifier.go
··· 15 15 NewIssue(ctx context.Context, issue *models.Issue) 16 16 NewIssueComment(ctx context.Context, comment *models.IssueComment) 17 17 NewIssueClosed(ctx context.Context, issue *models.Issue) 18 + DeleteIssue(ctx context.Context, issue *models.Issue) 18 19 19 20 NewFollow(ctx context.Context, follow *models.Follow) 20 21 DeleteFollow(ctx context.Context, follow *models.Follow) ··· 44 45 func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue) {} 45 46 func (m *BaseNotifier) NewIssueComment(ctx context.Context, comment *models.IssueComment) {} 46 47 func (m *BaseNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {} 48 + func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {} 47 49 48 50 func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {} 49 51 func (m *BaseNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) {}