fix(server): add mode property on mention doc input (#10853)

This commit is contained in:
fengmk2
2025-03-14 08:23:27 +00:00
parent c31d01b2c2
commit 114e89961f
9 changed files with 180 additions and 13 deletions
@@ -6,13 +6,13 @@ import ava, { TestFn } from 'ava';
import { createTestingModule, type TestingModule } from '../../__tests__/utils';
import { Config } from '../../base/config';
import {
DocMode,
Models,
NotificationLevel,
NotificationType,
User,
Workspace,
} from '../../models';
interface Context {
config: Config;
module: TestingModule;
@@ -71,6 +71,7 @@ test('should create a mention notification with default level', async t => {
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -94,6 +95,7 @@ test('should create a mention notification with custom level', async t => {
id: docId,
title: 'doc-title',
elementId: 'elementId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -118,6 +120,7 @@ test('should mark a mention notification as read', async t => {
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -174,6 +177,7 @@ test('should find many notifications by user id, order by createdAt descending',
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -204,6 +208,7 @@ test('should find many notifications by user id, filter read notifications', asy
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -234,6 +239,7 @@ test('should clean expired notifications', async t => {
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -270,6 +276,7 @@ test('should not clean unexpired notifications', async t => {
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -290,6 +297,7 @@ test('should find many notifications by user id, order by createdAt descending,
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.edgeless,
},
createdByUserId: createdBy.id,
},
@@ -357,6 +365,7 @@ test('should count notifications by user id, exclude read notifications', async
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},
@@ -385,6 +394,7 @@ test('should count notifications by user id, include read notifications', async
id: docId,
title: 'doc-title',
blockId: 'blockId',
mode: DocMode.page,
},
createdByUserId: createdBy.id,
},