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

+39 -2
View File
@@ -45,6 +45,12 @@ export type Job = Schemas["Job"];
export type Backup = Schemas["Backup"];
export type SharedPage = Schemas["SharedPage"];
export type PageGrantRole = Schemas["PageGrantRole"];
export type Reaction = Schemas["Reaction"];
export type WatchState = Schemas["WatchState"];
export type NotificationType = Schemas["NotificationType"];
export type Notification = Schemas["Notification"];
export type NotificationList = Schemas["NotificationList"];
export type NotificationSettings = Schemas["NotificationSettings"];
export type PageGrant = Schemas["PageGrant"];
export type PageInvite = Schemas["PageInvite"];
export type PageAccess = Schemas["PageAccess"];
@@ -177,7 +183,27 @@ export function createClient(opts: ClientOptions) {
},
comments: {
update: (id: string, body: string) =>
request<Comment>("PATCH", `/api/v1/comments/${encodeURIComponent(id)}`, { body }),
remove: (id: string) => request<void>("DELETE", `/api/v1/comments/${encodeURIComponent(id)}`),
resolve: (id: string, resolved: boolean) =>
post<Comment>(`/api/v1/comments/${encodeURIComponent(id)}/resolve`, { resolved }),
react: (id: string, emoji: string, on: boolean) =>
post<Comment>(`/api/v1/comments/${encodeURIComponent(id)}/reactions`, { emoji, on }),
},
notifications: {
list: (opts: { unread?: boolean; limit?: number } = {}) =>
request<NotificationList>(
"GET",
`/api/v1/notifications${query({ unread: opts.unread ? "true" : undefined, limit: opts.limit?.toString() })}`,
),
/** Marks the listed notifications read, or all of them; resolves to the unread count. */
markRead: (input: { ids?: string[]; all?: boolean }) =>
post<{ unread: number }>("/api/v1/notifications/read", input),
settings: () => request<NotificationSettings>("GET", "/api/v1/notifications/settings"),
setSettings: (input: NotificationSettings) =>
request<NotificationSettings>("PUT", "/api/v1/notifications/settings", input),
},
files: {
@@ -337,8 +363,19 @@ export function createClient(opts: ClientOptions) {
return upload<Attachment>(`/api/v1/pages/${encodeURIComponent(id)}/attachments`, form);
},
comments: (id: string) => request<Comment[]>("GET", `/api/v1/pages/${encodeURIComponent(id)}/comments`),
addComment: (id: string, input: { body: string; quote?: string; anchor?: Record<string, unknown> | null }) =>
post<Comment>(`/api/v1/pages/${encodeURIComponent(id)}/comments`, input),
watch: (id: string) => request<WatchState>("GET", `/api/v1/pages/${encodeURIComponent(id)}/watch`),
setWatch: (id: string, watching: boolean) =>
request<WatchState>("PUT", `/api/v1/pages/${encodeURIComponent(id)}/watch`, { watching }),
addComment: (
id: string,
input: {
body: string;
quote?: string;
anchor?: Record<string, unknown> | null;
parent?: string;
mentions?: string[];
},
) => post<Comment>(`/api/v1/pages/${encodeURIComponent(id)}/comments`, input),
/** The public link; rejects with a 404 ApiError when sharing is off. */
shareLink: (id: string) => request<ShareLink>("GET", `/api/v1/pages/${encodeURIComponent(id)}/share`),
setShareLink: (id: string, includeSubpages: boolean) =>
+418 -5
View File
@@ -1387,10 +1387,13 @@ export interface paths {
};
cookie?: never;
};
/** The page's inline comments, oldest first */
/** The page's comments and replies, oldest first (threads are the ones without a parent) */
get: operations["listComments"];
put?: never;
/** Comment on the page (commenter) */
/**
* 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.
*/
post: operations["createComment"];
delete?: never;
options?: never;
@@ -1410,10 +1413,124 @@ export interface paths {
get?: never;
put?: never;
post?: never;
/** Delete a comment (its author, or a space admin) */
/** Delete a comment, and a thread's replies with it (its author, or a space admin) */
delete: operations["deleteComment"];
options?: never;
head?: never;
/** Change a comment's text (its author) */
patch: operations["updateComment"];
trace?: never;
};
"/api/v1/comments/{id}/resolve": {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
get?: never;
put?: never;
/** Resolve a thread, or open it again (commenter) */
post: operations["resolveComment"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/comments/{id}/reactions": {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
get?: never;
put?: never;
/** Add or remove the caller's emoji reaction (commenter) */
post: operations["reactToComment"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/pages/{id}/watch": {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
/** Whether the caller watches the page */
get: operations["getPageWatch"];
/**
* Watch the page, or mute it
* @description Muting is remembered, so commenting later does not start watching again.
*/
put: operations["setPageWatch"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/notifications": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** The caller's newest notifications with the unread count */
get: operations["listNotifications"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/notifications/read": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** Mark notifications read (the listed ones, or all) */
post: operations["markNotificationsRead"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/notifications/settings": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** The caller's notification preferences */
get: operations["getNotificationSettings"];
/** Change the caller's notification preferences */
put: operations["setNotificationSettings"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
@@ -1983,6 +2100,8 @@ export interface components {
};
Comment: {
id: string;
/** @description The thread's first comment for a reply; empty for a thread */
parent: string;
page: string;
author: components["schemas"]["MemberUser"];
body: string;
@@ -1992,7 +2111,53 @@ export interface components {
[key: string]: unknown;
} | null;
created: string;
/** @description Empty when never edited */
editedAt: string;
/** @description Empty unless the thread is resolved */
resolvedAt: string;
resolvedBy: components["schemas"]["MemberUser"] | null;
/** @description Most used first */
reactions: components["schemas"]["Reaction"][];
canEdit: boolean;
canDelete: boolean;
/** @description A thread the caller may resolve or reopen */
canResolve: boolean;
};
Reaction: {
emoji: string;
count: number;
mine: boolean;
/** @description Names of the people who reacted */
people: string[];
};
WatchState: {
watching: boolean;
};
/** @enum {string} */
NotificationType: "comment" | "reply" | "mention" | "share" | "resolved";
Notification: {
id: string;
type: components["schemas"]["NotificationType"];
workspace: string;
/** @description Null when the page is gone or the caller lost access to it */
page: components["schemas"]["PageRef"] | null;
/** @description The comment it is about */
comment: string;
actor: components["schemas"]["MemberUser"] | null;
excerpt: string;
created: string;
read: boolean;
};
NotificationList: {
items: components["schemas"]["Notification"][];
unread: number;
};
NotificationSettings: {
/**
* @description Unread notifications by email every few minutes
* @enum {string}
*/
email: "digest" | "off";
};
AdminStats: {
/** @enum {string} */
@@ -4562,12 +4727,16 @@ export interface operations {
content: {
"application/json": {
body: string;
/** @description The commented text */
/** @description The commented text (threads only) */
quote?: string;
/** @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) */
anchor?: {
[key: string]: unknown;
};
/** @description The thread to reply to */
parent?: string;
/** @description Ids of the people mentioned in body */
mentions?: string[];
};
};
};
@@ -4608,6 +4777,250 @@ export interface operations {
404: components["responses"]["Error"];
};
};
updateComment: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
body: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Comment"];
};
};
400: components["responses"]["Error"];
403: components["responses"]["Error"];
404: components["responses"]["Error"];
};
};
resolveComment: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
resolved: boolean;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Comment"];
};
};
400: components["responses"]["Error"];
403: components["responses"]["Error"];
404: components["responses"]["Error"];
};
};
reactToComment: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
emoji: string;
on: boolean;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Comment"];
};
};
400: components["responses"]["Error"];
403: components["responses"]["Error"];
404: components["responses"]["Error"];
};
};
getPageWatch: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["WatchState"];
};
};
404: components["responses"]["Error"];
};
};
setPageWatch: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["WatchState"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["WatchState"];
};
};
404: components["responses"]["Error"];
};
};
listNotifications: {
parameters: {
query?: {
/** @description Only unread ones */
unread?: boolean;
limit?: number;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["NotificationList"];
};
};
401: components["responses"]["Error"];
};
};
markNotificationsRead: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
ids?: string[];
all?: boolean;
};
};
};
responses: {
/** @description The unread count afterwards */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
unread: number;
};
};
};
400: components["responses"]["Error"];
};
};
getNotificationSettings: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["NotificationSettings"];
};
};
};
};
setNotificationSettings: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["NotificationSettings"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["NotificationSettings"];
};
};
400: components["responses"]["Error"];
};
};
getAdminStats: {
parameters: {
query?: never;