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,9 +57,10 @@ onDone(() => {
});
});
if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
onMounted(async () => {
if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
await router.push("/");
} else {
} else {
const login = {
user: {
id: userId,
@ -75,5 +79,6 @@ if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
isLoggedIn: true,
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"