merge-upstream-5.0.1 #66

Merged
778a69cd merged 80 commits from merge-upstream-5.0.1 into main 2024-12-26 12:55:41 +01:00
6 changed files with 31 additions and 24 deletions
Showing only changes of commit 3a3d77b698 - Show all commits

View file

@ -41,12 +41,12 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import { SnackbarProgrammatic as Snackbar } from "buefy"; // import { SnackbarProgrammatic as Snackbar } from "buefy";
import { doUpdateSetting, useUserSettings } from "@/composition/apollo/user"; import { doUpdateSetting, useLoggedUser } from "@/composition/apollo/user";
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
const notificationOnDay = ref(true); const notificationOnDay = ref(true);
const { loggedUser } = useUserSettings(); const { loggedUser } = useLoggedUser();
const updateSetting = async ( const updateSetting = async (
variables: Record<string, unknown> variables: Record<string, unknown>

View file

@ -55,7 +55,7 @@ import { useTimezones } from "@/composition/apollo/config";
import { import {
doUpdateSetting, doUpdateSetting,
updateLocale, updateLocale,
useUserSettings, useLoggedUser,
} from "@/composition/apollo/user"; } from "@/composition/apollo/user";
import { saveLocaleData } from "@/utils/auth"; import { saveLocaleData } from "@/utils/auth";
import { computed, onMounted, watch } from "vue"; import { computed, onMounted, watch } from "vue";
@ -68,7 +68,7 @@ const { t, locale } = useI18n({ useScope: "global" });
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const { loggedUser } = useUserSettings(); const { loggedUser } = useLoggedUser();
const { mutate: doUpdateLocale } = updateLocale(); const { mutate: doUpdateLocale } = updateLocale();

View file

@ -1,11 +1,10 @@
import { IDENTITIES, REGISTER_PERSON } from "@/graphql/actor"; import { IDENTITIES, REGISTER_PERSON } from "@/graphql/actor";
import { import {
CURRENT_USER_CLIENT, CURRENT_USER_CLIENT,
LOGGED_USER, LOGGED_USER_AND_SETTINGS,
LOGGED_USER_LOCATION, LOGGED_USER_LOCATION,
SET_USER_SETTINGS, SET_USER_SETTINGS,
UPDATE_USER_LOCALE, UPDATE_USER_LOCALE,
USER_SETTINGS,
} from "@/graphql/user"; } from "@/graphql/user";
import { IPerson } from "@/types/actor"; import { IPerson } from "@/types/actor";
import { ICurrentUser, IUser } from "@/types/current-user.model"; import { ICurrentUser, IUser } from "@/types/current-user.model";
@ -31,25 +30,14 @@ export function useCurrentUserClient() {
export function useLoggedUser() { export function useLoggedUser() {
const { currentUser } = useCurrentUserClient(); const { currentUser } = useCurrentUserClient();
const { result, error, onError } = useQuery<{ loggedUser: IUser }>( const { result, error, onError, loading } = useQuery<{ loggedUser: IUser }>(
LOGGED_USER, LOGGED_USER_AND_SETTINGS,
{}, {},
() => ({ enabled: currentUser.value?.id != null }) () => ({ enabled: currentUser.value?.id != null })
); );
const loggedUser = computed(() => result.value?.loggedUser); const loggedUser = computed(() => result.value?.loggedUser);
return { loggedUser, error, onError }; return { loggedUser, error, onError, loading };
}
export function useUserSettings() {
const {
result: userSettingsResult,
error,
loading,
} = useQuery<{ loggedUser: IUser }>(USER_SETTINGS);
const loggedUser = computed(() => userSettingsResult.value?.loggedUser);
return { loggedUser, error, loading };
} }
export function useUserLocation() { export function useUserLocation() {

View file

@ -125,6 +125,25 @@ export const USER_SETTINGS_FRAGMENT = gql`
} }
`; `;
export const LOGGED_USER_AND_SETTINGS = gql`
query LoggedUserQuery {
loggedUser {
id
email
locale
provider
defaultActor {
...ActorFragment
}
settings {
...UserSettingFragment
}
}
}
${ACTOR_FRAGMENT}
${USER_SETTINGS_FRAGMENT}
`;
export const USER_SETTINGS = gql` export const USER_SETTINGS = gql`
query UserSetting { query UserSetting {
loggedUser { loggedUser {

View file

@ -632,7 +632,7 @@ import {
useCurrentUserIdentities, useCurrentUserIdentities,
usePersonStatusGroup, usePersonStatusGroup,
} from "@/composition/apollo/actor"; } from "@/composition/apollo/actor";
import { useUserSettings } from "@/composition/apollo/user"; import { useLoggedUser } from "@/composition/apollo/user";
import { import {
computed, computed,
inject, inject,
@ -664,7 +664,7 @@ const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
const { eventCategories } = useEventCategories(); const { eventCategories } = useEventCategories();
const { anonymousParticipationConfig } = useAnonymousParticipationConfig(); const { anonymousParticipationConfig } = useAnonymousParticipationConfig();
const { currentActor } = useCurrentActorClient(); const { currentActor } = useCurrentActorClient();
const { loggedUser } = useUserSettings(); const { loggedUser } = useLoggedUser();
const { identities } = useCurrentUserIdentities(); const { identities } = useCurrentUserIdentities();
const { features } = useFeatures(); const { features } = useFeatures();

View file

@ -147,7 +147,7 @@ import RouteName from "../../router/name";
import { AddressSearchType } from "@/types/enums"; import { AddressSearchType } from "@/types/enums";
import { Address, IAddress } from "@/types/address.model"; import { Address, IAddress } from "@/types/address.model";
import { useTimezones } from "@/composition/apollo/config"; import { useTimezones } from "@/composition/apollo/config";
import { useUserSettings, updateLocale } from "@/composition/apollo/user"; import { useLoggedUser, updateLocale } from "@/composition/apollo/user";
import { useHead } from "@/utils/head"; import { useHead } from "@/utils/head";
import { computed, defineAsyncComponent, ref, watch } from "vue"; import { computed, defineAsyncComponent, ref, watch } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
@ -159,7 +159,7 @@ const FullAddressAutoComplete = defineAsyncComponent(
const { timezones: serverTimezones, loading: loadingTimezones } = const { timezones: serverTimezones, loading: loadingTimezones } =
useTimezones(); useTimezones();
const { loggedUser, loading: loadingUserSettings } = useUserSettings(); const { loggedUser, loading: loadingUserSettings } = useLoggedUser();
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });