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

View File

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