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,12 +219,18 @@ export default function UserMenuModal() {
</> </>
} }
<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"}> <Group justify={"center"}>
{user?.REALM === "GUEST" && <> <Tooltip label={"Account Einstellungen"}>
<Tooltip label={"Vor- und Nachname speichern"}>
<ActionIcon <ActionIcon
variant={"transparent"} variant={"transparent"}
aria-label={"change email"} aria-label={"update account"}
onClick={() => { onClick={() => {
mutation.mutate() mutation.mutate()
}} }}
@ -234,6 +241,7 @@ export default function UserMenuModal() {
</ActionIcon> </ActionIcon>
</Tooltip> </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[];