appview/{pulls,issues}: more notifications #593

merged
opened by anirudh.fi targeting master from push-xwotmtuuvokm
Changed files
+33
appview
+8
appview/issues/issues.go
···
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 {
···
// 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))
}
+12
appview/notify/merged_notifier.go
···
}
}
+
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)
+4
appview/notify/notifier.go
···
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)
···
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) {}
+9
appview/pulls/pulls.go
···
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))
···
return
+
for _, p := range pullsToClose {
+
s.notifier.NewPullClosed(r.Context(), p)
+
}
+
s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls/%d", f.OwnerSlashRepo(), pull.PullId))