Add comment threads, reactions, notifications and page watching
Comments are now threads: replies hang off a thread's first comment, which alone points at text and can be resolved. Authors can edit their own comments, and anyone who can comment can react with an emoji. Resolved threads stop lighting text in the editor and fold away in the panel. Comments can @mention people. People watch the pages they create or comment on, and can watch or mute a page from its menu. Muting is remembered. The inbox collects comments on watched pages, replies in your threads, mentions (in comments and in page text), pages shared with you and resolved threads. It shows an unread badge in the sidebar, polled every minute, and links straight to the thread. Nobody hears about their own actions or about pages they cannot open, and a notification hides its text once access is lost. Unread notifications are emailed as a digest every few minutes unless the person turns that off. Read ones are pruned after 90 days. The jobs registry can now run jobs on a timer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7968e82cc2
commit
2b78c167e2
31 files changed
+3083
-166
No files matched your search
@@ -68,6 +68,11 @@ func run(log *slog.Logger) error {
|
||||
Store: collab.NewPBStore(db), Docs: ycrdt.NewPool(yrs, max(2, runtime.GOMAXPROCS(0))), Log: log,
|
||||
})
|
||||
dirSvc := directory.New(db, authSvc.Forget, hub)
|
||||
hub.OnSaved(func(page, editor string, doc []byte) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
dirSvc.PageSaved(ctx, page, editor, doc)
|
||||
})
|
||||
// The search index follows PocketBase and can be rebuilt from it at any time.
|
||||
index, err := search.Open(cfg.DataDir, db, log)
|
||||
if err != nil {
|
||||
@@ -78,10 +83,14 @@ func run(log *slog.Logger) error {
|
||||
reg.Register("search.index", "Adds changed pages to the search index", 3*time.Second, nil)
|
||||
reg.Register("search.sweep", "Removes deleted pages from the search index", 10*time.Minute, index.Sweep)
|
||||
reg.Register("search.rebuild", "Rebuilds the whole search index from the database", 0, index.Rebuild)
|
||||
reg.Register("notify.digest", "Emails people their unread notifications", 5*time.Minute, dirSvc.SendDigests)
|
||||
reg.Register("notify.prune", "Deletes read notifications older than 90 days", 24*time.Hour, dirSvc.PruneNotifications)
|
||||
index.Track(reg.Track)
|
||||
indexCtx, stopIndex := context.WithCancel(context.Background())
|
||||
defer stopIndex()
|
||||
go index.Run(indexCtx, 3*time.Second, 10*time.Minute)
|
||||
go reg.Every(indexCtx, "notify.digest", 5*time.Minute)
|
||||
go reg.Every(indexCtx, "notify.prune", 24*time.Hour)
|
||||
dirSvc.UseSearch(index)
|
||||
dirSvc.SetPublicURL(cfg.PublicURL)
|
||||
dirSvc.SetMaxUpload(int64(cfg.MaxUploadMB) << 20)
|
||||
|
||||
Reference in new issue
Block a user