Merge branch 'fix-push-subscriptions-registration' into 'main'
Various fixes Closes #1343 and #1344 See merge request framasoft/mobilizon!1440
This commit is contained in:
@@ -42,6 +42,7 @@ import { usernameWithDomain } from "@/types/actor";
|
||||
import { formatTimeString } from "@/filters/datetime";
|
||||
import {
|
||||
ActivityEventCommentSubject,
|
||||
ActivityEventParticipantSubject,
|
||||
ActivityEventSubject,
|
||||
} from "@/types/enums";
|
||||
import { computed } from "vue";
|
||||
@@ -90,6 +91,14 @@ const translation = computed((): string | undefined => {
|
||||
return "You posted a comment on the event {event}.";
|
||||
}
|
||||
return "{profile} posted a comment on the event {event}.";
|
||||
case ActivityEventParticipantSubject.EVENT_NEW_PARTICIPATION:
|
||||
if (isAuthorCurrentActor.value) {
|
||||
return "You joined the event {event}.";
|
||||
}
|
||||
if (props.activity.author.preferredUsername === "anonymous") {
|
||||
return "An anonymous profile joined the event {event}.";
|
||||
}
|
||||
return "{profile} joined the the event {event}.";
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ import { EventJoinOptions } from "@/types/enums";
|
||||
import { IParticipant } from "../../types/participant.model";
|
||||
import RouteName from "../../router/name";
|
||||
import { CONFIRM_PARTICIPATION } from "../../graphql/event";
|
||||
import { computed, ref } from "vue";
|
||||
import { computed, ref, watchEffect } from "vue";
|
||||
import { useMutation } from "@vue/apollo-composable";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useHead } from "@vueuse/head";
|
||||
@@ -90,9 +90,15 @@ const { onDone, onError, mutate } = useMutation<{
|
||||
confirmParticipation: IParticipant;
|
||||
}>(CONFIRM_PARTICIPATION);
|
||||
|
||||
mutate(() => ({
|
||||
token: props.token,
|
||||
}));
|
||||
const participationToken = computed(() => props.token);
|
||||
|
||||
watchEffect(() => {
|
||||
if (participationToken.value) {
|
||||
mutate({
|
||||
token: participationToken.value,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onDone(async ({ data }) => {
|
||||
participation.value = data?.confirmParticipation;
|
||||
|
||||
@@ -70,14 +70,16 @@ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
const { loggedUser } = useUserSettings();
|
||||
|
||||
const { mutate: doUpdateLocale } = updateLocale();
|
||||
|
||||
onMounted(() => {
|
||||
updateLocale(locale as unknown as string);
|
||||
doUpdateLocale({ locale: locale as unknown as string });
|
||||
doUpdateSetting({ timezone });
|
||||
});
|
||||
|
||||
watch(locale, () => {
|
||||
if (locale.value) {
|
||||
updateLocale(locale.value as string);
|
||||
doUpdateLocale({ locale: locale as unknown as string });
|
||||
saveLocaleData(locale.value as string);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,12 +59,8 @@ export async function doUpdateSetting(
|
||||
}));
|
||||
}
|
||||
|
||||
export async function updateLocale(locale: string) {
|
||||
useMutation<{ id: string; locale: string }>(UPDATE_USER_LOCALE, () => ({
|
||||
variables: {
|
||||
locale,
|
||||
},
|
||||
}));
|
||||
export function updateLocale() {
|
||||
return useMutation<{ id: string; locale: string }>(UPDATE_USER_LOCALE);
|
||||
}
|
||||
|
||||
export function registerAccount() {
|
||||
|
||||
@@ -1579,5 +1579,8 @@
|
||||
"Access drafts events": "Access drafts events",
|
||||
"This application will be allowed to list and view your draft events": "This application will be allowed to list and view your draft events",
|
||||
"Access group suggested events": "Access group suggested events",
|
||||
"This application will be allowed to list your suggested group events": "This application will be allowed to list your suggested group events"
|
||||
"This application will be allowed to list your suggested group events": "This application will be allowed to list your suggested group events",
|
||||
"{profile} joined the the event {event}.": "{profile} joined the the event {event}.",
|
||||
"You joined the event {event}.": "You joined the event {event}.",
|
||||
"An anonymous profile joined the event {event}.": "An anonymous profile joined the event {event}."
|
||||
}
|
||||
@@ -1575,5 +1575,8 @@
|
||||
"Access drafts events": "Accéder aux événements brouillons",
|
||||
"This application will be allowed to list and view your draft events": "Cetta application sera autorisée à lister et accéder à vos événements brouillons",
|
||||
"Access group suggested events": "Accéder aux événements des groupes suggérés",
|
||||
"This application will be allowed to list your suggested group events": "Cetta application sera autorisée à lister les événements de vos groupes qui vous sont suggérés"
|
||||
"This application will be allowed to list your suggested group events": "Cetta application sera autorisée à lister les événements de vos groupes qui vous sont suggérés",
|
||||
"{profile} joined the the event {event}.": "{profile} a rejoint l'événement {event}.",
|
||||
"You joined the event {event}.": "Vous avez rejoint l'événement {event}.",
|
||||
"An anonymous profile joined the event {event}.": "Un profil anonyme a rejoint l'événement {event}."
|
||||
}
|
||||
|
||||
@@ -32,9 +32,8 @@ export async function subscribeUserToPush(): Promise<PushSubscription | null> {
|
||||
};
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
try {
|
||||
const pushSubscription = await registration.pushManager.subscribe(
|
||||
subscribeOptions
|
||||
);
|
||||
const pushSubscription =
|
||||
await registration.pushManager.subscribe(subscribeOptions);
|
||||
console.debug("Received PushSubscription: ", pushSubscription);
|
||||
resolve(pushSubscription);
|
||||
} catch (e) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { IMember } from "./actor/member.model";
|
||||
import {
|
||||
ActivityDiscussionSubject,
|
||||
ActivityEventCommentSubject,
|
||||
ActivityEventParticipantSubject,
|
||||
ActivityEventSubject,
|
||||
ActivityGroupSubject,
|
||||
ActivityMemberSubject,
|
||||
@@ -21,7 +22,8 @@ export type ActivitySubject =
|
||||
| ActivityResourceSubject
|
||||
| ActivityDiscussionSubject
|
||||
| ActivityGroupSubject
|
||||
| ActivityEventCommentSubject;
|
||||
| ActivityEventCommentSubject
|
||||
| ActivityEventParticipantSubject;
|
||||
|
||||
export interface IActivity {
|
||||
id: string;
|
||||
|
||||
@@ -200,6 +200,10 @@ export enum ActivityEventCommentSubject {
|
||||
COMMENT_POSTED = "comment_posted",
|
||||
}
|
||||
|
||||
export enum ActivityEventParticipantSubject {
|
||||
EVENT_NEW_PARTICIPATION = "event_new_participation",
|
||||
}
|
||||
|
||||
export enum ActivityPostSubject {
|
||||
POST_CREATED = "post_created",
|
||||
POST_UPDATED = "post_updated",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="">
|
||||
<o-field :label="t('Status')" horizontal label-for="role-select">
|
||||
<o-select v-model="role" id="role-select">
|
||||
<option :value="null">
|
||||
<option value="EVERYTHING">
|
||||
{{ t("Everything") }}
|
||||
</option>
|
||||
<option :value="ParticipantRole.CREATOR">
|
||||
@@ -303,17 +303,15 @@ const participantsExportFormats = useParticipantsExportFormats();
|
||||
const ellipsize = (text?: string) =>
|
||||
text && text.substring(0, MESSAGE_ELLIPSIS_LENGTH).concat("…");
|
||||
|
||||
// metaInfo() {
|
||||
// return {
|
||||
// title: this.t("Participants") as string,
|
||||
// };
|
||||
// },
|
||||
const eventId = computed(() => props.eventId);
|
||||
|
||||
const ParticipantAllRoles = { ...ParticipantRole, EVERYTHING: "EVERYTHING" };
|
||||
|
||||
const page = useRouteQuery("page", 1, integerTransformer);
|
||||
const role = useRouteQuery(
|
||||
"role",
|
||||
ParticipantRole.PARTICIPANT,
|
||||
enumTransformer(ParticipantRole)
|
||||
"EVERYTHING",
|
||||
enumTransformer(ParticipantAllRoles)
|
||||
);
|
||||
|
||||
const checkedRows = ref<IParticipant[]>([]);
|
||||
@@ -325,10 +323,10 @@ const { result: participantsResult, loading: participantsLoading } = useQuery<{
|
||||
}>(
|
||||
PARTICIPANTS,
|
||||
() => ({
|
||||
uuid: props.eventId,
|
||||
uuid: eventId.value,
|
||||
page: page.value,
|
||||
limit: PARTICIPANTS_PER_PAGE,
|
||||
roles: role.value,
|
||||
roles: role.value === "EVERYTHING" ? undefined : role.value,
|
||||
}),
|
||||
() => ({
|
||||
enabled:
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<o-select
|
||||
:loading="loadingTimezones || loadingUserSettings"
|
||||
v-model="$i18n.locale"
|
||||
@update:modelValue="updateLanguage"
|
||||
:placeholder="t('Select a language')"
|
||||
id="setting-language"
|
||||
>
|
||||
@@ -147,7 +148,7 @@ import RouteName from "../../router/name";
|
||||
import { AddressSearchType } from "@/types/enums";
|
||||
import { Address, IAddress } from "@/types/address.model";
|
||||
import { useTimezones } from "@/composition/apollo/config";
|
||||
import { useUserSettings } from "@/composition/apollo/user";
|
||||
import { useUserSettings, updateLocale } from "@/composition/apollo/user";
|
||||
import { useHead } from "@vueuse/head";
|
||||
import { computed, defineAsyncComponent, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -172,6 +173,12 @@ useHead({
|
||||
const theme = ref(localStorage.getItem("theme"));
|
||||
const systemTheme = ref(!("theme" in localStorage));
|
||||
|
||||
const { mutate: doUpdateLocale } = updateLocale();
|
||||
|
||||
const updateLanguage = (newLocale: string) => {
|
||||
doUpdateLocale({ locale: newLocale });
|
||||
};
|
||||
|
||||
watch(systemTheme, (newSystemTheme) => {
|
||||
console.debug("changing system theme", newSystemTheme);
|
||||
if (newSystemTheme) {
|
||||
|
||||
Reference in New Issue
Block a user