diff --git a/appview/issues/issues.go b/appview/issues/issues.go --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -301,6 +301,9 @@ return } + // notify about the issue closure + rp.notifier.NewIssueClosed(r.Context(), issue) + rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId)) return } else { @@ -434,6 +437,11 @@ // reset atUri to make rollback a no-op atUri = "" + + // notify about the new comment + comment.Id = commentId + rp.notifier.NewIssueComment(r.Context(), &comment) + rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d#comment-%d", f.OwnerSlashRepo(), issue.IssueId, commentId)) } diff --git a/appview/notify/merged_notifier.go b/appview/notify/merged_notifier.go --- a/appview/notify/merged_notifier.go +++ b/appview/notify/merged_notifier.go @@ -72,6 +72,18 @@ } } +func (m *mergedNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) { + for _, notifier := range m.notifiers { + notifier.NewPullMerged(ctx, pull) + } +} + +func (m *mergedNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) { + for _, notifier := range m.notifiers { + notifier.NewPullClosed(ctx, pull) + } +} + func (m *mergedNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) { for _, notifier := range m.notifiers { notifier.UpdateProfile(ctx, profile) diff --git a/appview/notify/notifier.go b/appview/notify/notifier.go --- a/appview/notify/notifier.go +++ b/appview/notify/notifier.go @@ -21,6 +21,8 @@ NewPull(ctx context.Context, pull *models.Pull) NewPullComment(ctx context.Context, comment *models.PullComment) + NewPullMerged(ctx context.Context, pull *models.Pull) + NewPullClosed(ctx context.Context, pull *models.Pull) UpdateProfile(ctx context.Context, profile *models.Profile) @@ -48,6 +50,8 @@ func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {} func (m *BaseNotifier) NewPullComment(ctx context.Context, models *models.PullComment) {} +func (m *BaseNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) {} +func (m *BaseNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) {} func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {} diff --git a/appview/pulls/pulls.go b/appview/pulls/pulls.go --- a/appview/pulls/pulls.go +++ b/appview/pulls/pulls.go @@ -2147,6 +2147,11 @@ return } + // notify about the pull merge + for _, p := range pullsToMerge { + s.notifier.NewPullMerged(r.Context(), p) + } + s.pages.HxLocation(w, fmt.Sprintf("/@%s/%s/pulls/%d", f.OwnerHandle(), f.Name, pull.PullId)) } @@ -2212,6 +2217,10 @@ log.Println("failed to commit transaction", err) s.pages.Notice(w, "pull-close", "Failed to close pull.") return + } + + for _, p := range pullsToClose { + s.notifier.NewPullClosed(r.Context(), p) } s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls/%d", f.OwnerSlashRepo(), pull.PullId))