Files
outline/shared/types/notifications.ts
T
Tom Moor 9666d8e825 feat: Add collection owners
- Collections can have owners, who also own every document in the
  collection, shown first in document bylines
- Owner is a role in the collection share panel and invite picker for
  individual users, adding an owner gives them the manage permission
- Lowering an owner's permission or removing their access removes the
  ownership
- ownerIds on collections.create, collections.update and the MCP
  collection tools
- The document owner filter includes documents in owned collections
- Access requests go to document and collection owners together
- Collection owners are subscribed to the collection and notified when
  they are added
- Deleted users are removed from collection owners
- Renames the personal collection policy helper to
  isPersonalCollectionOwner
2026-11-06 22:45:07 -05:00

87 lines
3.2 KiB
TypeScript

/** Events that a user can subscribe to. */
export enum SubscriptionType {
Document = "documents.update",
}
/** Events that can trigger a notification. */
export enum NotificationEventType {
PublishDocument = "documents.publish",
UpdateDocument = "documents.update",
AddUserToDocument = "documents.add_user",
AddOwnerToDocument = "documents.add_owner",
AddUserToCollection = "collections.add_user",
AddOwnerToCollection = "collections.add_owner",
AddUserToGroup = "groups.add_user",
RemoveUserFromGroup = "groups.remove_user",
CreateRevision = "revisions.create",
CreateCollection = "collections.create",
CreateComment = "comments.create",
ResolveComment = "comments.resolve",
ReactionsCreate = "reactions.create",
MentionedInDocument = "documents.mentioned",
MentionedInComment = "comments.mentioned",
GroupMentionedInDocument = "documents.group_mentioned",
GroupMentionedInComment = "comments.group_mentioned",
InviteAccepted = "emails.invite_accepted",
Onboarding = "emails.onboarding",
Features = "emails.features",
ExportCompleted = "emails.export_completed",
RequestDocumentAccess = "access_requests.create",
}
/** Channels that a notification can be delivered through. */
export enum NotificationChannelType {
App = "app",
Email = "email",
Chat = "chat",
}
/** Extra data stored on a notification. */
export type NotificationData = {
emoji?: string;
};
/** A user's notification settings, by event and optionally by channel. */
export type NotificationSettings = {
[event in NotificationEventType]?:
| {
[type in NotificationChannelType]?: boolean;
}
| boolean;
};
/** Whether each notification event is enabled when the user has no setting. */
export const NotificationEventDefaults: Record<NotificationEventType, boolean> =
{
[NotificationEventType.PublishDocument]: false,
[NotificationEventType.UpdateDocument]: true,
[NotificationEventType.CreateCollection]: false,
[NotificationEventType.CreateComment]: true,
[NotificationEventType.ResolveComment]: true,
[NotificationEventType.ReactionsCreate]: true,
[NotificationEventType.CreateRevision]: false,
[NotificationEventType.MentionedInDocument]: true,
[NotificationEventType.MentionedInComment]: true,
[NotificationEventType.GroupMentionedInDocument]: true,
[NotificationEventType.GroupMentionedInComment]: true,
[NotificationEventType.InviteAccepted]: true,
[NotificationEventType.Onboarding]: true,
[NotificationEventType.Features]: true,
[NotificationEventType.ExportCompleted]: true,
[NotificationEventType.AddUserToDocument]: true,
[NotificationEventType.AddOwnerToDocument]: true,
[NotificationEventType.AddUserToCollection]: true,
[NotificationEventType.AddOwnerToCollection]: true,
[NotificationEventType.AddUserToGroup]: true,
[NotificationEventType.RemoveUserFromGroup]: true,
[NotificationEventType.RequestDocumentAccess]: true,
};
/** Notices shown to the user from the `notice` query parameter. */
export enum QueryNotices {
UnsubscribeDocument = "unsubscribe-document",
UnsubscribeCollection = "unsubscribe-collection",
Subscribed = "subscribed",
Unsubscribed = "unsubscribed",
}