Public Access
feat(broadcasts): add admin broadcast page and user opt-out switch
Admin page /admin/broadcasts to write, test and send broadcasts in both languages; confirms the recipient count before send. History shows the counts. A new switch in settings lets users opt out of platform mails; account mails always come. Subject and body are plain text only.
This commit is contained in:
1 parent
0154202ddc
commit
fa0857f55d
13 files changed
+642
-4
No files matched your search
@@ -11,7 +11,7 @@ import {usePreferences} from '../context/PreferencesContext.jsx';
|
||||
import usePersistSettings from '../hooks/usePersistSettings.js';
|
||||
import useSaveResponse from '../hooks/useSaveResponse.js';
|
||||
import {FAVORITE_PLATFORMS, saveFavoritePlatform} from '../utils/platforms.js';
|
||||
import {LANGUAGES, saveSettings} from '../utils/settings.js';
|
||||
import {LANGUAGES, savePlatformMails, saveSettings} from '../utils/settings.js';
|
||||
|
||||
// Radix Select has no empty value.
|
||||
const NO_FAVORITE = 'NONE';
|
||||
@@ -41,6 +41,13 @@ export default function PreferencesCard() {
|
||||
}
|
||||
};
|
||||
|
||||
const handlePlatformMailsChange = async (next) => {
|
||||
if (await runSave(() => savePlatformMails(next))) {
|
||||
updateProfile((p) => ({...p, settings: {...p.settings, platformMails: next}}));
|
||||
toast.success(t('SETTINGS.SAVED'));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -83,6 +90,14 @@ export default function PreferencesCard() {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="platformMails">{t('SETTINGS.PLATFORM_MAILS')}</Label>
|
||||
<p className="text-xs text-muted-foreground">{t('SETTINGS.PLATFORM_MAILS_HINT')}</p>
|
||||
</div>
|
||||
<Switch id="platformMails" checked={profile?.settings?.platformMails ?? true}
|
||||
onCheckedChange={handlePlatformMailsChange}/>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user