mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(server): set default doc title to Untitled on email (#11152)
close CLOUD-181
This commit is contained in:
@@ -2273,3 +2273,92 @@ Generated by [AVA](https://avajs.dev).
|
||||
</table>␊
|
||||
<!--/$-->␊
|
||||
`
|
||||
|
||||
## should render mention email with empty doc title
|
||||
|
||||
> test@test.com mentioned you in
|
||||
|
||||
`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">␊
|
||||
<!--$-->␊
|
||||
<table␊
|
||||
align="center"␊
|
||||
width="100%"␊
|
||||
border="0"␊
|
||||
cellpadding="0"␊
|
||||
cellspacing="0"␊
|
||||
role="presentation">␊
|
||||
<tbody>␊
|
||||
<tr>␊
|
||||
<td>␊
|
||||
<p␊
|
||||
style="font-size:20px;line-height:28px;margin-bottom:0;margin-top:24px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;color:#141414">␊
|
||||
You are mentioned!␊
|
||||
</p>␊
|
||||
</td>␊
|
||||
</tr>␊
|
||||
</tbody>␊
|
||||
</table>␊
|
||||
<table␊
|
||||
align="center"␊
|
||||
width="100%"␊
|
||||
border="0"␊
|
||||
cellpadding="0"␊
|
||||
cellspacing="0"␊
|
||||
role="presentation">␊
|
||||
<tbody>␊
|
||||
<tr>␊
|
||||
<td>␊
|
||||
<table␊
|
||||
align="center"␊
|
||||
width="100%"␊
|
||||
border="0"␊
|
||||
cellpadding="0"␊
|
||||
cellspacing="0"␊
|
||||
role="presentation">␊
|
||||
<tbody style="width:100%">␊
|
||||
<tr style="width:100%">␊
|
||||
<p␊
|
||||
style="font-size:15px;line-height:24px;margin-bottom:0;margin-top:24px;font-weight:400;font-family:Inter, Arial, Helvetica, sans-serif;color:#141414">␊
|
||||
<span style="font-weight:600">test@test.com</span> mentioned you␊
|
||||
in␊
|
||||
<a␊
|
||||
href="https://app.affine.pro"␊
|
||||
style="color:#067df7;text-decoration-line:none"␊
|
||||
target="_blank"␊
|
||||
><span style="font-weight:600">Untitled</span></a␊
|
||||
>.␊
|
||||
</p>␊
|
||||
</tr>␊
|
||||
</tbody>␊
|
||||
</table>␊
|
||||
<table␊
|
||||
align="center"␊
|
||||
width="100%"␊
|
||||
border="0"␊
|
||||
cellpadding="0"␊
|
||||
cellspacing="0"␊
|
||||
role="presentation">␊
|
||||
<tbody style="width:100%">␊
|
||||
<tr style="width:100%">␊
|
||||
<a␊
|
||||
href="https://app.affine.pro"␊
|
||||
style="line-height:24px;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;font-size:15px;font-weight:600;font-family:Inter, Arial, Helvetica, sans-serif;margin-top:24px;margin-bottom:0;color:#FFFFFF;background-color:#1E96EB;padding:8px 18px 8px 18px;border-radius:8px;border:1px solid rgba(0,0,0,.1);margin-right:4px"␊
|
||||
target="_blank"␊
|
||||
><span␊
|
||||
><!--[if mso]><i style="mso-font-width:450%;mso-text-raise:12" hidden>  </i><![endif]--></span␊
|
||||
><span␊
|
||||
style="max-width:100%;display:inline-block;line-height:120%;mso-padding-alt:0px;mso-text-raise:6px"␊
|
||||
>Open Doc</span␊
|
||||
><span␊
|
||||
><!--[if mso]><i style="mso-font-width:450%" hidden>  ​</i><![endif]--></span␊
|
||||
></a␊
|
||||
>␊
|
||||
</tr>␊
|
||||
</tbody>␊
|
||||
</table>␊
|
||||
</td>␊
|
||||
</tr>␊
|
||||
</tbody>␊
|
||||
</table>␊
|
||||
<!--/$-->␊
|
||||
`
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
import test from 'ava';
|
||||
|
||||
import { Renderers } from '../mails';
|
||||
import { TEST_DOC, TEST_USER } from '../mails/common';
|
||||
|
||||
test('should render emails', async t => {
|
||||
for (const render of Object.values(Renderers)) {
|
||||
@@ -9,3 +10,14 @@ test('should render emails', async t => {
|
||||
t.snapshot(content.html, content.subject);
|
||||
}
|
||||
});
|
||||
|
||||
test('should render mention email with empty doc title', async t => {
|
||||
const content = await Renderers.Mention({
|
||||
user: TEST_USER,
|
||||
doc: {
|
||||
...TEST_DOC,
|
||||
title: '',
|
||||
},
|
||||
});
|
||||
t.snapshot(content.html, content.subject);
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface DocProps {
|
||||
export const Doc = (props: DocProps) => {
|
||||
return (
|
||||
<Link href={props.url}>
|
||||
<Bold>{props.title}</Bold>
|
||||
<Bold>{props.title || 'Untitled'}</Bold>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user