Signed-off-by: Seongmin Lee git@boltless.me
+2
-2
appview/indexer/notifier.go
+2
-2
appview/indexer/notifier.go
···
19
19
}
20
20
}
21
21
22
-
func (ix *Indexer) NewIssueState(ctx context.Context, issue *models.Issue) {
22
+
func (ix *Indexer) NewIssueState(ctx context.Context, actor syntax.DID, 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)
···
46
46
}
47
47
}
48
48
49
-
func (ix *Indexer) NewPullState(ctx context.Context, pull *models.Pull) {
49
+
func (ix *Indexer) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {
50
50
l := log.FromContext(ctx).With("notifier", "indexer", "pull", pull)
51
51
l.Debug("updating a pr")
52
52
err := ix.Pulls.Index(ctx, pull)
+2
-2
appview/issues/issues.go
+2
-2
appview/issues/issues.go
···
309
309
issue.Open = false
310
310
311
311
// notify about the issue closure
312
-
rp.notifier.NewIssueState(r.Context(), issue)
312
+
rp.notifier.NewIssueState(r.Context(), syntax.DID(user.Did), issue)
313
313
314
314
rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId))
315
315
return
···
359
359
issue.Open = true
360
360
361
361
// notify about the issue reopen
362
-
rp.notifier.NewIssueState(r.Context(), issue)
362
+
rp.notifier.NewIssueState(r.Context(), syntax.DID(user.Did), issue)
363
363
364
364
rp.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issue.IssueId))
365
365
return
+4
-6
appview/notify/db/db.go
+4
-6
appview/notify/db/db.go
···
283
283
// no-op
284
284
}
285
285
286
-
func (n *databaseNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
286
+
func (n *databaseNotifier) NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue) {
287
287
// build up the recipients list:
288
288
// - repo owner
289
289
// - repo collaborators
···
302
302
recipients = append(recipients, syntax.DID(p))
303
303
}
304
304
305
-
actorDid := syntax.DID(issue.Repo.Did)
306
305
entityType := "pull"
307
306
entityId := issue.AtUri().String()
308
307
repoId := &issue.Repo.Id
···
317
316
}
318
317
319
318
n.notifyEvent(
320
-
actorDid,
319
+
actor,
321
320
recipients,
322
321
eventType,
323
322
entityType,
···
328
327
)
329
328
}
330
329
331
-
func (n *databaseNotifier) NewPullState(ctx context.Context, pull *models.Pull) {
330
+
func (n *databaseNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {
332
331
// Get repo details
333
332
repo, err := db.GetRepo(n.db, db.FilterEq("at_uri", string(pull.RepoAt)))
334
333
if err != nil {
···
353
352
recipients = append(recipients, syntax.DID(p))
354
353
}
355
354
356
-
actorDid := syntax.DID(repo.Did)
357
355
entityType := "pull"
358
356
entityId := pull.PullAt().String()
359
357
repoId := &repo.Id
···
374
372
pullId := &p
375
373
376
374
n.notifyEvent(
377
-
actorDid,
375
+
actor,
378
376
recipients,
379
377
eventType,
380
378
entityType,
+4
-4
appview/notify/merged_notifier.go
+4
-4
appview/notify/merged_notifier.go
···
61
61
m.fanout("NewIssueComment", ctx, comment)
62
62
}
63
63
64
-
func (m *mergedNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
65
-
m.fanout("NewIssueState", ctx, issue)
64
+
func (m *mergedNotifier) NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue) {
65
+
m.fanout("NewIssueState", ctx, actor, issue)
66
66
}
67
67
68
68
func (m *mergedNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {
···
85
85
m.fanout("NewPullComment", ctx, comment)
86
86
}
87
87
88
-
func (m *mergedNotifier) NewPullState(ctx context.Context, pull *models.Pull) {
89
-
m.fanout("NewPullState", ctx, pull)
88
+
func (m *mergedNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {
89
+
m.fanout("NewPullState", ctx, actor, pull)
90
90
}
91
91
92
92
func (m *mergedNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {
+8
-7
appview/notify/notifier.go
+8
-7
appview/notify/notifier.go
···
3
3
import (
4
4
"context"
5
5
6
+
"github.com/bluesky-social/indigo/atproto/syntax"
6
7
"tangled.org/core/appview/models"
7
8
)
8
9
···
14
15
15
16
NewIssue(ctx context.Context, issue *models.Issue)
16
17
NewIssueComment(ctx context.Context, comment *models.IssueComment)
17
-
NewIssueState(ctx context.Context, issue *models.Issue)
18
+
NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue)
18
19
DeleteIssue(ctx context.Context, issue *models.Issue)
19
20
20
21
NewFollow(ctx context.Context, follow *models.Follow)
···
22
23
23
24
NewPull(ctx context.Context, pull *models.Pull)
24
25
NewPullComment(ctx context.Context, comment *models.PullComment)
25
-
NewPullState(ctx context.Context, pull *models.Pull)
26
+
NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull)
26
27
27
28
UpdateProfile(ctx context.Context, profile *models.Profile)
28
29
···
41
42
func (m *BaseNotifier) NewStar(ctx context.Context, star *models.Star) {}
42
43
func (m *BaseNotifier) DeleteStar(ctx context.Context, star *models.Star) {}
43
44
44
-
func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue) {}
45
-
func (m *BaseNotifier) NewIssueComment(ctx context.Context, comment *models.IssueComment) {}
46
-
func (m *BaseNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {}
47
-
func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {}
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, actor syntax.DID, issue *models.Issue) {}
48
+
func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {}
48
49
49
50
func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {}
50
51
func (m *BaseNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) {}
51
52
52
53
func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {}
53
54
func (m *BaseNotifier) NewPullComment(ctx context.Context, models *models.PullComment) {}
54
-
func (m *BaseNotifier) NewPullState(ctx context.Context, pull *models.Pull) {}
55
+
func (m *BaseNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {}
55
56
56
57
func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {}
57
58
+4
-2
appview/notify/posthog/notifier.go
+4
-2
appview/notify/posthog/notifier.go
···
190
190
}
191
191
}
192
192
193
-
func (n *posthogNotifier) NewIssueState(ctx context.Context, issue *models.Issue) {
193
+
func (n *posthogNotifier) NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue) {
194
194
var event string
195
195
if issue.Open {
196
196
event = "issue_reopen"
···
202
202
Event: event,
203
203
Properties: posthog.Properties{
204
204
"repo_at": issue.RepoAt.String(),
205
+
"actor": actor,
205
206
"issue_id": issue.IssueId,
206
207
},
207
208
})
···
210
211
}
211
212
}
212
213
213
-
func (n *posthogNotifier) NewPullState(ctx context.Context, pull *models.Pull) {
214
+
func (n *posthogNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {
214
215
var event string
215
216
switch pull.State {
216
217
case models.PullClosed:
···
229
230
Properties: posthog.Properties{
230
231
"repo_at": pull.RepoAt,
231
232
"pull_id": pull.PullId,
233
+
"actor": actor,
232
234
},
233
235
})
234
236
if err != nil {
+4
-3
appview/pulls/pulls.go
+4
-3
appview/pulls/pulls.go
···
2106
2106
}
2107
2107
2108
2108
func (s *Pulls) MergePull(w http.ResponseWriter, r *http.Request) {
2109
+
user := s.oauth.GetUser(r)
2109
2110
f, err := s.repoResolver.Resolve(r)
2110
2111
if err != nil {
2111
2112
log.Println("failed to resolve repo:", err)
···
2216
2217
2217
2218
// notify about the pull merge
2218
2219
for _, p := range pullsToMerge {
2219
-
s.notifier.NewPullState(r.Context(), p)
2220
+
s.notifier.NewPullState(r.Context(), syntax.DID(user.Did), p)
2220
2221
}
2221
2222
2222
2223
s.pages.HxLocation(w, fmt.Sprintf("/@%s/%s/pulls/%d", f.OwnerHandle(), f.Name, pull.PullId))
···
2288
2289
}
2289
2290
2290
2291
for _, p := range pullsToClose {
2291
-
s.notifier.NewPullState(r.Context(), p)
2292
+
s.notifier.NewPullState(r.Context(), syntax.DID(user.Did), p)
2292
2293
}
2293
2294
2294
2295
s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls/%d", f.OwnerSlashRepo(), pull.PullId))
···
2361
2362
}
2362
2363
2363
2364
for _, p := range pullsToReopen {
2364
-
s.notifier.NewPullState(r.Context(), p)
2365
+
s.notifier.NewPullState(r.Context(), syntax.DID(user.Did), p)
2365
2366
}
2366
2367
2367
2368
s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls/%d", f.OwnerSlashRepo(), pull.PullId))
History
5 rounds
1 comment
boltless.me
submitted
#4
1 commit
expand
collapse
appview/notify: use correct actor on issue/pr state change events
Signed-off-by: Seongmin Lee <git@boltless.me>
3/3 success
expand
collapse
expand 0 comments
pull request successfully merged
boltless.me
submitted
#3
1 commit
expand
collapse
appview/notify: use correct actor on issue/pr state change events
Signed-off-by: Seongmin Lee <git@boltless.me>
3/3 success
expand
collapse
expand 0 comments
boltless.me
submitted
#2
1 commit
expand
collapse
appview/notify: use correct actor on issue/pr state change events
Signed-off-by: Seongmin Lee <git@boltless.me>
1/3 failed, 1/3 timeout, 1/3 success
expand
collapse
expand 0 comments
boltless.me
submitted
#1
1 commit
expand
collapse
appview/notify: use correct actor on issue/pr state change events
Signed-off-by: Seongmin Lee <git@boltless.me>
1/3 failed, 2/3 timeout
expand
collapse
expand 0 comments
boltless.me
submitted
#0
1 commit
expand
collapse
appview/notify: use correct actor on issue/pr state change events
Signed-off-by: Seongmin Lee <git@boltless.me>
this is valuable as an interim fix! as you know, we are looking to atprotate issue state and PR state changes.
can you move this off of this stack? can be opened as a standalone PR.