From 5b4f1c271acad5d81bbf43388b9e2408a0196a4e Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 30 Sep 2019 13:48:47 +0200 Subject: [PATCH] Send email notifications when a participation is approved/rejected Also handles participant status :rejected instead of deleting the participation Closes #164 Signed-off-by: Thomas Citharel --- js/src/components/Account/ParticipantCard.vue | 2 +- .../components/Event/ParticipationButton.vue | 10 +- js/src/graphql/event.ts | 17 +- js/src/i18n/en_US.json | 6 +- js/src/i18n/fr_FR.json | 6 +- js/src/types/event.model.ts | 4 +- js/src/views/Event/Participants.vue | 54 +++++- lib/mobilizon/events/events.ex | 19 +- lib/mobilizon_web/api/participations.ex | 34 ++-- lib/mobilizon_web/email/participation.ex | 84 +++++++++ lib/mobilizon_web/resolvers/event.ex | 59 ++----- lib/mobilizon_web/schema/event.ex | 1 + .../schema/events/participant.ex | 14 +- .../event_participation_approved.html.eex | 81 +++++++++ .../event_participation_approved.text.eex | 11 ++ .../event_participation_rejected.html.eex | 56 ++++++ .../event_participation_rejected.text.eex | 7 + lib/service/activity_pub/activity.ex | 2 - lib/service/activity_pub/activity_pub.ex | 3 +- lib/service/activity_pub/transmogrifier.ex | 22 +-- priv/gettext/cs/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/cs/LC_MESSAGES/errors.po | 93 ++++++++++ priv/gettext/de/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/de/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/default.pot | 120 ++++++++++++- priv/gettext/en/LC_MESSAGES/default.po | 166 ++++++++++++++---- priv/gettext/es/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/es/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/fr_FR/LC_MESSAGES/default.po | 144 ++++++++++++++- priv/gettext/it/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/it/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/ja/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/ja/LC_MESSAGES/errors.po | 81 +++++++++ priv/gettext/nl/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/nl/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/oc/LC_MESSAGES/default.po | 166 ++++++++++++++---- priv/gettext/oc/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/pl/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/pl/LC_MESSAGES/errors.po | 93 ++++++++++ priv/gettext/pt/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/pt/LC_MESSAGES/errors.po | 87 +++++++++ priv/gettext/ru/LC_MESSAGES/default.po | 162 +++++++++++++---- priv/gettext/ru/LC_MESSAGES/errors.po | 93 ++++++++++ .../20190929170817_rename_postgres_types.exs | 52 ++++++ ...75229_add_rejected_to_participant_role.exs | 21 +++ schema.graphql | 15 +- .../resolvers/participant_resolver_test.exs | 60 +++++-- 47 files changed, 3092 insertions(+), 484 deletions(-) create mode 100644 lib/mobilizon_web/email/participation.ex create mode 100644 lib/mobilizon_web/templates/email/event_participation_approved.html.eex create mode 100644 lib/mobilizon_web/templates/email/event_participation_approved.text.eex create mode 100644 lib/mobilizon_web/templates/email/event_participation_rejected.html.eex create mode 100644 lib/mobilizon_web/templates/email/event_participation_rejected.text.eex create mode 100644 priv/gettext/cs/LC_MESSAGES/errors.po create mode 100644 priv/gettext/de/LC_MESSAGES/errors.po create mode 100644 priv/gettext/es/LC_MESSAGES/errors.po create mode 100644 priv/gettext/it/LC_MESSAGES/errors.po create mode 100644 priv/gettext/ja/LC_MESSAGES/errors.po create mode 100644 priv/gettext/nl/LC_MESSAGES/errors.po create mode 100644 priv/gettext/oc/LC_MESSAGES/errors.po create mode 100644 priv/gettext/pl/LC_MESSAGES/errors.po create mode 100644 priv/gettext/pt/LC_MESSAGES/errors.po create mode 100644 priv/gettext/ru/LC_MESSAGES/errors.po create mode 100644 priv/repo/migrations/20190929170817_rename_postgres_types.exs create mode 100644 priv/repo/migrations/20190929175229_add_rejected_to_participant_role.exs diff --git a/js/src/components/Account/ParticipantCard.vue b/js/src/components/Account/ParticipantCard.vue index 76be96b6f..0a56b9420 100644 --- a/js/src/components/Account/ParticipantCard.vue +++ b/js/src/components/Account/ParticipantCard.vue @@ -14,7 +14,7 @@