diff --git a/appview/indexer/notifier.go b/appview/indexer/notifier.go --- a/appview/indexer/notifier.go +++ b/appview/indexer/notifier.go @@ -19,6 +19,15 @@ l.Error("failed to index an issue", "err", err) } } +func (ix *Indexer) NewIssueClosed(ctx context.Context, issue *models.Issue) { + l := log.FromContext(ctx).With("notifier", "indexer.NewIssueClosed", "issue", issue) + l.Debug("updating an issue") + err := ix.Issues.Index(ctx, *issue) + if err != nil { + l.Error("failed to index an issue", "err", err) + } +} + func (ix *Indexer) DeleteIssue(ctx context.Context, issue *models.Issue) { l := log.FromContext(ctx).With("notifier", "indexer.DeleteIssue", "issue", issue) l.Debug("deleting an issue") diff --git a/appview/issues/issues.go b/appview/issues/issues.go --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -305,6 +305,8 @@ l.Error("failed to close issue", "err", err) rp.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.") return } + // change the issue state (this will pass down to the notifiers) + issue.Open = false // notify about the issue closure rp.notifier.NewIssueClosed(r.Context(), issue) @@ -353,6 +355,12 @@ l.Error("failed to reopen issue", "err", err) rp.pages.Notice(w, "issue-action", "Failed to reopen issue. Try again later.") return } + // change the issue state (this will pass down to the notifiers) + issue.Open = true + + // // notify about the issue reopen + // rp.notifier.NewIssueReopen(r.Context(), issue) + rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId)) return } else {