appview/notify: add DeleteIssue event #694

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