@@ -432,7 +432,7 @@ const filteredLanguages = ref<string[]>([]);
|
||||
|
||||
const instanceLanguages = computed({
|
||||
get() {
|
||||
const languageCodes = [...adminSettings.value.instanceLanguages] || [];
|
||||
const languageCodes = [...(adminSettings.value?.instanceLanguages ?? [])];
|
||||
return languageCodes
|
||||
.map((code) => languageForCode(code))
|
||||
.filter((language) => language) as string[];
|
||||
@@ -468,7 +468,8 @@ saveAdminSettingsError((e) => {
|
||||
});
|
||||
|
||||
const updateSettings = async (): Promise<void> => {
|
||||
const variables = { ...settingsToWrite };
|
||||
const variables = { ...settingsToWrite.value };
|
||||
console.debug("updating settings with variables", variables);
|
||||
saveAdminSettings(variables);
|
||||
};
|
||||
|
||||
|
||||
@@ -131,7 +131,11 @@
|
||||
</span>
|
||||
</section>
|
||||
<!-- Recent events -->
|
||||
<CloseEvents @doGeoLoc="performGeoLocation()" :userLocation="userLocation" />
|
||||
<CloseEvents
|
||||
@doGeoLoc="performGeoLocation()"
|
||||
:userLocation="userLocation"
|
||||
:doingGeoloc="doingGeoloc"
|
||||
/>
|
||||
<CloseGroups :userLocation="userLocation" @doGeoLoc="performGeoLocation()" />
|
||||
<OnlineEvents />
|
||||
<LastEvents v-if="instanceName" :instanceName="instanceName" />
|
||||
@@ -224,7 +228,9 @@ const { result: aboutConfigResult } = useQuery<{
|
||||
IConfig,
|
||||
"name" | "description" | "slogan" | "registrationsOpen"
|
||||
>;
|
||||
}>(ABOUT);
|
||||
}>(ABOUT, undefined, {
|
||||
fetchPolicy: "cache-only",
|
||||
});
|
||||
|
||||
const config = computed(() => aboutConfigResult.value?.config);
|
||||
|
||||
@@ -507,10 +513,19 @@ GeolocationPosition) => {
|
||||
reverseGeoCodeInformation.latitude = latitude;
|
||||
reverseGeoCodeInformation.longitude = longitude;
|
||||
reverseGeoCodeInformation.accuracy = accuracy;
|
||||
doingGeoloc.value = false;
|
||||
};
|
||||
|
||||
const doingGeoloc = ref(false);
|
||||
|
||||
const performGeoLocation = () => {
|
||||
navigator.geolocation.getCurrentPosition(fetchAndSaveCurrentLocationName);
|
||||
doingGeoloc.value = true;
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
fetchAndSaveCurrentLocationName,
|
||||
() => {
|
||||
doingGeoloc.value = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<o-field :label="t('Language')" label-for="setting-language">
|
||||
<o-select
|
||||
:loading="loadingTimezones || loadingUserSettings"
|
||||
v-model="locale"
|
||||
v-model="$i18n.locale"
|
||||
:placeholder="t('Select a language')"
|
||||
id="setting-language"
|
||||
>
|
||||
@@ -64,11 +64,15 @@
|
||||
<o-field :label="t('City or region')" expanded label-for="setting-city">
|
||||
<full-address-auto-complete
|
||||
v-if="loggedUser?.settings"
|
||||
:type="AddressSearchType.ADMINISTRATIVE"
|
||||
:resultType="AddressSearchType.ADMINISTRATIVE"
|
||||
:doGeoLocation="false"
|
||||
v-model="address"
|
||||
:default-text="address?.description"
|
||||
id="setting-city"
|
||||
class="grid"
|
||||
:hideMap="true"
|
||||
:hideSelected="true"
|
||||
labelClass="sr-only"
|
||||
:placeholder="t('e.g. Nantes, Berlin, Cork, …')"
|
||||
/>
|
||||
</o-field>
|
||||
@@ -108,7 +112,6 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import ngeohash from "ngeohash";
|
||||
import { saveLocaleData } from "@/utils/auth";
|
||||
import {
|
||||
USER_SETTINGS,
|
||||
SET_USER_SETTINGS,
|
||||
@@ -133,7 +136,7 @@ const { timezones: serverTimezones, loading: loadingTimezones } =
|
||||
useTimezones();
|
||||
const { loggedUser, loading: loadingUserSettings } = useUserSettings();
|
||||
|
||||
const { t, locale: i18nLocale } = useI18n({ useScope: "global" });
|
||||
const { t, locale } = useI18n({ useScope: "global" });
|
||||
|
||||
useHead({
|
||||
title: computed(() => t("Preferences")),
|
||||
@@ -161,25 +164,6 @@ const selectedTimezone = computed({
|
||||
|
||||
const { mutate: updateUserLocale } = useMutation(UPDATE_USER_LOCALE);
|
||||
|
||||
const locale = computed({
|
||||
get(): string {
|
||||
if (loggedUser.value?.locale) {
|
||||
return loggedUser.value?.locale;
|
||||
}
|
||||
return i18nLocale.value as string;
|
||||
},
|
||||
set(newLocale: string) {
|
||||
if (newLocale) {
|
||||
updateUserLocale({
|
||||
locale: newLocale,
|
||||
});
|
||||
saveLocaleData(newLocale);
|
||||
console.debug("changing locale", i18nLocale, newLocale);
|
||||
i18nLocale.value = newLocale;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const sanitize = (timezone: string): string => {
|
||||
return timezone
|
||||
.split("_")
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
/>
|
||||
</o-field>
|
||||
|
||||
<p class="text-center my-2" v-if="!submitted">
|
||||
<p class="text-center my-2">
|
||||
<o-button
|
||||
variant="primary"
|
||||
size="large"
|
||||
@@ -227,6 +227,7 @@ const loginAction = (e: Event) => {
|
||||
}
|
||||
|
||||
submitted.value = true;
|
||||
errors.value = [];
|
||||
|
||||
loginMutation({
|
||||
email: credentials.email,
|
||||
|
||||
Reference in New Issue
Block a user