Implement leave announcement for banned members and enhance moderation notifications
- Added a `leaveAnnounceBan` field to the `WelcomeConfig` model, allowing for optional announcements in the leave channel when a member is banned. - Updated the leave handling logic to check for bans and send a notice in the leave channel if the `leaveAnnounceBan` toggle is enabled. - Enhanced moderation actions (kick and ban) to notify the affected user via DM with the reason for the action. - Introduced a new `notifyModerationTargetDm` function to streamline DM notifications for moderation actions. - Updated the WebUI to include a toggle for the `leaveAnnounceBan` feature, improving user configurability. - Improved localization for new messages related to moderation notifications and leave announcements in both English and German. - Documented changes in phase tracking to reflect the new leave announcement feature and moderation notification enhancements.
This commit is contained in:
@@ -252,6 +252,22 @@ export function WelcomeForm({ guildId, initialValue, previewVars }: WelcomeFormP
|
||||
/>
|
||||
</div>
|
||||
</FieldAnchor>
|
||||
<FieldAnchor id="field-leave-announce-ban">
|
||||
<div className="flex items-center justify-between gap-4 rounded-md border border-border p-4">
|
||||
<div className="space-y-1">
|
||||
<Label>{t('modulePages.welcome.leaveAnnounceBanLabel')}</Label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('modulePages.welcome.leaveAnnounceBanHint')}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={value.leaveAnnounceBan}
|
||||
onCheckedChange={(checked) =>
|
||||
setValue((prev) => ({ ...prev, leaveAnnounceBan: checked }))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</FieldAnchor>
|
||||
<FieldAnchor id="field-leave-channel">
|
||||
<div className="space-y-2">
|
||||
<Label>{t('modulePages.welcome.leaveChannelId')}</Label>
|
||||
|
||||
@@ -309,6 +309,14 @@ export const SETTINGS_SEARCH_FIELDS: SearchIndexEntry[] = [
|
||||
href: 'welcome',
|
||||
hash: 'field-leave-enabled'
|
||||
},
|
||||
{
|
||||
id: 'setting-leave-announce-ban',
|
||||
kind: 'setting',
|
||||
labelKey: 'modulePages.welcome.leaveAnnounceBanLabel',
|
||||
href: 'welcome',
|
||||
hash: 'field-leave-announce-ban',
|
||||
keywords: ['ban', 'leave', 'moderation']
|
||||
},
|
||||
{
|
||||
id: 'setting-leave-channel',
|
||||
kind: 'setting',
|
||||
|
||||
@@ -42,6 +42,7 @@ function toDashboard(config: Awaited<ReturnType<typeof ensureWelcomeConfig>>): W
|
||||
leaveContent: config.leaveContent,
|
||||
leaveEmbed: parseEmbed(config.leaveEmbed),
|
||||
leaveComponents: parseComponents(config.leaveComponents),
|
||||
leaveAnnounceBan: config.leaveAnnounceBan,
|
||||
welcomeDmEnabled: config.welcomeDmEnabled,
|
||||
welcomeDmContent: config.welcomeDmContent,
|
||||
userAutoroleIds: config.userAutoroleIds,
|
||||
|
||||
@@ -549,6 +549,9 @@
|
||||
"leaveTitle": "Abschied",
|
||||
"leaveDescription": "Nachricht und Kanal, wenn ein Mitglied den Server verlässt.",
|
||||
"leaveEnabledLabel": "Abschiedsnachricht aktiviert",
|
||||
"leaveAnnounceBanLabel": "Ban im Abschieds-Kanal melden",
|
||||
"leaveAnnounceBanHint":
|
||||
"Zusätzlich zur Abschiedsnachricht anzeigen, wenn das Mitglied gebannt wurde (inkl. Grund).",
|
||||
"leaveChannelId": "Abschieds-Kanal-ID",
|
||||
"leaveType": "Nachrichtentyp",
|
||||
"leaveTypes": {
|
||||
|
||||
@@ -549,6 +549,9 @@
|
||||
"leaveTitle": "Leave",
|
||||
"leaveDescription": "Message and channel when a member leaves the server.",
|
||||
"leaveEnabledLabel": "Leave message enabled",
|
||||
"leaveAnnounceBanLabel": "Announce bans in leave channel",
|
||||
"leaveAnnounceBanHint":
|
||||
"Also post in the leave channel when the member was banned (including reason).",
|
||||
"leaveChannelId": "Leave channel ID",
|
||||
"leaveType": "Message type",
|
||||
"leaveTypes": {
|
||||
|
||||
Reference in New Issue
Block a user