mirror of
https://github.com/docmost/docmost.git
synced 2026-09-11 07:56:54 +08:00
* feat: page verification workflow * feat: refactor page-verification * sync * fix type * fix * fix * notification icon * use full word * accept .license file * - update templates - update migration and notification * fix copy * update audit labels * sync * add space name
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
export const NotificationType = {
|
|
COMMENT_USER_MENTION: 'comment.user_mention',
|
|
COMMENT_CREATED: 'comment.created',
|
|
COMMENT_RESOLVED: 'comment.resolved',
|
|
PAGE_USER_MENTION: 'page.user_mention',
|
|
PAGE_PERMISSION_GRANTED: 'page.permission_granted',
|
|
PAGE_UPDATED: 'page.updated',
|
|
PAGE_VERIFICATION_EXPIRING: 'page.verification_expiring',
|
|
PAGE_VERIFICATION_EXPIRED: 'page.verification_expired',
|
|
PAGE_VERIFIED: 'page.verified',
|
|
PAGE_APPROVAL_REQUESTED: 'page.approval_requested',
|
|
PAGE_APPROVAL_REJECTED: 'page.approval_rejected',
|
|
} as const;
|
|
|
|
export type NotificationType =
|
|
(typeof NotificationType)[keyof typeof NotificationType];
|
|
|
|
export type NotificationSettingKey =
|
|
| 'page.updated'
|
|
| 'page.userMention'
|
|
| 'comment.userMention'
|
|
| 'comment.created'
|
|
| 'comment.resolved';
|
|
|
|
export const NotificationTypeToSettingKey: Partial<
|
|
Record<NotificationType, NotificationSettingKey>
|
|
> = {
|
|
[NotificationType.PAGE_UPDATED]: 'page.updated',
|
|
[NotificationType.PAGE_USER_MENTION]: 'page.userMention',
|
|
[NotificationType.COMMENT_USER_MENTION]: 'comment.userMention',
|
|
[NotificationType.COMMENT_CREATED]: 'comment.created',
|
|
[NotificationType.COMMENT_RESOLVED]: 'comment.resolved',
|
|
};
|
|
|
|
export type NotificationTab = 'direct' | 'updates' | 'all';
|
|
|
|
export const DIRECT_NOTIFICATION_TYPES: NotificationType[] = [
|
|
NotificationType.COMMENT_USER_MENTION,
|
|
NotificationType.COMMENT_CREATED,
|
|
NotificationType.COMMENT_RESOLVED,
|
|
NotificationType.PAGE_USER_MENTION,
|
|
NotificationType.PAGE_PERMISSION_GRANTED,
|
|
];
|
|
|
|
export const UPDATES_NOTIFICATION_TYPES: NotificationType[] = [
|
|
NotificationType.PAGE_UPDATED,
|
|
];
|
|
|
|
export function getTypesForTab(tab: NotificationTab): NotificationType[] | undefined {
|
|
if (tab === 'direct') return DIRECT_NOTIFICATION_TYPES;
|
|
if (tab === 'updates') return UPDATES_NOTIFICATION_TYPES;
|
|
return undefined;
|
|
}
|