From 27a75cd0df8c3f12e96ee45c2fce8abbf6166038 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 6 Oct 2020 15:36:19 +0200 Subject: [PATCH 1/2] Improve some texts on account registration and email notification settings Signed-off-by: Thomas Citharel --- js/src/i18n/en_US.json | 4 +++- js/src/i18n/fr_FR.json | 4 +++- js/src/views/Account/Register.vue | 8 ++++++++ js/src/views/Settings/Notifications.vue | 15 +++++++++++---- lib/mobilizon/users/setting.ex | 2 +- ...default_notification_pending_participation.exs | 15 +++++++++++++++ 6 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 priv/repo/migrations/20201006132530_change_default_notification_pending_participation.exs diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index f817b112..683513bf 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -787,5 +787,7 @@ "Displayed nickname": "Displayed nickname", "Short bio": "Short bio", "Congratulations, your account is now created!": "Congratulations, your account is now created!", - "Now, create your first profile:": "Now, create your first profile:" + "Now, create your first profile:": "Now, create your first profile:", + "If you have opted for manual validation of participants, Mobilizon will send you an email to inform you of new participations to be processed. You can choose the frequency of these notifications below.": "If you have opted for manual validation of participants, Mobilizon will send you an email to inform you of new participations to be processed. You can choose the frequency of these notifications below.", + "You will be able to add an avatar and set other options in your account settings.": "You will be able to add an avatar and set other options in your account settings." } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index 0b4b4abe..882e5db3 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -829,5 +829,7 @@ "Displayed nickname": "Pseudonyme affiché", "Short bio": "Courte biographie", "Congratulations, your account is now created!": "Bravo, votre compte est dorénavant créé !", - "Now, create your first profile:": "Maintenant, créez votre premier profil :" + "Now, create your first profile:": "Maintenant, créez votre premier profil :", + "If you have opted for manual validation of participants, Mobilizon will send you an email to inform you of new participations to be processed. You can choose the frequency of these notifications below.": "Si vous avez opté pour la validation manuelle des participantes, Mobilizon vous enverra un email pour vous informer des nouvelles participations à traiter. Vous pouvez choisir la fréquence de ces notifications ci-dessous.", + "You will be able to add an avatar and set other options in your account settings.": "Vous pourrez ajouter un avatar et définir d'autres options dans les paramètres de votre compte." } diff --git a/js/src/views/Account/Register.vue b/js/src/views/Account/Register.vue index 1f167800..1b7a6253 100644 --- a/js/src/views/Account/Register.vue +++ b/js/src/views/Account/Register.vue @@ -44,6 +44,14 @@ +

+ {{ + $t( + "You will be able to add an avatar and set other options in your account settings." + ) + }} +

+

{{ $t("Notifications for manually approved participations to an event") }} +

+ {{ + $t( + "If you have opted for manual validation of participants, Mobilizon will send you an email to inform you of new participations to be processed. You can choose the frequency of these notifications below." + ) + }} +

= {}; RouteName = RouteName; - mounted() { + mounted(): void { this.notificationPendingParticipationValues = { [INotificationPendingParticipationEnum.NONE]: this.$t("Do not receive any mail"), [INotificationPendingParticipationEnum.DIRECT]: this.$t("Receive one email per request"), @@ -129,7 +136,7 @@ export default class Notifications extends Vue { } @Watch("loggedUser") - setSettings() { + setSettings(): void { if (this.loggedUser && this.loggedUser.settings) { this.notificationOnDay = this.loggedUser.settings.notificationOnDay; this.notificationEachWeek = this.loggedUser.settings.notificationEachWeek; @@ -138,7 +145,7 @@ export default class Notifications extends Vue { } } - async updateSetting(variables: object) { + async updateSetting(variables: Record): Promise { await this.$apollo.mutate<{ setUserSettings: string }>({ mutation: SET_USER_SETTINGS, variables, diff --git a/lib/mobilizon/users/setting.ex b/lib/mobilizon/users/setting.ex index a7fb1804..7ab99103 100644 --- a/lib/mobilizon/users/setting.ex +++ b/lib/mobilizon/users/setting.ex @@ -36,7 +36,7 @@ defmodule Mobilizon.Users.Setting do field(:notification_before_event, :boolean) field(:notification_pending_participation, NotificationPendingNotificationDelay, - default: :none + default: :one_day ) belongs_to(:user, User, primary_key: true, type: :id, foreign_key: :id, define_field: false) diff --git a/priv/repo/migrations/20201006132530_change_default_notification_pending_participation.exs b/priv/repo/migrations/20201006132530_change_default_notification_pending_participation.exs new file mode 100644 index 00000000..2bcb3049 --- /dev/null +++ b/priv/repo/migrations/20201006132530_change_default_notification_pending_participation.exs @@ -0,0 +1,15 @@ +defmodule Mobilizon.Storage.Repo.Migrations.ChangeDefaultNotificationPendingParticipation do + use Ecto.Migration + + def up do + alter table(:user_settings) do + modify(:notification_pending_participation, :integer, default: 10) + end + end + + def down do + alter table(:user_settings) do + modify(:notification_pending_participation, :integer, default: 5) + end + end +end From 375e6d2bef6163a228b29d125ad5c3ae34002ea8 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 6 Oct 2020 15:38:53 +0200 Subject: [PATCH 2/2] [Groups] Allow to promote/demote to moderator Signed-off-by: Thomas Citharel --- js/src/views/Group/GroupMembers.vue | 31 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/js/src/views/Group/GroupMembers.vue b/js/src/views/Group/GroupMembers.vue index f7c2e431..4a7d886f 100644 --- a/js/src/views/Group/GroupMembers.vue +++ b/js/src/views/Group/GroupMembers.vue @@ -142,19 +142,22 @@
{{ $t("Promote") }} {{ $t("Demote") }} {{ $t("Remove") }}
@@ -329,12 +332,24 @@ export default class GroupMembers extends Vue { }); } - promoteMember(memberId: string): Promise { - return this.updateMember(memberId, MemberRole.ADMINISTRATOR); + promoteMember(member: IMember): void { + if (!member.id) return; + if (member.role === MemberRole.MODERATOR) { + this.updateMember(member.id, MemberRole.ADMINISTRATOR); + } + if (member.role === MemberRole.MEMBER) { + this.updateMember(member.id, MemberRole.MODERATOR); + } } - demoteMember(memberId: string): Promise { - return this.updateMember(memberId, MemberRole.MEMBER); + demoteMember(member: IMember): void { + if (!member.id) return; + if (member.role === MemberRole.MODERATOR) { + this.updateMember(member.id, MemberRole.MEMBER); + } + if (member.role === MemberRole.ADMINISTRATOR) { + this.updateMember(member.id, MemberRole.MODERATOR); + } } async updateMember(memberId: string, role: MemberRole): Promise {