Merge branch 'fixes' into 'main'

Various fixes

Closes #1223 et #1214

See merge request framasoft/mobilizon!1348
This commit is contained in:
Thomas Citharel 2022-12-22 11:24:30 +00:00
commit ce9a310d91
8 changed files with 65 additions and 61 deletions

View File

@ -235,7 +235,7 @@ const isComponentModalActive = ref(false);
const contactFilter = ref("");
const membersPage = ref(1);
const { result: membersResult } = useQuery<{ group: Pick<IGroup, 'members'> }>(
const { result: membersResult } = useQuery<{ group: Pick<IGroup, "members"> }>(
GROUP_MEMBERS,
() => ({
groupName: usernameWithDomain(selectedActor.value),
@ -247,8 +247,10 @@ const { result: membersResult } = useQuery<{ group: Pick<IGroup, 'members'> }>(
() => ({ enabled: selectedActor.value?.type === ActorType.GROUP })
);
const members = computed<Paginate<IMember>>(
() => selectedActor.value?.type === ActorType.GROUP ? membersResult.value?.group?.members ?? { elements: [], total: 0 } : { elements: [], total: 0 }
const members = computed<Paginate<IMember>>(() =>
selectedActor.value?.type === ActorType.GROUP
? membersResult.value?.group?.members ?? { elements: [], total: 0 }
: { elements: [], total: 0 }
);
const actualContacts = computed({

View File

@ -118,6 +118,8 @@ const icons: Record<string, () => Promise<any>> = {
Loading: () =>
import(`../../../node_modules/vue-material-design-icons/Loading.vue`),
Eye: () => import(`../../../node_modules/vue-material-design-icons/Eye.vue`),
EyeOff: () =>
import(`../../../node_modules/vue-material-design-icons/EyeOff.vue`),
AlertCircle: () =>
import(`../../../node_modules/vue-material-design-icons/AlertCircle.vue`),
Rss: () => import(`../../../node_modules/vue-material-design-icons/Rss.vue`),

View File

@ -49,7 +49,7 @@ app.component("breadcrumbs-nav", Breadcrumbs);
app.component("material-icon", MaterialIcon);
app.use(Oruga, orugaConfig);
const instanceName = ref();
const instanceName = ref<string>();
apolloClient
.query<{ config: IConfig }>({

View File

@ -134,9 +134,7 @@ export const routes = [
path: "/auth/:provider/callback",
name: "auth-callback",
component: (): Promise<any> =>
import(
/* webpackChunkName: "ProviderValidation" */ "@/views/User/ProviderValidation.vue"
),
import("@/views/User/ProviderValidation.vue"),
meta: {
announcer: {
message: (): string => t("Redirecting to Mobilizon") as string,

View File

@ -221,8 +221,9 @@ const newRelayAddress = ref("");
// relayFollowers: Paginate<IFollower> = { elements: [], total: 0 };
const updateDomainFilter = (domain: string) => {
filterDomain.value = domain;
const updateDomainFilter = (event: InputEvent) => {
const newValue = (event.target as HTMLInputElement).value;
filterDomain.value = newValue;
};
const debouncedUpdateDomainFilter = debounce(updateDomainFilter, 500);

View File

@ -74,17 +74,13 @@
v-model="passwordForEmailChange"
/>
</o-field>
<o-button
class="mt-2"
variant="primary"
:disabled="!(emailForm && emailForm.checkValidity())"
>
<o-button class="mt-2" variant="primary" nativeType="submit">
{{ t("Change my email") }}
</o-button>
</form>
<h2 class="mt-2">{{ t("Password") }}</h2>
<o-notification
v-if="!canChangePassword"
v-if="!canChangePassword && loggedUser.provider"
variant="warning"
:closable="false"
>
@ -134,11 +130,7 @@
v-model="newPassword"
/>
</o-field>
<o-button
class="mt-2"
variant="primary"
:disabled="!(passwordForm && passwordForm.checkValidity())"
>
<o-button class="mt-2" variant="primary" nativeType="submit">
{{ t("Change my password") }}
</o-button>
</form>
@ -258,8 +250,8 @@ useHead({
title: computed(() => t("General settings")),
});
const passwordForm = ref<HTMLElement>();
const emailForm = ref<HTMLElement>();
const passwordForm = ref<HTMLFormElement>();
const emailForm = ref<HTMLFormElement>();
const passwordForEmailChange = ref("");
const newEmail = ref("");
@ -294,12 +286,14 @@ changeEmailMutationError((err) => {
});
const resetEmailAction = async (): Promise<void> => {
if (emailForm.value?.reportValidity()) {
changeEmailErrors.value = [];
changeEmailMutation({
email: newEmail.value,
password: passwordForEmailChange.value,
});
}
};
const {
@ -319,12 +313,14 @@ onChangePasswordMutationError((err) => {
});
const resetPasswordAction = async (): Promise<void> => {
if (passwordForm.value?.reportValidity()) {
changePasswordErrors.value = [];
changePasswordMutation({
oldPassword: oldPassword.value,
newPassword: newPassword.value,
});
}
};
const openDeleteAccountModal = (): void => {

View File

@ -1,6 +1,7 @@
<template>
<p>{{ t("Redirecting in progress…") }}</p>
</template>
<script lang="ts" setup>
import { ICurrentUserRole } from "@/types/enums";
import { UPDATE_CURRENT_USER_CLIENT, LOGGED_USER } from "../../graphql/user";
@ -9,10 +10,10 @@ import { saveUserData } from "../../utils/auth";
import { changeIdentity } from "../../utils/identity";
import { ICurrentUser, IUser } from "../../types/current-user.model";
import { useRouter } from "vue-router";
import { useMutation, useQuery } from "@vue/apollo-composable";
import { useLazyQuery, useMutation } from "@vue/apollo-composable";
import { useI18n } from "vue-i18n";
import { useHead } from "@vueuse/head";
import { computed } from "vue";
import { computed, onMounted } from "vue";
const { t } = useI18n({ useScope: "global" });
useHead({
@ -35,15 +36,17 @@ const userRole = getValueFromMeta("auth-user-role") as ICurrentUserRole;
const router = useRouter();
const { onDone, mutate } = useMutation<{ updateCurrentUser: ICurrentUser }>(
UPDATE_CURRENT_USER_CLIENT
);
const { onDone, mutate } = useMutation<
{ updateCurrentUser: ICurrentUser },
{ id: string; email: string; isLoggedIn: boolean; role: ICurrentUserRole }
>(UPDATE_CURRENT_USER_CLIENT);
onDone(() => {
const { onResult: onLoggedUserResult } = useQuery<{ loggedUser: IUser }>(
LOGGED_USER
);
const { onResult: onLoggedUserResult, load: loadUser } = useLazyQuery<{
loggedUser: IUser;
}>(LOGGED_USER);
onDone(async () => {
loadUser();
onLoggedUserResult(async ({ data: { loggedUser } }) => {
if (loggedUser.defaultActor) {
await changeIdentity(loggedUser.defaultActor);
@ -54,6 +57,7 @@ onDone(() => {
});
});
onMounted(async () => {
if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
await router.push("/");
} else {
@ -76,4 +80,5 @@ if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
role: userRole,
});
}
});
</script>

View File

@ -155,7 +155,7 @@ msgstr "Les inscriptions ne sont pas ouvertes"
#: lib/graphql/resolvers/user.ex:444
msgid "The current password is invalid"
msgstr "Le mot de passe actuel est invalid"
msgstr "Le mot de passe actuel est invalide"
#: lib/graphql/resolvers/admin.ex:336 lib/graphql/resolvers/user.ex:487
msgid "The new email doesn't seem to be valid"