manage user pending of moderation - #877

This commit is contained in:
Laurent GAY
2025-09-11 20:07:20 +02:00
parent fbf22a83b2
commit 04cf4efee4
15 changed files with 574 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ export const VALIDATE_USER = gql`
user {
id
email
role
defaultActor {
...ActorFragment
}

View File

@@ -25,6 +25,7 @@
"A link to a page presenting the price options": "A link to a page presenting the price options",
"A member has been updated": "A member has been updated",
"A member requested to join one of my groups": "A member requested to join one of my groups",
"A moderator will take care of your request.": "A moderator will take care of your request.",
"A new version is available.": "A new version is available.",
"A place for your code of conduct, rules or guidelines. You can use HTML tags.": "A place for your code of conduct, rules or guidelines. You can use HTML tags.",
"A place to explain who you are and the things that set your instance apart. You can use HTML tags.": "A place to explain who you are and the things that set your instance apart. You can use HTML tags.",

View File

@@ -21,6 +21,7 @@ export enum ICurrentUserRole {
USER = "USER",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
PENDING = "PENDING",
}
export enum INotificationPendingEnum {

View File

@@ -63,12 +63,11 @@
:centered="true"
v-slot="props"
>
<template v-if="props.row.currentSignInAt">
<template v-if="props.row.confirmedAt">
<time :datetime="props.row.currentSignInAt">
{{ formatDateTimeString(props.row.currentSignInAt) }}
</time>
</template>
<template v-else-if="props.row.confirmedAt"> - </template>
<template v-else>
{{ $t("Not confirmed") }}
</template>

View File

@@ -17,6 +17,9 @@
</o-notification>
</div>
<h1 class="title" v-else>{{ $t("Your account has been validated") }}</h1>
<h2 class="title" v-if="moderated">
{{ $t("A moderator will take care of your request.") }}
</h2>
</div>
</section>
</template>
@@ -45,6 +48,7 @@ const props = defineProps<{
const loading = ref(true);
const failed = ref(false);
const moderated = ref(false);
onBeforeMount(() => {
validateAction({ token: props.token });
@@ -79,18 +83,22 @@ onUpdatingCurrentUserClientDone(async () => {
onValidatingUserMutationDone(async ({ data }) => {
if (data) {
saveUserData(data.validateUser);
saveTokenData(data.validateUser);
const { user: validatedUser } = data.validateUser;
user.value = validatedUser;
updateCurrentUserClient({
id: validatedUser.id,
email: validatedUser.email,
isLoggedIn: true,
role: ICurrentUserRole.USER,
});
if (validatedUser.role != ICurrentUserRole.PENDING) {
saveUserData(data.validateUser);
saveTokenData(data.validateUser);
await updateCurrentUserClient({
id: validatedUser.id,
email: validatedUser.email,
isLoggedIn: true,
role: validatedUser.role,
});
} else {
moderated.value = true;
loading.value = false;
}
}
});