+1
-1
appview/indexer/notifier.go
+1
-1
appview/indexer/notifier.go
···
19
19
}
20
20
}
21
21
22
-
func (ix *Indexer) NewIssueClosed(ctx context.Context, issue *models.Issue) {
22
+
func (ix *Indexer) NewIssueState(ctx context.Context, issue *models.Issue) {
23
23
l := log.FromContext(ctx).With("notifier", "indexer", "issue", issue)
24
24
l.Debug("updating an issue")
25
25
err := ix.Issues.Index(ctx, *issue)
+3
-3
appview/issues/issues.go
+3
-3
appview/issues/issues.go
···
309
309
issue.Open = false
310
310
311
311
// notify about the issue closure
312
-
rp.notifier.NewIssueClosed(r.Context(), issue)
312
+
rp.notifier.NewIssueState(r.Context(), issue)
313
313
314
314
rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId))
315
315
return
···
358
358
// change the issue state (this will pass down to the notifiers)
359
359
issue.Open = true
360
360
361
-
// // notify about the issue reopen
362
-
// rp.notifier.NewIssueReopen(r.Context(), issue)
361
+
// notify about the issue reopen
362
+
rp.notifier.NewIssueState(r.Context(), issue)
363
363
364
364
rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId))
365
365
return
+5
appview/models/notifications.go
+5
appview/models/notifications.go
···
17
17
NotificationTypeFollowed NotificationType = "followed"
18
18
NotificationTypePullMerged NotificationType = "pull_merged"
19
19
NotificationTypeIssueClosed NotificationType = "issue_closed"
20
+
NotificationTypeIssueReopen NotificationType = "issue_reopen"
20
21
NotificationTypePullClosed NotificationType = "pull_closed"
21
22
)
22
23
···
47
48
return "message-square"
48
49
case NotificationTypeIssueClosed:
49
50
return "ban"
51
+
case NotificationTypeIssueReopen:
52
+
return "circle-dot"
50
53
case NotificationTypePullCreated:
51
54
return "git-pull-request-create"
52
55
case NotificationTypePullCommented:
···
93
96
return prefs.IssueCommented
94
97
case NotificationTypeIssueClosed:
95
98
return prefs.IssueClosed
99
+
case NotificationTypeIssueReopen:
100
+
return prefs.IssueCreated // smae pref for now
96
101
case NotificationTypePullCreated:
97
102
return prefs.PullCreated
98
103
case NotificationTypePullCommented:
+8
-2
appview/notify/db/db.go
+8
-2
appview/notify/db/db.go
···
283
283
// no-op
284
284
}
285
285
286
-
func (n *databaseNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {
286
+
func (n *databaseNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
287
287
// build up the recipients list:
288
288
// - repo owner
289
289
// - repo collaborators
···
303
303
}
304
304
305
305
actorDid := syntax.DID(issue.Repo.Did)
306
-
eventType := models.NotificationTypeIssueClosed
307
306
entityType := "pull"
308
307
entityId := issue.AtUri().String()
309
308
repoId := &issue.Repo.Id
310
309
issueId := &issue.Id
311
310
var pullId *int64
311
+
var eventType models.NotificationType
312
+
313
+
if issue.Open {
314
+
eventType = models.NotificationTypeIssueReopen
315
+
} else {
316
+
eventType = models.NotificationTypeIssueClosed
317
+
}
312
318
313
319
n.notifyEvent(
314
320
actorDid,
+2
-2
appview/notify/merged_notifier.go
+2
-2
appview/notify/merged_notifier.go
···
61
61
m.fanout("NewIssueComment", ctx, comment)
62
62
}
63
63
64
-
func (m *mergedNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {
65
-
m.fanout("NewIssueClosed", ctx, issue)
64
+
func (m *mergedNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
65
+
m.fanout("NewIssueState", ctx, issue)
66
66
}
67
67
68
68
func (m *mergedNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {
+2
-2
appview/notify/notifier.go
+2
-2
appview/notify/notifier.go
···
14
14
15
15
NewIssue(ctx context.Context, issue *models.Issue)
16
16
NewIssueComment(ctx context.Context, comment *models.IssueComment)
17
-
NewIssueClosed(ctx context.Context, issue *models.Issue)
17
+
NewIssueState(ctx context.Context, issue *models.Issue)
18
18
DeleteIssue(ctx context.Context, issue *models.Issue)
19
19
20
20
NewFollow(ctx context.Context, follow *models.Follow)
···
44
44
45
45
func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue) {}
46
46
func (m *BaseNotifier) NewIssueComment(ctx context.Context, comment *models.IssueComment) {}
47
-
func (m *BaseNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {}
47
+
func (m *BaseNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {}
48
48
func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {}
49
49
50
50
func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {}
+8
-2
appview/notify/posthog/notifier.go
+8
-2
appview/notify/posthog/notifier.go
···
190
190
}
191
191
}
192
192
193
-
func (n *posthogNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {
193
+
func (n *posthogNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
194
+
var event string
195
+
if issue.Open {
196
+
event = "issue_reopen"
197
+
} else {
198
+
event = "issue_closed"
199
+
}
194
200
err := n.client.Enqueue(posthog.Capture{
195
201
DistinctId: issue.Did,
196
-
Event: "issue_closed",
202
+
Event: event,
197
203
Properties: posthog.Properties{
198
204
"repo_at": issue.RepoAt.String(),
199
205
"issue_id": issue.IssueId,
+2
appview/pages/templates/notifications/fragments/item.html
+2
appview/pages/templates/notifications/fragments/item.html