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