From d9cc9f58426a8f735f0a65fc63378ddd27fd52b8 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 4 Dec 2020 15:07:27 +0100 Subject: [PATCH 1/6] Improve the message when loading comments below event Signed-off-by: Thomas Citharel --- js/src/components/Comment/CommentTree.vue | 11 +++++++---- .../unit/specs/components/Comment/CommentTree.spec.ts | 2 +- .../Comment/__snapshots__/CommentTree.spec.ts.snap | 10 +++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/js/src/components/Comment/CommentTree.vue b/js/src/components/Comment/CommentTree.vue index 592e23cd9..10c5bbc44 100644 --- a/js/src/components/Comment/CommentTree.vue +++ b/js/src/components/Comment/CommentTree.vue @@ -39,10 +39,13 @@ {{ $t("The organiser has chosen to close comments.") }} - -

- {{ $t("Loading…") }} -

+

+ {{ $t("Loading comments…") }} +

+ { expect(wrapper.findComponent({ name: "b-notification" }).text()).toBe( "The organiser has chosen to close comments." ); - expect(wrapper.find(".loading").text()).toBe("Loading…"); + expect(wrapper.find(".loading").text()).toBe("Loading comments…"); expect(wrapper.html()).toMatchSnapshot(); }); diff --git a/js/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap b/js/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap index 4ea79739c..48a66f29d 100644 --- a/js/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap +++ b/js/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap @@ -3,12 +3,9 @@ exports[`CommentTree renders a comment tree 1`] = `
The organiser has chosen to close comments. - -

- Loading… -

- -
+

+ Loading comments… +

`; @@ -16,7 +13,6 @@ exports[`CommentTree renders a comment tree 2`] = `
The organiser has chosen to close comments. - From b4229e2e0966c1fa77ae9cce87e03bdb31a8d63a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 4 Dec 2020 15:08:04 +0100 Subject: [PATCH 2/6] Fix logo component Directly inline the svg source Signed-off-by: Thomas Citharel --- js/src/assets/mobilizon_logo.svg | 11 ---------- js/src/components/Logo.vue | 37 +++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 21 deletions(-) delete mode 100644 js/src/assets/mobilizon_logo.svg diff --git a/js/src/assets/mobilizon_logo.svg b/js/src/assets/mobilizon_logo.svg deleted file mode 100644 index 97ef70b74..000000000 --- a/js/src/assets/mobilizon_logo.svg +++ /dev/null @@ -1,11 +0,0 @@ - - Mobilizon Logo - - - - - - - - - \ No newline at end of file diff --git a/js/src/components/Logo.vue b/js/src/components/Logo.vue index 97d010f41..92c1d47ea 100644 --- a/js/src/components/Logo.vue +++ b/js/src/components/Logo.vue @@ -1,19 +1,36 @@ diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 3974c7519..5c665e347 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -104,80 +104,16 @@
-
-
- - {{ $t("Cancel anonymous participation") }} - - {{ $t("You are participating in this event anonymously") }} - - - - - - - - {{ - $t( - "You are participating in this event anonymously but didn't confirm participation" - ) - }} - - - - - - -
-
- -
-
+
diff --git a/js/src/services/AnonymousParticipationStorage.ts b/js/src/services/AnonymousParticipationStorage.ts index 25f3e441f..ab03f3a68 100644 --- a/js/src/services/AnonymousParticipationStorage.ts +++ b/js/src/services/AnonymousParticipationStorage.ts @@ -160,11 +160,16 @@ async function removeAnonymousParticipation(eventUUID: string): Promise { ); } +function removeAllAnonymousParticipations(): void { + localStorage.removeItem(ANONYMOUS_PARTICIPATIONS_LOCALSTORAGE_KEY); +} + export { addLocalUnconfirmedAnonymousParticipation, confirmLocalAnonymousParticipation, getLeaveTokenForParticipation, isParticipatingInThisEvent, removeAnonymousParticipation, + removeAllAnonymousParticipations, AnonymousParticipationNotFoundError, }; diff --git a/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts b/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts index ff0339629..789826eba 100644 --- a/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts +++ b/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts @@ -3,7 +3,7 @@ import ParticipationSection from "@/components/Participation/ParticipationSectio import Buefy from "buefy"; import VueRouter from "vue-router"; import { routes } from "@/router"; -import { CommentModeration } from "@/types/enums"; +import { CommentModeration, EventJoinOptions } from "@/types/enums"; import { createMockClient, MockApolloClient, @@ -112,6 +112,50 @@ describe("ParticipationSection", () => { expect(cancelAnonymousParticipationButton.text()).toBe( "Cancel anonymous participation" ); + + wrapper.find(".event-participation small .is-clickable").trigger("click"); + expect( + wrapper + .findComponent({ ref: "anonymous-participation-modal" }) + .isVisible() + ).toBeTruthy(); + + cancelAnonymousParticipationButton.trigger("click"); + await wrapper.vm.$nextTick(); + expect(wrapper.emitted("cancel-anonymous-participation")).toBeTruthy(); + }); + + it("renders the participation section with existing confimed anonymous participation but event moderation", async () => { + generateWrapper( + {}, + { + anonymousParticipation: true, + event: { ...eventData, joinOptions: EventJoinOptions.RESTRICTED }, + } + ); + + expect(wrapper.find(".event-participation > small").text()).toContain( + "You are participating in this event anonymously" + ); + + const cancelAnonymousParticipationButton = wrapper.find( + ".event-participation > button.button.is-text" + ); + expect(cancelAnonymousParticipationButton.text()).toBe( + "Cancel anonymous participation" + ); + + wrapper.find(".event-participation small .is-clickable").trigger("click"); + + await wrapper.vm.$nextTick(); + const modal = wrapper.findComponent({ + ref: "anonymous-participation-modal", + }); + expect(modal.isVisible()).toBeTruthy(); + expect(modal.find("article.notification.is-primary").text()).toBe( + "As the event organiser has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted." + ); + cancelAnonymousParticipationButton.trigger("click"); await wrapper.vm.$nextTick(); expect(wrapper.emitted("cancel-anonymous-participation")).toBeTruthy(); From 4ea484ea14407c605e00c2afe81f1bb45fc1329e Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 4 Dec 2020 16:53:55 +0100 Subject: [PATCH 6/6] Update locale files Signed-off-by: Thomas Citharel --- .../Participation/ParticipationSection.vue | 2 +- js/src/i18n/en_US.json | 12 +++++++++++- js/src/i18n/fr_FR.json | 12 +++++++++++- .../Participation/ParticipationSection.spec.ts | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/js/src/components/Participation/ParticipationSection.vue b/js/src/components/Participation/ParticipationSection.vue index f619c2e43..5be6e1bfd 100644 --- a/js/src/components/Participation/ParticipationSection.vue +++ b/js/src/components/Participation/ParticipationSection.vue @@ -82,7 +82,7 @@ > {{ $t( - "As the event organiser has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted." + "As the event organizer has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted." ) }} diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index d03b83648..a676c79b0 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -800,5 +800,15 @@ "Mobilizon is a federated software, meaning you can interact - depending on your admin's federation settings - with content from other instances, such as joining groups or events that were created elsewhere.": "Mobilizon is a federated software, meaning you can interact - depending on your admin federation settings - with content from other instances, such as joining groups or events that were created elsewhere.", "This instance, {instanceName} ({domain}), hosts your profile, so remember its name.": "This instance, {instanceName} ({domain}), hosts your profile, so remember its name.", "If you are being asked for your federated indentity, it's composed of your username and your instance. For instance, the federated identity for your first profile is:": "If you are being asked for your federated indentity, it's composed of your username and your instance. For instance, the federated identity for your first profile is:", - "Uploaded media size": "Uploaded media size" + "Uploaded media size": "Uploaded media size", + "Loading comments…": "Loading comments…", + "Tentative": "Tentative", + "Cancelled": "Cancelled", + "Click for more information": "Click for more information", + "About anonymous participation": "About anonymous participation", + "As the event organizer has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted.": "As the event organizer has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted.", + "Your participation status is saved only on this device and will be deleted one month after the event's passed.": "Your participation status is saved only on this device and will be deleted one month after the event's passed.", + "You may clear all participation information for this device with the buttons below.": "You may clear all participation information for this device with the buttons below.", + "Clear participation data for this event": "Clear participation data for this event", + "Clear participation data for all events": "Clear participation data for all events" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index 1e52c9b99..257a116e2 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -888,5 +888,15 @@ "Mobilizon is a federated software, meaning you can interact - depending on your admin's federation settings - with content from other instances, such as joining groups or events that were created elsewhere.": "Mobilizon est un logiciel fédéré, ce qui signifie que vous pouvez interagir - en fonction des paramètres de fédération de votre administrateur·ice - avec du contenu d'autres instances, comme par exemple rejoindre des groupes ou des événements ayant été créés ailleurs.", "This instance, {instanceName} ({domain}), hosts your profile, so remember its name.": "Cette instance, {instanceName} ({domain}), héberge votre profil, donc notez bien son nom.", "If you are being asked for your federated indentity, it's composed of your username and your instance. For instance, the federated identity for your first profile is:": "Si l'on vous demande votre identité fédérée, elle est composée de votre nom d'utilisateur·ice et de votre instance. Par exemple, l'identité fédérée de votre premier profil est :", - "Uploaded media size": "Taille des médias téléversés" + "Uploaded media size": "Taille des médias téléversés", + "Loading comments…": "Chargement des commentaires…", + "Tentative": "Provisoire", + "Cancelled": "Annulé", + "Click for more information": "Cliquez pour plus d'informations", + "About anonymous participation": "À propos de la participation anonyme", + "As the event organizer has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted.": "L'organisateur de l'événement ayant choisi de valider manuellement les demandes de participation, votre participation ne sera réellement confirmée que lorsque vous recevrez un courriel indiquant qu'elle est acceptée.", + "Your participation status is saved only on this device and will be deleted one month after the event's passed.": "Le statut de votre participation est enregistré uniquement sur cet appareil et sera supprimé un mois après la fin de l'événement.", + "You may clear all participation information for this device with the buttons below.": "Vous pouvez effacer toutes les informations de participation pour cet appareil avec les boutons ci-dessous.", + "Clear participation data for this event": "Effacer mes données de participation pour cet événement", + "Clear participation data for all events": "Effacer mes données de participation pour tous les événements" } diff --git a/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts b/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts index 789826eba..2d6eb7657 100644 --- a/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts +++ b/js/tests/unit/specs/components/Participation/ParticipationSection.spec.ts @@ -153,7 +153,7 @@ describe("ParticipationSection", () => { }); expect(modal.isVisible()).toBeTruthy(); expect(modal.find("article.notification.is-primary").text()).toBe( - "As the event organiser has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted." + "As the event organizer has chosen to manually validate participation requests, your participation will be really confirmed only once you receive an email stating it's being accepted." ); cancelAnonymousParticipationButton.trigger("click");