mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat(server): support comment notification type (#12924)
#### PR Dependency Tree * **PR #12924** 👈 * **PR #12925** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced comment and comment mention notifications, including email notifications when users are mentioned or receive comments on documents. * Added new email templates for comment and comment mention notifications. * Users can now control whether they receive comment-related emails via a new user setting. * **Bug Fixes** * None. * **Documentation** * Updated GraphQL schema documentation to reflect new notification types and user settings. * **Refactor** * Streamlined and enhanced test coverage for notification and user settings, including comment notifications. * **Chores** * Improved test setup and snapshot coverage for user settings and notifications. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
37
packages/backend/server/src/mails/docs/comment-mention.tsx
Normal file
37
packages/backend/server/src/mails/docs/comment-mention.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { TEST_DOC, TEST_USER } from '../common';
|
||||
import {
|
||||
Button,
|
||||
Content,
|
||||
Doc,
|
||||
type DocProps,
|
||||
P,
|
||||
Template,
|
||||
Title,
|
||||
User,
|
||||
type UserProps,
|
||||
} from '../components';
|
||||
|
||||
export type CommentMentionProps = {
|
||||
user: UserProps;
|
||||
doc: DocProps;
|
||||
};
|
||||
|
||||
export function CommentMention(props: CommentMentionProps) {
|
||||
const { user, doc } = props;
|
||||
return (
|
||||
<Template>
|
||||
<Title>You are mentioned in a comment</Title>
|
||||
<Content>
|
||||
<P>
|
||||
<User {...user} /> mentioned you in a comment on <Doc {...doc} />.
|
||||
</P>
|
||||
<Button href={doc.url}>View Comment</Button>
|
||||
</Content>
|
||||
</Template>
|
||||
);
|
||||
}
|
||||
|
||||
CommentMention.PreviewProps = {
|
||||
user: TEST_USER,
|
||||
doc: TEST_DOC,
|
||||
};
|
||||
37
packages/backend/server/src/mails/docs/comment.tsx
Normal file
37
packages/backend/server/src/mails/docs/comment.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { TEST_DOC, TEST_USER } from '../common';
|
||||
import {
|
||||
Button,
|
||||
Content,
|
||||
Doc,
|
||||
type DocProps,
|
||||
P,
|
||||
Template,
|
||||
Title,
|
||||
User,
|
||||
type UserProps,
|
||||
} from '../components';
|
||||
|
||||
export type CommentProps = {
|
||||
user: UserProps;
|
||||
doc: DocProps;
|
||||
};
|
||||
|
||||
export function Comment(props: CommentProps) {
|
||||
const { user, doc } = props;
|
||||
return (
|
||||
<Template>
|
||||
<Title>You have a new comment</Title>
|
||||
<Content>
|
||||
<P>
|
||||
<User {...user} /> commented on <Doc {...doc} />.
|
||||
</P>
|
||||
<Button href={doc.url}>View Comment</Button>
|
||||
</Content>
|
||||
</Template>
|
||||
);
|
||||
}
|
||||
|
||||
Comment.PreviewProps = {
|
||||
user: TEST_USER,
|
||||
doc: TEST_DOC,
|
||||
};
|
||||
@@ -1 +1,3 @@
|
||||
export * from './comment';
|
||||
export * from './comment-mention';
|
||||
export * from './mention';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { render as rawRender } from '@react-email/components';
|
||||
|
||||
import { Mention } from './docs';
|
||||
import { Comment, CommentMention, Mention } from './docs';
|
||||
import {
|
||||
TeamBecomeAdmin,
|
||||
TeamBecomeCollaborator,
|
||||
@@ -125,6 +125,15 @@ export const Renderers = {
|
||||
Mention,
|
||||
props => `${props.user.email} mentioned you in ${props.doc.title}`
|
||||
),
|
||||
Comment: make(
|
||||
Comment,
|
||||
props => `${props.user.email} commented on ${props.doc.title}`
|
||||
),
|
||||
CommentMention: make(
|
||||
CommentMention,
|
||||
props =>
|
||||
`${props.user.email} mentioned you in a comment on ${props.doc.title}`
|
||||
),
|
||||
//#endregion
|
||||
|
||||
//#region Team
|
||||
|
||||
Reference in New Issue
Block a user