+18
appview/notify/merged_notifier.go
+18
appview/notify/merged_notifier.go
···
66
66
notifier.UpdateProfile(ctx, profile)
67
67
}
68
68
}
69
+
70
+
func (m *mergedNotifier) NewString(ctx context.Context, string *db.String) {
71
+
for _, notifier := range m.notifiers {
72
+
notifier.NewString(ctx, string)
73
+
}
74
+
}
75
+
76
+
func (m *mergedNotifier) EditString(ctx context.Context, string *db.String) {
77
+
for _, notifier := range m.notifiers {
78
+
notifier.EditString(ctx, string)
79
+
}
80
+
}
81
+
82
+
func (m *mergedNotifier) DeleteString(ctx context.Context, did, rkey string) {
83
+
for _, notifier := range m.notifiers {
84
+
notifier.DeleteString(ctx, did, rkey)
85
+
}
86
+
}
+8
appview/notify/notifier.go
+8
appview/notify/notifier.go
···
21
21
NewPullComment(ctx context.Context, comment *db.PullComment)
22
22
23
23
UpdateProfile(ctx context.Context, profile *db.Profile)
24
+
25
+
NewString(ctx context.Context, s *db.String)
26
+
EditString(ctx context.Context, s *db.String)
27
+
DeleteString(ctx context.Context, did, rkey string)
24
28
}
25
29
26
30
// BaseNotifier is a listener that does nothing
···
42
46
func (m *BaseNotifier) NewPullComment(ctx context.Context, comment *db.PullComment) {}
43
47
44
48
func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *db.Profile) {}
49
+
50
+
func (m *BaseNotifier) NewString(ctx context.Context, s *db.String) {}
51
+
func (m *BaseNotifier) EditString(ctx context.Context, s *db.String) {}
52
+
func (m *BaseNotifier) DeleteString(ctx context.Context, did, rkey string) {}
+8
appview/strings/strings.go
+8
appview/strings/strings.go
···
12
12
"tangled.sh/tangled.sh/core/appview/config"
13
13
"tangled.sh/tangled.sh/core/appview/db"
14
14
"tangled.sh/tangled.sh/core/appview/middleware"
15
+
"tangled.sh/tangled.sh/core/appview/notify"
15
16
"tangled.sh/tangled.sh/core/appview/oauth"
16
17
"tangled.sh/tangled.sh/core/appview/pages"
17
18
"tangled.sh/tangled.sh/core/appview/pages/markup"
···
36
37
IdResolver *idresolver.Resolver
37
38
Logger *slog.Logger
38
39
Knotstream *eventconsumer.Consumer
40
+
Notifier notify.Notifier
39
41
}
40
42
41
43
func (s *Strings) Router(mw *middleware.Middleware) http.Handler {
···
284
286
return
285
287
}
286
288
289
+
s.Notifier.EditString(r.Context(), &entry)
290
+
287
291
// if that went okay, redir to the string
288
292
s.Pages.HxRedirect(w, "/strings/"+user.Handle+"/"+entry.Rkey)
289
293
}
···
358
362
return
359
363
}
360
364
365
+
s.Notifier.NewString(r.Context(), &string)
366
+
361
367
// successful
362
368
s.Pages.HxRedirect(w, "/strings/"+user.Handle+"/"+string.Rkey)
363
369
}
···
399
405
fail("Failed to delete string.", err)
400
406
return
401
407
}
408
+
409
+
s.Notifier.DeleteString(r.Context(), user.Did, rkey)
402
410
403
411
s.Pages.HxRedirect(w, "/strings/"+user.Handle)
404
412
}