Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/{pulls,issues}: more notifications

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

authored by

Anirudh Oppiliappan and committed by
Tangled
6b79572a 504d86f9

+33
+8
appview/issues/issues.go
··· 301 301 return 302 302 } 303 303 304 + // notify about the issue closure 305 + rp.notifier.NewIssueClosed(r.Context(), issue) 306 + 304 307 rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId)) 305 308 return 306 309 } else { ··· 437 434 438 435 // reset atUri to make rollback a no-op 439 436 atUri = "" 437 + 438 + // notify about the new comment 439 + comment.Id = commentId 440 + rp.notifier.NewIssueComment(r.Context(), &comment) 441 + 440 442 rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d#comment-%d", f.OwnerSlashRepo(), issue.IssueId, commentId)) 441 443 } 442 444
+12
appview/notify/merged_notifier.go
··· 72 72 } 73 73 } 74 74 75 + func (m *mergedNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) { 76 + for _, notifier := range m.notifiers { 77 + notifier.NewPullMerged(ctx, pull) 78 + } 79 + } 80 + 81 + func (m *mergedNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) { 82 + for _, notifier := range m.notifiers { 83 + notifier.NewPullClosed(ctx, pull) 84 + } 85 + } 86 + 75 87 func (m *mergedNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) { 76 88 for _, notifier := range m.notifiers { 77 89 notifier.UpdateProfile(ctx, profile)
+4
appview/notify/notifier.go
··· 21 21 22 22 NewPull(ctx context.Context, pull *models.Pull) 23 23 NewPullComment(ctx context.Context, comment *models.PullComment) 24 + NewPullMerged(ctx context.Context, pull *models.Pull) 25 + NewPullClosed(ctx context.Context, pull *models.Pull) 24 26 25 27 UpdateProfile(ctx context.Context, profile *models.Profile) 26 28 ··· 50 48 51 49 func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {} 52 50 func (m *BaseNotifier) NewPullComment(ctx context.Context, models *models.PullComment) {} 51 + func (m *BaseNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) {} 52 + func (m *BaseNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) {} 53 53 54 54 func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {} 55 55
+9
appview/pulls/pulls.go
··· 2147 2147 return 2148 2148 } 2149 2149 2150 + // notify about the pull merge 2151 + for _, p := range pullsToMerge { 2152 + s.notifier.NewPullMerged(r.Context(), p) 2153 + } 2154 + 2150 2155 s.pages.HxLocation(w, fmt.Sprintf("/@%s/%s/pulls/%d", f.OwnerHandle(), f.Name, pull.PullId)) 2151 2156 } 2152 2157 ··· 2217 2212 log.Println("failed to commit transaction", err) 2218 2213 s.pages.Notice(w, "pull-close", "Failed to close pull.") 2219 2214 return 2215 + } 2216 + 2217 + for _, p := range pullsToClose { 2218 + s.notifier.NewPullClosed(r.Context(), p) 2220 2219 } 2221 2220 2222 2221 s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls/%d", f.OwnerSlashRepo(), pull.PullId))