mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 00:26:51 +08:00
feat(core): add comment notification settings (#13029)
 #### PR Dependency Tree * **PR #13029** 👈 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** * Added an option in user settings to enable or disable email notifications for comments on your documents. * Updated the user interface to include a toggle for comment email notifications. * Extended GraphQL queries and schema to support the new comment email notification setting. * **Localization** * Added new English translations for comment email notification settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -14,6 +14,7 @@ export async function getUserSettings(
|
||||
settings {
|
||||
receiveInvitationEmail
|
||||
receiveMentionEmail
|
||||
receiveCommentEmail
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ test('should get user settings', async t => {
|
||||
t.deepEqual(settings, {
|
||||
receiveInvitationEmail: true,
|
||||
receiveMentionEmail: true,
|
||||
receiveCommentEmail: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,11 +32,13 @@ test('should update user settings', async t => {
|
||||
await updateUserSettings(app, {
|
||||
receiveInvitationEmail: false,
|
||||
receiveMentionEmail: false,
|
||||
receiveCommentEmail: false,
|
||||
});
|
||||
const settings = await getUserSettings(app);
|
||||
t.deepEqual(settings, {
|
||||
receiveInvitationEmail: false,
|
||||
receiveMentionEmail: false,
|
||||
receiveCommentEmail: false,
|
||||
});
|
||||
|
||||
await updateUserSettings(app, {
|
||||
@@ -45,6 +48,7 @@ test('should update user settings', async t => {
|
||||
t.deepEqual(settings2, {
|
||||
receiveInvitationEmail: false,
|
||||
receiveMentionEmail: true,
|
||||
receiveCommentEmail: false,
|
||||
});
|
||||
|
||||
await updateUserSettings(app, {
|
||||
@@ -55,6 +59,33 @@ test('should update user settings', async t => {
|
||||
t.deepEqual(settings3, {
|
||||
receiveInvitationEmail: false,
|
||||
receiveMentionEmail: true,
|
||||
receiveCommentEmail: false,
|
||||
});
|
||||
});
|
||||
|
||||
test('should update user settings with comment email', async t => {
|
||||
await app.signup();
|
||||
|
||||
await updateUserSettings(app, {
|
||||
receiveCommentEmail: true,
|
||||
});
|
||||
|
||||
const settings = await getUserSettings(app);
|
||||
t.deepEqual(settings, {
|
||||
receiveCommentEmail: true,
|
||||
receiveInvitationEmail: true,
|
||||
receiveMentionEmail: true,
|
||||
});
|
||||
|
||||
await updateUserSettings(app, {
|
||||
receiveCommentEmail: false,
|
||||
});
|
||||
|
||||
const settings2 = await getUserSettings(app);
|
||||
t.deepEqual(settings2, {
|
||||
receiveCommentEmail: false,
|
||||
receiveInvitationEmail: true,
|
||||
receiveMentionEmail: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ query getUserSettings {
|
||||
settings {
|
||||
receiveInvitationEmail
|
||||
receiveMentionEmail
|
||||
receiveCommentEmail
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1558,6 +1558,7 @@ export const getUserSettingsQuery = {
|
||||
settings {
|
||||
receiveInvitationEmail
|
||||
receiveMentionEmail
|
||||
receiveCommentEmail
|
||||
}
|
||||
}
|
||||
}`,
|
||||
|
||||
@@ -4714,6 +4714,7 @@ export type GetUserSettingsQuery = {
|
||||
__typename?: 'UserSettingsType';
|
||||
receiveInvitationEmail: boolean;
|
||||
receiveMentionEmail: boolean;
|
||||
receiveCommentEmail: boolean;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
+11
@@ -95,6 +95,17 @@ export const NotificationSettings = () => {
|
||||
}
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingRow
|
||||
name={t['com.affine.setting.notifications.email.comments.title']()}
|
||||
desc={t['com.affine.setting.notifications.email.comments.subtitle']()}
|
||||
>
|
||||
<Switch
|
||||
data-testid="notification-email-comments-trigger"
|
||||
checked={userSettings?.receiveCommentEmail ?? false}
|
||||
disabled={disable}
|
||||
onChange={checked => handleUpdate('receiveCommentEmail', checked)}
|
||||
/>
|
||||
</SettingRow>
|
||||
</SettingWrapper>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -4825,6 +4825,14 @@ export function useAFFiNEI18N(): {
|
||||
* `Invitation related messages will be sent through emails.`
|
||||
*/
|
||||
["com.affine.setting.notifications.email.invites.subtitle"](): string;
|
||||
/**
|
||||
* `Comments`
|
||||
*/
|
||||
["com.affine.setting.notifications.email.comments.title"](): string;
|
||||
/**
|
||||
* `You will be notified through email when other members of the workspace comment on your docs.`
|
||||
*/
|
||||
["com.affine.setting.notifications.email.comments.subtitle"](): string;
|
||||
/**
|
||||
* `Account settings`
|
||||
*/
|
||||
|
||||
@@ -1199,6 +1199,8 @@
|
||||
"com.affine.setting.notifications.email.mention.subtitle": "You will be notified through email when other members of the workspace @ you.",
|
||||
"com.affine.setting.notifications.email.invites.title": "Invites",
|
||||
"com.affine.setting.notifications.email.invites.subtitle": "Invitation related messages will be sent through emails.",
|
||||
"com.affine.setting.notifications.email.comments.title": "Comments",
|
||||
"com.affine.setting.notifications.email.comments.subtitle": "You will be notified through email when other members of the workspace comment on your docs.",
|
||||
"com.affine.setting.account": "Account settings",
|
||||
"com.affine.setting.account.delete": "Delete your account",
|
||||
"com.affine.setting.account.delete.message": "Once deleted, your account will no longer be accessible, and all data in your personal cloud space will be permanently deleted.",
|
||||
|
||||
Reference in New Issue
Block a user