mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
fix(server): use client doc title when server title is empty (#11210)
close CLOUD-185
This commit is contained in:
@@ -587,3 +587,31 @@ test('should send mention email by user setting', async t => {
|
||||
// should not send mention email
|
||||
t.is(module.mails.count('Mention'), mentionMailCount);
|
||||
});
|
||||
|
||||
test('should send mention email with use client doc title if server doc title is empty', async t => {
|
||||
const { notificationService, module } = t.context;
|
||||
const docId = randomUUID();
|
||||
await module.create(Mockers.DocMeta, {
|
||||
workspaceId: workspace.id,
|
||||
docId,
|
||||
// mock empty title
|
||||
title: '',
|
||||
});
|
||||
const notification = await notificationService.createMention({
|
||||
userId: member.id,
|
||||
body: {
|
||||
workspaceId: workspace.id,
|
||||
createdByUserId: owner.id,
|
||||
doc: {
|
||||
id: docId,
|
||||
title: 'doc-title-1',
|
||||
blockId: 'block-id-1',
|
||||
mode: DocMode.page,
|
||||
},
|
||||
},
|
||||
});
|
||||
t.truthy(notification);
|
||||
const mentionMail = module.mails.last('Mention');
|
||||
t.is(mentionMail.to, member.email);
|
||||
t.is(mentionMail.props.doc.title, 'doc-title-1');
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ export class NotificationService {
|
||||
input.body.workspaceId,
|
||||
input.body.doc.id
|
||||
);
|
||||
const title = doc?.title ?? input.body.doc.title;
|
||||
const title = doc?.title || input.body.doc.title;
|
||||
const url = this.url.link(
|
||||
generateDocPath({
|
||||
workspaceId: input.body.workspaceId,
|
||||
|
||||
Reference in New Issue
Block a user