feat(EmailNotifications): users can specify that they dont want email notifications
Build and Push Docker image / build-and-push (push) Successful in 2m8s Details

This commit is contained in:
Valentin Kolb 2024-06-13 18:52:04 +02:00
parent 841be395f9
commit 99132f9a7c
2 changed files with 30 additions and 21 deletions

View File

@ -52,6 +52,7 @@ export default function UserMenuModal() {
initialValues: {
sn: user?.sn ?? "",
givenName: user?.givenName ?? "",
muteEmailNotifications: user?.muteEmailNotifications ?? false
},
validate: {
sn: isNotEmpty('Bitte gebe deinen Nachnamen ein'),
@ -157,9 +158,9 @@ export default function UserMenuModal() {
</Text>
</div>
{(user?.memberOf?.length ?? 0) > 0 && <>
{user?.expand?.memberOf !== undefined && <>
<Title order={5}>Deine Gruppen</Title>
<LdapGroupsDisplay groups={user?.expand?.memberOf}/>
<LdapGroupsDisplay groups={user?.expand?.memberOf ?? []}/>
</>}
<Divider label={"Einstellungen"}/>
@ -218,22 +219,29 @@ export default function UserMenuModal() {
</>
}
<Group justify={"center"}>
{user?.REALM === "GUEST" && <>
<Tooltip label={"Vor- und Nachname speichern"}>
<ActionIcon
variant={"transparent"}
aria-label={"change email"}
onClick={() => {
mutation.mutate()
}}
color={"green"}
disabled={!formValues.isTouched()}
>
<IconDeviceFloppy/>
</ActionIcon>
</Tooltip>
<Switch
label={"Email Benachrichtigungen stummschalten"}
description={"Hier kannst du Email Benachrichtigungen für Gruppennachrichten stummschalten. " +
"Du erhältst weiterhin Benachrichtigungen für Ankündigungen."}
{...formValues.getInputProps("muteEmailNotifications")}
/>
<Group justify={"center"}>
<Tooltip label={"Account Einstellungen"}>
<ActionIcon
variant={"transparent"}
aria-label={"update account"}
onClick={() => {
mutation.mutate()
}}
color={"green"}
disabled={!formValues.isTouched()}
>
<IconDeviceFloppy/>
</ActionIcon>
</Tooltip>
{user?.REALM === "GUEST" && <>
<Tooltip label={"Email ändern"}>
<ActionIcon
variant={"transparent"}

View File

@ -5,6 +5,10 @@ export type UserModal = {
verified: boolean;
email: string;
emailVisibility: boolean;
muteEmailNotifications: boolean;
sn: string | null;
givenName: string | null;
} & RecordModel & (GuestUser | LDAPUser)
type GuestUser = {
@ -12,8 +16,6 @@ type GuestUser = {
cn: null;
dn: null;
sn: null;
givenName: null;
accountExpires: null;
objectGUID: null;
memberOf: [];
@ -24,8 +26,7 @@ type LDAPUser = {
cn: string;
dn: string;
sn: string;
givenName: string;
accountExpires: string | null;
objectGUID: string;
memberOf: string[];