From 7b6c06d233a303b39a61ce52a2946b4a8efa84b6 Mon Sep 17 00:00:00 2001 From: Laurent GAY Date: Wed, 12 Nov 2025 13:12:56 +0100 Subject: [PATCH] change group views to add new parameters - #687 --- src/graphql/group.ts | 6 +++ src/i18n/en_US.json | 20 +++++---- src/i18n/fr_FR.json | 2 + src/types/actor/group.model.ts | 3 ++ src/views/Group/CreateView.vue | 11 +++++ src/views/Group/GroupSettings.vue | 7 ++++ .../specs/views/Group/GroupSettings.spec.ts | 42 ++++++++++++++++++- .../__snapshots__/CreateView.spec.ts.snap | 4 ++ .../__snapshots__/GroupSettings.spec.ts.snap | 2 +- 9 files changed, 86 insertions(+), 11 deletions(-) diff --git a/src/graphql/group.ts b/src/graphql/group.ts index 3557a21d7..34c1755de 100644 --- a/src/graphql/group.ts +++ b/src/graphql/group.ts @@ -60,6 +60,7 @@ export const GROUP_VERY_BASIC_FIELDS_FRAGMENTS = gql` visibility openness manuallyApprovesFollowers + allowSeeParticipants physicalAddress { description street @@ -104,6 +105,7 @@ export const GROUP_BASIC_FIELDS_FRAGMENTS = gql` visibility openness manuallyApprovesFollowers + allowSeeParticipants physicalAddress { description street @@ -301,6 +303,7 @@ export const CREATE_GROUP = gql` $visibility: GroupVisibility $openness: Openness $manuallyApprovesFollowers: Boolean + $allowSeeParticipants: Boolean ) { createGroup( preferredUsername: $preferredUsername @@ -312,6 +315,7 @@ export const CREATE_GROUP = gql` visibility: $visibility openness: $openness manuallyApprovesFollowers: $manuallyApprovesFollowers + allowSeeParticipants: $allowSeeParticipants ) { ...ActorFragment banner { @@ -334,6 +338,7 @@ export const UPDATE_GROUP = gql` $openness: Openness $physicalAddress: AddressInput $manuallyApprovesFollowers: Boolean + $allowSeeParticipants: Boolean ) { updateGroup( id: $id @@ -345,6 +350,7 @@ export const UPDATE_GROUP = gql` openness: $openness physicalAddress: $physicalAddress manuallyApprovesFollowers: $manuallyApprovesFollowers + allowSeeParticipants: $allowSeeParticipants ) { ...GroupVeryBasicFields } diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index f3ae339c9..5f53b7b9f 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -176,6 +176,9 @@ "Back to profile list": "Back to profile list", "Back to top": "Back to top", "Back to user list": "Back to user list", + "Ban": "Ban", + "Ban the account": "Ban the account", + "Ban the account?": "Ban the account?", "Banner": "Banner", "Become part of the community and start organizing events": "Become part of the community and start organizing events", "Before you can login, you need to click on the link inside it to validate your account.": "Before you can login, you need to click on the link inside it to validate your account.", @@ -370,8 +373,8 @@ "Do not receive any mail": "Do not receive any mail", "Do you really want to ban the account \u00ab\u00a0{emailAccount}\u00a0\u00bb\u00a0?": "Do you really want to ban the account \u00ab\u00a0{emailAccount}\u00a0\u00bb\u00a0?", "Do you really want to ban this account? All of the user's profiles will be deleted.": "Do you really want to ban this account? All of the user's profiles will be deleted.", - "Do you really want to unban this account? The user will be able to log-in again.":"Do you really want to unban this account? The user will be able to log-in again.", "Do you really want to suspend this profile? All of the profiles content will be deleted.": "Do you really want to suspend this profile? All of the profiles content will be deleted.", + "Do you really want to unban this account? The user will be able to log-in again.": "Do you really want to unban this account? The user will be able to log-in again.", "Do you wish to {create_event} or {explore_events}?": "Do you wish to {create_event} or {explore_events}?", "Do you wish to {create_group} or {explore_groups}?": "Do you wish to {create_group} or {explore_groups}?", "Does the event needs to be confirmed later or is it cancelled?": "Does the event needs to be confirmed later or is it cancelled?", @@ -692,6 +695,7 @@ "Maybe the content was removed by the author or a moderator": "Maybe the content was removed by the author or a moderator", "Member": "Member", "Members": "Members", + "Members can see events' participants": "Members can see events' participants", "Members will also access private sections like discussions, resources and restricted posts.": "Members will also access private sections like discussions, resources and restricted posts.", "Members-only post": "Members-only post", "Membership requests will be approved by a group moderator": "Membership requests will be approved by a group moderator", @@ -847,13 +851,13 @@ "Only group moderators can create, edit and delete posts.": "Only group moderators can create, edit and delete posts.", "Only instances with an application actor can be followed": "Only instances with an application actor can be followed", "Only registered users may fetch remote events from their URL.": "Only registered users may fetch remote events from their URL.", + "Open": "Open", "Open a topic on our forum": "Open a topic on our forum", "Open an issue on our bug tracker (advanced users)": "Open an issue on our bug tracker (advanced users)", "Open conversations": "Open conversations", "Open main menu": "Open main menu", "Open user menu": "Open user menu", "Opened reports": "Opened reports", - "Open": "Open", "Options": "Options", "Or": "Or", "Ordered list": "Ordered list", @@ -890,20 +894,21 @@ "Participation without account": "Participation without account", "Participations": "Participations", "Password": "Password", - "Password and confirmation password must be identical.":"Password and confirmation password must be identical.", "Password (confirmation)": "Password (confirmation)", + "Password and confirmation password must be identical.": "Password and confirmation password must be identical.", "Password reset": "Password reset", "Past activities": "Passed activities", "Past events": "Passed events", "PeerTube live": "PeerTube live", "PeerTube replay": "PeerTube replay", "Pending": "Pending", + "Permission": "Permission", "Personal feeds": "Personal feeds", "Photo by {author} on {source}": "Photo by {author} on {source}", + "Pick": "Pick", + "Pick a profile or a group": "Pick a profile or a group", "Pick an identity": "Pick an identity", "Pick an instance": "Pick an instance", - "Pick a profile or a group": "Pick a profile or a group", - "Pick": "Pick", "Pictures": "Pictures", "Please add as many details as possible to help identify the problem.": "Please add as many details as possible to help identify the problem.", "Please check your spam folder if you didn't receive the email.": "Please check your spam folder if you didn't receive the email.", @@ -1113,10 +1118,7 @@ "Subtitles": "Subtitles", "Suggestions:": "Suggestions:", "Suspend": "Suspend", - "Ban": "Ban", "Suspend group": "Suspend group", - "Ban the account": "Ban the account", - "Ban the account?": "Ban the account?", "Suspend the profile": "Suspend the profile", "Suspend the profile?": "Suspend the profile?", "Suspended": "Suspended", @@ -1575,7 +1577,7 @@ "Your participation still has to be approved by the organisers.": "Your participation still has to be approved by the organisers.", "Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation.": "Your participation will be validated once you click the confirmation link into the email, and after the organizer manually validates your participation.", "Your participation will be validated once you click the confirmation link into the email.": "Your participation will be validated once you click the confirmation link into the email.", - "Your password has been successfully changed. You now need to logged-in with your new password.":"Your password has been successfully changed. You now need to logged-in with your new password.", + "Your password has been successfully changed. You now need to logged-in with your new password.": "Your password has been successfully changed. You now need to logged-in with your new password.", "Your position was not available.": "Your position was not available.", "Your profile will be shown as contact.": "Your profile will be shown as contact.", "Your timezone is currently set to {timezone}.": "Your timezone is currently set to {timezone}.", diff --git a/src/i18n/fr_FR.json b/src/i18n/fr_FR.json index 15b321473..1447d6565 100644 --- a/src/i18n/fr_FR.json +++ b/src/i18n/fr_FR.json @@ -695,6 +695,7 @@ "Maybe the content was removed by the author or a moderator": "Peut-\u00eatre que le contenu a \u00e9t\u00e9 supprim\u00e9 par l'auteur\u00b7ice ou un\u00b7e mod\u00e9rateur\u00b7ice", "Member": "Membre", "Members": "Membres", + "Members can see events' participants": "Les membres peuvent voir les participants des événements", "Members will also access private sections like discussions, resources and restricted posts.": "Les membres auront \u00e9galement acc\u00e8s aux section priv\u00e9es comme les discussions, les ressources et les billets restreints.", "Members-only post": "Billet reserv\u00e9 aux membres", "Membership requests will be approved by a group moderator": "Les demandes d'adh\u00e9sion seront approuv\u00e9es par un\u00b7e mod\u00e9rateur\u00b7ice du groupe", @@ -900,6 +901,7 @@ "PeerTube live": "Direct sur PeerTube", "PeerTube replay": "Replay sur PeerTube", "Pending": "En attente", + "Permission": "Permission", "Personal feeds": "Flux personnels", "Photo by {author} on {source}": "Photo par {author} sur {source}", "Pick an identity": "Choisissez une identit\u00e9", diff --git a/src/types/actor/group.model.ts b/src/types/actor/group.model.ts index e96dc485c..c037c0be5 100644 --- a/src/types/actor/group.model.ts +++ b/src/types/actor/group.model.ts @@ -23,6 +23,7 @@ export interface IGroup extends IActor { openness: Openness; visibility: GroupVisibility; manuallyApprovesFollowers: boolean; + allowSeeParticipants: boolean; activity: Paginate; followers: Paginate; membersCount?: number; @@ -58,6 +59,8 @@ export class Group extends Actor implements IGroup { manuallyApprovesFollowers = false; + allowSeeParticipants = true; + patch(hash: IGroup | Record): void { Object.assign(this, hash); } diff --git a/src/views/Group/CreateView.vue b/src/views/Group/CreateView.vue index c4d1f68c6..fd87659b6 100644 --- a/src/views/Group/CreateView.vue +++ b/src/views/Group/CreateView.vue @@ -198,6 +198,16 @@ {{ t("Manually approve new followers") }} +
+ + + {{ t("Permission") }} + + + + {{ t("Members can see events' participants") }} + +
{ visibility: group.value.visibility, openness: group.value.openness, manuallyApprovesFollowers: group.value.manuallyApprovesFollowers, + allowSeeParticipants: group.value.allowSeeParticipants, }; if (cloneGroup.physicalAddress?.id || cloneGroup.physicalAddress?.geom) { diff --git a/src/views/Group/GroupSettings.vue b/src/views/Group/GroupSettings.vue index 351f9ec9c..ab1bfe4cd 100644 --- a/src/views/Group/GroupSettings.vue +++ b/src/views/Group/GroupSettings.vue @@ -157,6 +157,12 @@ + + + {{ t("Members can see events' participants") }} + + + { visibility: editableGroup.value?.visibility, openness: editableGroup.value?.openness, manuallyApprovesFollowers: editableGroup.value?.manuallyApprovesFollowers, + allowSeeParticipants: editableGroup.value?.allowSeeParticipants, physicalAddress, ...avatarObj, ...bannerObj, diff --git a/tests/unit/specs/views/Group/GroupSettings.spec.ts b/tests/unit/specs/views/Group/GroupSettings.spec.ts index ab5a9f4af..7995b1a70 100644 --- a/tests/unit/specs/views/Group/GroupSettings.spec.ts +++ b/tests/unit/specs/views/Group/GroupSettings.spec.ts @@ -24,8 +24,48 @@ beforeEach(async () => { // await router.isReady(); }); +const mock_group = { + data: { + group: { + __typename: "Group", + avatar: null, + banner: null, + domain: null, + id: "123", + manuallyApprovesFollowers: true, + allowSeeParticipants: false, + members: { + __typename: "PaginatedMemberList", + total: 1, + }, + name: "ssss", + openness: "MODERATED", + organizedEvents: { + __typename: "PaginatedEventList", + elements: [], + total: 0, + }, + physicalAddress: null, + posts: { + __typename: "PaginatedPostList", + elements: [], + total: 0, + }, + preferredUsername: "example", + summary: null, + suspended: false, + type: "GROUP", + url: "https://mobilizon.test/@example", + visibility: "PUBLIC", + }, + }, +}; + const generateWrapper = () => { - const global_data = getMockClient([FETCH_GROUP_PUBLIC, DELETE_GROUP]); + const global_data = getMockClient([ + [FETCH_GROUP_PUBLIC, mock_group], + DELETE_GROUP, + ]); global_data.provide.dateFnsLocale = enUS; global_data.plugins = [router]; return mount(GroupSettings, { diff --git a/tests/unit/specs/views/Group/__snapshots__/CreateView.spec.ts.snap b/tests/unit/specs/views/Group/__snapshots__/CreateView.spec.ts.snap index 25699d95c..80da4cf92 100644 --- a/tests/unit/specs/views/Group/__snapshots__/CreateView.spec.ts.snap +++ b/tests/unit/specs/views/Group/__snapshots__/CreateView.spec.ts.snap @@ -110,6 +110,10 @@ exports[`CreateView > Show simple 1`] = `
FollowersFollowers will receive new public events and posts.
+
+
+ Permission +
diff --git a/tests/unit/specs/views/Group/__snapshots__/GroupSettings.spec.ts.snap b/tests/unit/specs/views/Group/__snapshots__/GroupSettings.spec.ts.snap index 47d392690..954f17e73 100644 --- a/tests/unit/specs/views/Group/__snapshots__/GroupSettings.spec.ts.snap +++ b/tests/unit/specs/views/Group/__snapshots__/GroupSettings.spec.ts.snap @@ -2,7 +2,7 @@ exports[`GroupSettings > Show simple 1`] = ` "
- +