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

+171 -6
View File
@@ -48,6 +48,51 @@ func (e InviteStatus) Valid() bool {
}
}
// Defines values for NotificationSettingsEmail.
const (
Digest NotificationSettingsEmail = "digest"
Off NotificationSettingsEmail = "off"
)
// Valid indicates whether the value is a known member of the NotificationSettingsEmail enum.
func (e NotificationSettingsEmail) Valid() bool {
switch e {
case Digest:
return true
case Off:
return true
default:
return false
}
}
// Defines values for NotificationType.
const (
NotificationTypeComment NotificationType = "comment"
NotificationTypeMention NotificationType = "mention"
NotificationTypeReply NotificationType = "reply"
NotificationTypeResolved NotificationType = "resolved"
NotificationTypeShare NotificationType = "share"
)
// Valid indicates whether the value is a known member of the NotificationType enum.
func (e NotificationType) Valid() bool {
switch e {
case NotificationTypeComment:
return true
case NotificationTypeMention:
return true
case NotificationTypeReply:
return true
case NotificationTypeResolved:
return true
case NotificationTypeShare:
return true
default:
return false
}
}
// Defines values for PageGrantType.
const (
PageGrantTypeGroup PageGrantType = "group"
@@ -398,10 +443,27 @@ type Comment struct {
Author MemberUser `json:"author"`
Body string `json:"body"`
CanDelete bool `json:"canDelete"`
Created string `json:"created"`
Id string `json:"id"`
Page string `json:"page"`
Quote string `json:"quote"`
CanEdit bool `json:"canEdit"`
// CanResolve A thread the caller may resolve or reopen
CanResolve bool `json:"canResolve"`
Created string `json:"created"`
// EditedAt Empty when never edited
EditedAt string `json:"editedAt"`
Id string `json:"id"`
Page string `json:"page"`
// Parent The thread's first comment for a reply; empty for a thread
Parent string `json:"parent"`
Quote string `json:"quote"`
// Reactions Most used first
Reactions []Reaction `json:"reactions"`
// ResolvedAt Empty unless the thread is resolved
ResolvedAt string `json:"resolvedAt"`
ResolvedBy *MemberUser `json:"resolvedBy"`
}
// CreateInviteRequest defines model for CreateInviteRequest.
@@ -568,6 +630,41 @@ type NameRequest struct {
Name string `json:"name"`
}
// Notification defines model for Notification.
type Notification struct {
Actor *MemberUser `json:"actor"`
// Comment The comment it is about
Comment string `json:"comment"`
Created string `json:"created"`
Excerpt string `json:"excerpt"`
Id string `json:"id"`
// Page Null when the page is gone or the caller lost access to it
Page *PageRef `json:"page"`
Read bool `json:"read"`
Type NotificationType `json:"type"`
Workspace string `json:"workspace"`
}
// NotificationList defines model for NotificationList.
type NotificationList struct {
Items []Notification `json:"items"`
Unread int `json:"unread"`
}
// NotificationSettings defines model for NotificationSettings.
type NotificationSettings struct {
// Email Unread notifications by email every few minutes
Email NotificationSettingsEmail `json:"email"`
}
// NotificationSettingsEmail Unread notifications by email every few minutes
type NotificationSettingsEmail string
// NotificationType defines model for NotificationType.
type NotificationType string
// Organization defines model for Organization.
type Organization struct {
Created string `json:"created"`
@@ -725,6 +822,16 @@ type PublicSettings struct {
Signup bool `json:"signup"`
}
// Reaction defines model for Reaction.
type Reaction struct {
Count int `json:"count"`
Emoji string `json:"emoji"`
Mine bool `json:"mine"`
// People Names of the people who reacted
People []string `json:"people"`
}
// Role Instance role. admin manages their own organization; superadmin manages everything.
type Role string
@@ -958,6 +1065,11 @@ type Version struct {
Version string `json:"version"`
}
// WatchState defines model for WatchState.
type WatchState struct {
Watching bool `json:"watching"`
}
// Workspace defines model for Workspace.
type Workspace struct {
Created string `json:"created"`
@@ -1012,6 +1124,22 @@ type ConfirmVerificationJSONBody struct {
Token string `json:"token"`
}
// UpdateCommentJSONBody defines parameters for UpdateComment.
type UpdateCommentJSONBody struct {
Body string `json:"body"`
}
// ReactToCommentJSONBody defines parameters for ReactToComment.
type ReactToCommentJSONBody struct {
Emoji string `json:"emoji"`
On bool `json:"on"`
}
// ResolveCommentJSONBody defines parameters for ResolveComment.
type ResolveCommentJSONBody struct {
Resolved bool `json:"resolved"`
}
// DownloadFileParams defines parameters for DownloadFile.
type DownloadFileParams struct {
Token *string `form:"token,omitempty" json:"token,omitempty"`
@@ -1025,6 +1153,19 @@ type ListInvitesParams struct {
Organization *string `form:"organization,omitempty" json:"organization,omitempty"`
}
// ListNotificationsParams defines parameters for ListNotifications.
type ListNotificationsParams struct {
// Unread Only unread ones
Unread *bool `form:"unread,omitempty" json:"unread,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
// MarkNotificationsReadJSONBody defines parameters for MarkNotificationsRead.
type MarkNotificationsReadJSONBody struct {
All *bool `json:"all,omitempty"`
Ids *[]string `json:"ids,omitempty"`
}
// DeletePageParams defines parameters for DeletePage.
type DeletePageParams struct {
Permanent *bool `form:"permanent,omitempty" json:"permanent,omitempty"`
@@ -1059,11 +1200,17 @@ type UploadAttachmentMultipartBody struct {
// CreateCommentJSONBody defines parameters for CreateComment.
type CreateCommentJSONBody struct {
// Anchor The editor's encoding of the commented range (opaque to the server)
// Anchor The editor's encoding of the commented range, opaque to the server (threads only)
Anchor *map[string]interface{} `json:"anchor,omitempty"`
Body string `json:"body"`
// Quote The commented text
// Mentions Ids of the people mentioned in body
Mentions *[]string `json:"mentions,omitempty"`
// Parent The thread to reply to
Parent *string `json:"parent,omitempty"`
// Quote The commented text (threads only)
Quote *string `json:"quote,omitempty"`
}
@@ -1221,6 +1368,15 @@ type ConfirmVerificationJSONRequestBody ConfirmVerificationJSONBody
// RequestVerificationJSONRequestBody defines body for RequestVerification for application/json ContentType.
type RequestVerificationJSONRequestBody = EmailRequest
// UpdateCommentJSONRequestBody defines body for UpdateComment for application/json ContentType.
type UpdateCommentJSONRequestBody UpdateCommentJSONBody
// ReactToCommentJSONRequestBody defines body for ReactToComment for application/json ContentType.
type ReactToCommentJSONRequestBody ReactToCommentJSONBody
// ResolveCommentJSONRequestBody defines body for ResolveComment for application/json ContentType.
type ResolveCommentJSONRequestBody ResolveCommentJSONBody
// UpdateGroupJSONRequestBody defines body for UpdateGroup for application/json ContentType.
type UpdateGroupJSONRequestBody = GroupRequest
@@ -1230,6 +1386,12 @@ type AddGroupMemberJSONRequestBody = EmailRequest
// CreateInviteJSONRequestBody defines body for CreateInvite for application/json ContentType.
type CreateInviteJSONRequestBody = CreateInviteRequest
// MarkNotificationsReadJSONRequestBody defines body for MarkNotificationsRead for application/json ContentType.
type MarkNotificationsReadJSONRequestBody MarkNotificationsReadJSONBody
// SetNotificationSettingsJSONRequestBody defines body for SetNotificationSettings for application/json ContentType.
type SetNotificationSettingsJSONRequestBody = NotificationSettings
// CreateOrgJSONRequestBody defines body for CreateOrg for application/json ContentType.
type CreateOrgJSONRequestBody = NameRequest
@@ -1263,6 +1425,9 @@ type MovePageJSONRequestBody MovePageJSONBody
// SetShareLinkJSONRequestBody defines body for SetShareLink for application/json ContentType.
type SetShareLinkJSONRequestBody SetShareLinkJSONBody
// SetPageWatchJSONRequestBody defines body for SetPageWatch for application/json ContentType.
type SetPageWatchJSONRequestBody = WatchState
// UpdateSpaceJSONRequestBody defines body for UpdateSpace for application/json ContentType.
type UpdateSpaceJSONRequestBody UpdateSpaceJSONBody