From 7baad7cafcd5d7e39dd4fdb314bedebfa8224ca1 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 6 Nov 2020 11:25:58 +0100 Subject: [PATCH 1/3] Load only a few locales in dev environment No need to load everything Signed-off-by: Thomas Citharel --- config/config.exs | 22 ++++++++++++++++++++++ config/dev.exs | 7 +++++++ lib/mobilizon/cldr.ex | 21 +-------------------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/config/config.exs b/config/config.exs index 9771bfdf4..cea438a2f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -178,6 +178,28 @@ config :ex_cldr, config :http_signatures, adapter: Mobilizon.Federation.HTTPSignatures.Signature +config :mobilizon, :cldr, + locales: [ + "ar", + "be", + "ca", + "cs", + "de", + "en", + "es", + "fi", + "fr", + "gl", + "it", + "ja", + "nl", + "oc", + "pl", + "pt", + "ru", + "sv" + ] + config :mobilizon, :activitypub, # One day actor_stale_period: 3_600 * 48, diff --git a/config/dev.exs b/config/dev.exs index a58b0c969..265761685 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -92,6 +92,13 @@ config :mobilizon, :instance, # config :mobilizon, :activitypub, sign_object_fetches: false +# No need to compile every locale in development environment +config :mobilizon, :cldr, + locales: [ + "fr", + "en" + ] + config :mobilizon, :anonymous, reports: [ allowed: true diff --git a/lib/mobilizon/cldr.ex b/lib/mobilizon/cldr.ex index 8a0f9ee69..0188b8708 100644 --- a/lib/mobilizon/cldr.ex +++ b/lib/mobilizon/cldr.ex @@ -4,26 +4,7 @@ defmodule Mobilizon.Cldr do """ use Cldr, - locales: [ - "ar", - "be", - "ca", - "cs", - "de", - "en", - "es", - "fi", - "fr", - "gl", - "it", - "ja", - "nl", - "oc", - "pl", - "pt", - "ru", - "sv" - ], + locales: Application.get_env(:mobilizon, :cldr)[:locales], gettext: Mobilizon.Web.Gettext, providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime, Cldr.Language] end From 7c11807c147837bc2d494abd14c8f9b58af8f82d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 6 Nov 2020 11:34:32 +0100 Subject: [PATCH 2/3] Allow to join an open group Also: * Refactor interacting with a remote event so that you can interact with a remote group as well * Add a setting for group admins to pick between an open and invite-only group * Fix new groups without posts/todos/resources/events/conversations URL set * Repair local groups that haven't got their posts/todos/resources/events/conversations URL set * Add a scheduled job to refresh remote groups every hour * Add a user setting to pick when to receive notifications when there's new members to approve (will be used when this feature is available) * Fix pagination for members Signed-off-by: Thomas Citharel --- config/config.exs | 3 +- js/src/components/Account/ParticipantCard.vue | 6 +- js/src/components/Comment/Comment.vue | 3 +- js/src/components/Comment/CommentTree.vue | 3 +- js/src/components/Event/EventCard.vue | 3 +- js/src/components/Event/EventListCard.vue | 8 +- js/src/components/Event/EventListViewCard.vue | 3 +- .../components/Event/EventMinimalistCard.vue | 3 + .../components/Event/ParticipationButton.vue | 17 +- js/src/components/Group/GroupSection.vue | 2 +- .../components/Group/JoinGroupWithAccount.vue | 30 ++++ .../Participation/ConfirmParticipation.vue | 3 +- .../ParticipationWithAccount.vue | 87 +--------- .../ParticipationWithoutAccount.vue | 17 +- .../Settings/SettingsOnboarding.vue | 9 +- .../components/Utils/RedirectWithAccount.vue | 107 ++++++++++++ js/src/graphql/event.ts | 32 ++++ js/src/graphql/group.ts | 5 + js/src/graphql/member.ts | 9 + js/src/graphql/search.ts | 33 ++++ js/src/graphql/user.ts | 5 +- js/src/i18n/en_US.json | 13 +- js/src/i18n/fr_FR.json | 11 +- js/src/i18n/langs.json | 2 +- js/src/mixins/event.ts | 12 +- js/src/mixins/group.ts | 12 ++ js/src/router/groups.ts | 11 ++ js/src/types/actor/actor.model.ts | 2 +- js/src/types/actor/group.model.ts | 27 ++- js/src/types/actor/person.model.ts | 7 +- js/src/types/current-user.model.ts | 8 +- js/src/types/event-options.model.ts | 61 +++++++ js/src/types/event.model.ts | 155 +++--------------- js/src/types/participant.model.ts | 46 ++++++ js/src/views/Discussions/Create.vue | 5 +- js/src/views/Event/Edit.vue | 25 +-- js/src/views/Event/Event.vue | 12 +- js/src/views/Event/EventList.vue | 64 +------- js/src/views/Event/MyEvents.vue | 19 +-- js/src/views/Event/Participants.vue | 8 +- js/src/views/Group/Group.vue | 40 ++++- js/src/views/Group/GroupMembers.vue | 86 +++++++--- js/src/views/Group/GroupSettings.vue | 29 +++- js/src/views/Group/MyGroups.vue | 33 +++- js/src/views/Home.vue | 7 +- js/src/views/Interact.vue | 52 +++--- js/src/views/Settings/Notifications.vue | 12 +- js/src/views/User/Login.vue | 10 +- lib/federation/activity_pub/activity_pub.ex | 52 ++++-- lib/federation/activity_pub/audience.ex | 8 +- lib/federation/activity_pub/refresher.ex | 20 +++ lib/federation/activity_pub/transmogrifier.ex | 34 ++-- lib/federation/activity_pub/types/actors.ex | 76 ++++++++- .../activity_stream/converter/actor.ex | 4 +- .../activity_stream/converter/member.ex | 2 +- lib/graphql/api/search.ex | 12 ++ lib/graphql/resolvers/discussion.ex | 11 +- lib/graphql/resolvers/group.ex | 35 +--- lib/graphql/resolvers/search.ex | 4 + lib/graphql/schema/actors/group.ex | 6 +- lib/graphql/schema/actors/member.ex | 1 - lib/graphql/schema/actors/person.ex | 8 + lib/graphql/schema/event.ex | 2 +- lib/graphql/schema/search.ex | 24 +++ lib/graphql/schema/user.ex | 12 +- lib/mobilizon/actors/actor.ex | 23 ++- lib/mobilizon/actors/actors.ex | 42 ++++- lib/mobilizon/users/setting.ex | 8 +- lib/service/notifications/scheduler.ex | 73 ++++++++- lib/service/workers/refresh_groups.ex | 12 ++ ...ication_pending_membership_to_settings.exs | 9 + ...45719_repair_groups_with_missing_ur_ls.exs | 28 ++++ test/graphql/resolvers/member_test.exs | 136 +++++---------- test/support/factory.ex | 1 + 74 files changed, 1174 insertions(+), 626 deletions(-) create mode 100644 js/src/components/Group/JoinGroupWithAccount.vue create mode 100644 js/src/components/Utils/RedirectWithAccount.vue create mode 100644 js/src/types/event-options.model.ts create mode 100644 js/src/types/participant.model.ts create mode 100644 lib/service/workers/refresh_groups.ex create mode 100644 priv/repo/migrations/20201103141811_add_notification_pending_membership_to_settings.exs create mode 100644 priv/repo/migrations/20201105145719_repair_groups_with_missing_ur_ls.exs diff --git a/config/config.exs b/config/config.exs index cea438a2f..1990ca919 100644 --- a/config/config.exs +++ b/config/config.exs @@ -263,7 +263,8 @@ config :mobilizon, Oban, log: false, queues: [default: 10, search: 5, mailers: 10, background: 5], crontab: [ - {"@hourly", Mobilizon.Service.Workers.BuildSiteMap, queue: :background} + {"@hourly", Mobilizon.Service.Workers.BuildSiteMap, queue: :background}, + {"17 * * * *", Mobilizon.Service.Workers.RefreshGroups, queue: :background} ] config :mobilizon, :rich_media, diff --git a/js/src/components/Account/ParticipantCard.vue b/js/src/components/Account/ParticipantCard.vue index 5284361d9..807e2f3a5 100644 --- a/js/src/components/Account/ParticipantCard.vue +++ b/js/src/components/Account/ParticipantCard.vue @@ -65,8 +65,8 @@