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:
tajniak81andClaude Opus 5.5 committed 2026-10-31 22:27:55 +01:00
1 parent 7968e82cc2
commit 2b78c167e2
31 files changed
+3083 -166

No files matched your search

+239 -6
View File
@@ -1677,7 +1677,7 @@ paths:
get:
operationId: listComments
tags: [comments]
summary: The page's inline comments, oldest first
summary: The page's comments and replies, oldest first (threads are the ones without a parent)
security: [{ bearer: [] }]
responses:
"200":
@@ -1689,7 +1689,8 @@ paths:
post:
operationId: createComment
tags: [comments]
summary: Comment on the page (commenter)
summary: Start a thread on the page, or reply to one (commenter)
description: The author starts watching the page. Watchers, the thread's people and mentioned people are notified.
security: [{ bearer: [] }]
requestBody:
required: true
@@ -1700,11 +1701,13 @@ paths:
required: [body]
properties:
body: { type: string, maxLength: 5000 }
quote: { type: string, maxLength: 500, description: The commented text }
quote: { type: string, maxLength: 500, description: The commented text (threads only) }
anchor:
type: object
additionalProperties: true
description: The editor's encoding of the commented range (opaque to the server)
description: The editor's encoding of the commented range, opaque to the server (threads only)
parent: { type: string, description: The thread to reply to }
mentions: { type: array, items: { type: string }, description: Ids of the people mentioned in body }
responses:
"201":
description: Created
@@ -1717,15 +1720,195 @@ paths:
/api/v1/comments/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateComment
tags: [comments]
summary: Change a comment's text (its author)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [body]
properties:
body: { type: string, maxLength: 5000 }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteComment
tags: [comments]
summary: Delete a comment (its author, or a space admin)
summary: Delete a comment, and a thread's replies with it (its author, or a space admin)
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/comments/{id}/resolve:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: resolveComment
tags: [comments]
summary: Resolve a thread, or open it again (commenter)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [resolved]
properties:
resolved: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/comments/{id}/reactions:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
post:
operationId: reactToComment
tags: [comments]
summary: Add or remove the caller's emoji reaction (commenter)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [emoji, on]
properties:
emoji: { type: string, maxLength: 32 }
on: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/Comment" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/watch:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPageWatch
tags: [notifications]
summary: Whether the caller watches the page
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
"404": { $ref: "#/components/responses/Error" }
put:
operationId: setPageWatch
tags: [notifications]
summary: Watch the page, or mute it
description: Muting is remembered, so commenting later does not start watching again.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/WatchState" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/notifications:
get:
operationId: listNotifications
tags: [notifications]
summary: The caller's newest notifications with the unread count
security: [{ bearer: [] }]
parameters:
- { name: unread, in: query, description: Only unread ones, schema: { type: boolean } }
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100 } }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationList" }
"401": { $ref: "#/components/responses/Error" }
/api/v1/notifications/read:
post:
operationId: markNotificationsRead
tags: [notifications]
summary: Mark notifications read (the listed ones, or all)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
ids: { type: array, items: { type: string } }
all: { type: boolean }
responses:
"200":
description: The unread count afterwards
content:
application/json:
schema:
type: object
required: [unread]
properties:
unread: { type: integer }
"400": { $ref: "#/components/responses/Error" }
/api/v1/notifications/settings:
get:
operationId: getNotificationSettings
tags: [notifications]
summary: The caller's notification preferences
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
put:
operationId: setNotificationSettings
tags: [notifications]
summary: Change the caller's notification preferences
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/NotificationSettings" }
"400": { $ref: "#/components/responses/Error" }
/api/v1/admin/stats:
get:
operationId: getAdminStats
@@ -2341,9 +2524,11 @@ components:
pages: { type: array, items: { $ref: "#/components/schemas/PageNode" }, description: Pages under the shared page, in tree order (only when the link includes subpages) }
Comment:
type: object
required: [id, page, author, body, quote, anchor, created, canDelete]
required:
[id, parent, page, author, body, quote, anchor, created, editedAt, resolvedAt, resolvedBy, reactions, canEdit, canDelete, canResolve]
properties:
id: { type: string }
parent: { type: string, description: The thread's first comment for a reply; empty for a thread }
page: { type: string }
author: { $ref: "#/components/schemas/MemberUser" }
body: { type: string }
@@ -2352,7 +2537,55 @@ components:
oneOf: [{ type: object, additionalProperties: true }, { type: "null" }]
description: As sent when the comment was created; null when there was none
created: { type: string }
editedAt: { type: string, description: Empty when never edited }
resolvedAt: { type: string, description: Empty unless the thread is resolved }
resolvedBy:
oneOf: [{ $ref: "#/components/schemas/MemberUser" }, { type: "null" }]
reactions: { type: array, items: { $ref: "#/components/schemas/Reaction" }, description: Most used first }
canEdit: { type: boolean }
canDelete: { type: boolean }
canResolve: { type: boolean, description: A thread the caller may resolve or reopen }
Reaction:
type: object
required: [emoji, count, mine, people]
properties:
emoji: { type: string }
count: { type: integer }
mine: { type: boolean }
people: { type: array, items: { type: string }, description: Names of the people who reacted }
WatchState:
type: object
required: [watching]
properties:
watching: { type: boolean }
NotificationType: { type: string, enum: [comment, reply, mention, share, resolved] }
Notification:
type: object
required: [id, type, workspace, page, comment, actor, excerpt, created, read]
properties:
id: { type: string }
type: { $ref: "#/components/schemas/NotificationType" }
workspace: { type: string }
page:
oneOf: [{ $ref: "#/components/schemas/PageRef" }, { type: "null" }]
description: Null when the page is gone or the caller lost access to it
comment: { type: string, description: The comment it is about, if any }
actor:
oneOf: [{ $ref: "#/components/schemas/MemberUser" }, { type: "null" }]
excerpt: { type: string }
created: { type: string }
read: { type: boolean }
NotificationList:
type: object
required: [items, unread]
properties:
items: { type: array, items: { $ref: "#/components/schemas/Notification" } }
unread: { type: integer }
NotificationSettings:
type: object
required: [email]
properties:
email: { type: string, enum: [digest, "off"], description: Unread notifications by email every few minutes, or no emails }
AdminStats:
type: object
required: [scope, users, organizations, workspaces, spaces, pages, attachments, storageBytes, rooms, editors, indexed]