Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/{notify,strings}: notify on string create/edit/delete ops

Signed-off-by: Anirudh Oppiliappan <did:plc:hwevmowznbiukdf6uk5dwrrq>

authored by anirudh.fi and committed by

Tangled ab00c35e 04e7c6ff

+34
+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
··· 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 ··· 46 42 func (m *BaseNotifier) NewPullComment(ctx context.Context, comment *db.PullComment) {} 47 43 48 44 func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *db.Profile) {} 45 + 46 + func (m *BaseNotifier) NewString(ctx context.Context, s *db.String) {} 47 + func (m *BaseNotifier) EditString(ctx context.Context, s *db.String) {} 48 + func (m *BaseNotifier) DeleteString(ctx context.Context, did, rkey string) {}
+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" ··· 37 36 IdResolver *idresolver.Resolver 38 37 Logger *slog.Logger 39 38 Knotstream *eventconsumer.Consumer 39 + Notifier notify.Notifier 40 40 } 41 41 42 42 func (s *Strings) Router(mw *middleware.Middleware) http.Handler { ··· 286 284 return 287 285 } 288 286 287 + s.Notifier.EditString(r.Context(), &entry) 288 + 289 289 // if that went okay, redir to the string 290 290 s.Pages.HxRedirect(w, "/strings/"+user.Handle+"/"+entry.Rkey) 291 291 } ··· 362 358 return 363 359 } 364 360 361 + s.Notifier.NewString(r.Context(), &string) 362 + 365 363 // successful 366 364 s.Pages.HxRedirect(w, "/strings/"+user.Handle+"/"+string.Rkey) 367 365 } ··· 405 399 fail("Failed to delete string.", err) 406 400 return 407 401 } 402 + 403 + s.Notifier.DeleteString(r.Context(), user.Did, rkey) 408 404 409 405 s.Pages.HxRedirect(w, "/strings/"+user.Handle) 410 406 }