1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-27 02:10:27 +00:00

fix(front): fix showing current identity avatar & banners

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-30 09:03:51 +02:00
parent 20b4aaabc9
commit d0f4721925
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -215,7 +215,7 @@ import { IPerson, displayName } from "@/types/actor";
import PictureUpload from "@/components/PictureUpload.vue";
import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint";
import RouteName from "@/router/name";
import { buildFileVariable } from "@/utils/image";
import { buildFileFromIMedia, buildFileVariable } from "@/utils/image";
import { changeIdentity } from "@/utils/identity";
import {
CREATE_FEED_TOKEN_ACTOR,
@ -237,6 +237,7 @@ import { Dialog } from "@/plugins/dialog";
import { Notifier } from "@/plugins/notifier";
import { AbsintheGraphQLErrors } from "@/types/errors.model";
import { ICurrentUser } from "@/types/current-user.model";
import { useHead } from "@vueuse/head";
const { t } = useI18n({ useScope: "global" });
const router = useRouter();
@ -245,7 +246,11 @@ const props = defineProps<{ isUpdate: boolean; identityName?: string }>();
const { currentActor } = useCurrentActorClient();
const { result: personResult, onError: onPersonError } = useQuery<{
const {
result: personResult,
onError: onPersonError,
onResult: onPersonResult,
} = useQuery<{
fetchPerson: IPerson;
}>(
FETCH_PERSON,
@ -257,6 +262,10 @@ const { result: personResult, onError: onPersonError } = useQuery<{
})
);
onPersonResult(async ({ data }) => {
avatarFile.value = await buildFileFromIMedia(data?.fetchPerson?.avatar);
});
onPersonError((err) => handleErrors(err as unknown as AbsintheGraphQLErrors));
const person = computed(() => personResult.value?.fetchPerson);
@ -285,24 +294,6 @@ watch(person, () => {
const avatarMaxSize = useAvatarMaxSize();
// error({ graphQLErrors }) {
// this.handleErrors(graphQLErrors);
// },
// metaInfo() {
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// // @ts-ignore
// const { isUpdate, identityName } = this;
// let title = t("Create a new profile") as string;
// if (isUpdate) {
// title = t("Edit profile {profile}", {
// profile: identityName,
// }) as string;
// }
// return {
// title,
// };
// },
const errors = ref<string[]>([]);
const avatarFile = ref<File | null>(null);
const showCopiedTooltip = reactive({ ics: false, atom: false });
@ -764,4 +755,16 @@ const breadcrumbsLinks = computed(
const updateUsername = (value: string) => {
identity.value.preferredUsername = convertToUsername(value);
};
useHead({
title: computed(() => {
let title = t("Create a new profile") as string;
if (isUpdate.value) {
title = t("Edit profile {profile}", {
profile: identityName.value,
}) as string;
}
return title;
}),
});
</script>