Tykayn
b0b5251211
- Added possibility for administrators to have analytics (Matomo, Plausible supported) and error handling (Sentry supported) on front-end. - Redesigned federation admin section with dedicated instance pages - Allow to filter moderation reports by domain - Added a button to go to past events of a group if it has no upcoming events - Add Überauth CAS Strategy - Add a CLI command to delete actors - Changed mailer library from Bamboo to Swoosh, should fix emails being considered spam. **Some configuration changes are required, see below.** - Expose some fields to ActivityStreams event representation: `isOnline`, `remainingAttendeeCapacity` and `participantCount` - Expose a new field to ActivityStreams group representation: `memberCount` - Improve group creation errors feedback - Only display locality in event card - Stale groups are now excluded from group search - Event default visibility is now set according to group privacy setting - Remove Koena Connect button - Hide the whole metadata block if group has no description - Increase task timeout in Refresher to 60 seconds - Allow webfinger to be fetched over http (not https) in dev mode - Improve reactions when approving/rejecting an instance follow - Improve instance admin view for mobile - Allow to reject instance following - Allow instance to have non-standard ports - Add pagination to the instances list - Eventually fetch actors in mentions - Improve IdentityPicker, JoinGroupWithAccount and ActorInline components - Various group and posts improvements - Update schema.graphql file - Add "Accept-Language" header to sentry request metadata - Hide address blocks when address has no real data - Remove obsolete attribute type="text/css" from <style> tags - Improve actor cards integration - Use upstream dependencies for Ueberauth providers - Include ongoing events in search - Send push notification into own task - Add appropriate timeouts for Repo.transactions - Add a proper error message when adding an instance follow that doesn't respond - Allow the instance to be followed from Mastodon (through relays) - Remove unused fragment from FETCH_PERSON GraphQL query - Fixed actor refreshment being impossible - Fixed ical export for undefined datetimes - Fixed parsing links with hashtag characters - Fixed fetching link details from Twitter - Fixed Thunderbird accessing ICS feed endpoint with special `Accept` HTTP header - Make sure every ICS/Feed caches are emptied when modifying entities - Fixed time issues with DST changes - Fixed group preview card not truncating description - Fixed redirection after login - Fixed user admin section showing button to confirm user when the user is already confirmed - Fixed creating event from group view not always setting the group as organizer - Fixed invalid addresses blocking event metadata preview rendering - Fixed group deletion with comments that caused foreign key issues - Fixed incoming Accept activities from participations we don't already have - Fixed resources that didn't have metadata size limits - Properly fallback to UTC when sending notifications and the user doesn't have a timezone setting set - Fix posts creation - Fix rejecting instance follow - Fix pagination of group events - Add proper fallback for when a TZ isn't registered - Hide side of report modal on low width screens - Fix Telegram Logo being replaced with Mastodon logo in ShareGroupModal - Change URL for Mastodon Share Manager - Fix receiving Flag activities on federated events - Fix activity notifications by preloading user.activity_settings - Fix text overflow on group card description - Exclude tags with more than 40 characters from being extracted - Avoid duplicate tags with different casing - Fix invalid HTML (<div> inside <label>) - Fix latest group not refreshing in admin section - Add missing "relay@" part of federated address to follow - Fix Ueberauth use of CSRF with session - Fix being an administrator when using 3rd-party auth provider - Make sure activity recipient can't be nil - Make sure users can't create profiles or groups with non-valid patterns - Add description field to address representation - Make sure prompt show the correct message and not just "Continue?" in mix mode - Make sure activity notification recaps can't be sent multiple times - Fix group notification of new event being sent multiple times - Fix links to group page in group membership emails and participation - Fix clicking on map crashing the app - Arabic - Basque - Belarusian - Bengali - Catalan - Chinese (Traditional) - Croatian - Czech - Danish - Dutch - Esperanto - Finnish - French - Gaelic - Galician - German - Hebrew - Hungarian - Indonesian - Italian - Japanese - Kabyle - Kannada - Norwegian Nynorsk - Occitan - Persian - Polish - Portuguese - Portuguese (Brazil) - Russian - Slovenian - Spanish - Swedish - Welsh -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEExMITpfxOHHCvHn8FoGG53eDKB3MFAmKCI7kACgkQoGG53eDK B3M0cg//U3F1oCzg8piPaIAUGgXTx7yOZ+rRO8tHX63+whg6Yu7vu09G8Hm7iyVD t2CuzEwKNKdgwUV4XG6CJfban20p/lBhGupQvCpIUOBZ6gKn6m2j7KAHj2/GbEot um+Dqu/ktIZN+2vc48nH7HGgcO1c/oCzUE3nH0HYWA9GCVGIAIz+alHszOl9CtL/ TFpgrF5ygRtk4Z4W/hg6j94PP4IpdCybob8/mgN8eZeF4VbaiCGBdsxl5jai+nqE wgebLqyyDAmnE/aW1E64TTLlRP8eZwmNkfxuyI5bjMX8sgvML/ZEcKmcIHPh7tby 5+pEDnRPg8vnqI5SnkaNH2/77WWY0zPQRFsIV4NFnbMuqZ8fumIC9ke/RXEDGMfS ZQi0mWpTT6xZC/XyrjfcaGrV3JY/mrkEXUxFlEwMNm3dGnHKSGCgHIz4gPoQw5U+ wxPyi+wcnmeHTbic7A89aGH3a4H2BF+f2iZeTrA+XyyopU/7Pr9xgzEHL/3Y/9wA +d/hJffLjOM5stg1Zqcndv9LxEFcTtjYBfIeV5kPLVc35s7IbmvoJizFBDrAWisj qLsmk9Tg2ODXCN9jIGto1YqQwBWUSYAfYgMzLyvLG1yb8mSBlhWUp/a3uZcekCUL qDOLNiiFKdD4TIjV/8Nst0YIHR3g4K2NtftjO92NWx2XeRBcS+w= =aZJM -----END PGP SIGNATURE----- Merge tag '2.1.0' into chapril - Added an event category field. Administrators can extend the pre-configured list of categories through configuration. - Added possibility for administrators to have analytics (Matomo, Plausible supported) and error handling (Sentry supported) on front-end. - Redesigned federation admin section with dedicated instance pages - Allow to filter moderation reports by domain - Added a button to go to past events of a group if it has no upcoming events - Add Überauth CAS Strategy - Add a CLI command to delete actors - Changed mailer library from Bamboo to Swoosh, should fix emails being considered spam. **Some configuration changes are required, see below.** - Expose some fields to ActivityStreams event representation: `isOnline`, `remainingAttendeeCapacity` and `participantCount` - Expose a new field to ActivityStreams group representation: `memberCount` - Improve group creation errors feedback - Only display locality in event card - Stale groups are now excluded from group search - Event default visibility is now set according to group privacy setting - Remove Koena Connect button - Hide the whole metadata block if group has no description - Increase task timeout in Refresher to 60 seconds - Allow webfinger to be fetched over http (not https) in dev mode - Improve reactions when approving/rejecting an instance follow - Improve instance admin view for mobile - Allow to reject instance following - Allow instance to have non-standard ports - Add pagination to the instances list - Eventually fetch actors in mentions - Improve IdentityPicker, JoinGroupWithAccount and ActorInline components - Various group and posts improvements - Update schema.graphql file - Add "Accept-Language" header to sentry request metadata - Hide address blocks when address has no real data - Remove obsolete attribute type="text/css" from <style> tags - Improve actor cards integration - Use upstream dependencies for Ueberauth providers - Include ongoing events in search - Send push notification into own task - Add appropriate timeouts for Repo.transactions - Add a proper error message when adding an instance follow that doesn't respond - Allow the instance to be followed from Mastodon (through relays) - Remove unused fragment from FETCH_PERSON GraphQL query - Fixed actor refreshment being impossible - Fixed ical export for undefined datetimes - Fixed parsing links with hashtag characters - Fixed fetching link details from Twitter - Fixed Thunderbird accessing ICS feed endpoint with special `Accept` HTTP header - Make sure every ICS/Feed caches are emptied when modifying entities - Fixed time issues with DST changes - Fixed group preview card not truncating description - Fixed redirection after login - Fixed user admin section showing button to confirm user when the user is already confirmed - Fixed creating event from group view not always setting the group as organizer - Fixed invalid addresses blocking event metadata preview rendering - Fixed group deletion with comments that caused foreign key issues - Fixed incoming Accept activities from participations we don't already have - Fixed resources that didn't have metadata size limits - Properly fallback to UTC when sending notifications and the user doesn't have a timezone setting set - Fix posts creation - Fix rejecting instance follow - Fix pagination of group events - Add proper fallback for when a TZ isn't registered - Hide side of report modal on low width screens - Fix Telegram Logo being replaced with Mastodon logo in ShareGroupModal - Change URL for Mastodon Share Manager - Fix receiving Flag activities on federated events - Fix activity notifications by preloading user.activity_settings - Fix text overflow on group card description - Exclude tags with more than 40 characters from being extracted - Avoid duplicate tags with different casing - Fix invalid HTML (<div> inside <label>) - Fix latest group not refreshing in admin section - Add missing "relay@" part of federated address to follow - Fix Ueberauth use of CSRF with session - Fix being an administrator when using 3rd-party auth provider - Make sure activity recipient can't be nil - Make sure users can't create profiles or groups with non-valid patterns - Add description field to address representation - Make sure prompt show the correct message and not just "Continue?" in mix mode - Make sure activity notification recaps can't be sent multiple times - Fix group notification of new event being sent multiple times - Fix links to group page in group membership emails and participation - Fix clicking on map crashing the app - Arabic - Basque - Belarusian - Bengali - Catalan - Chinese (Traditional) - Croatian - Czech - Danish - Dutch - Esperanto - Finnish - French - Gaelic - Galician - German - Hebrew - Hungarian - Indonesian - Italian - Japanese - Kabyle - Kannada - Norwegian Nynorsk - Occitan - Persian - Polish - Portuguese - Portuguese (Brazil) - Russian - Slovenian - Spanish - Swedish - Welsh
232 lines
5.9 KiB
Elixir
232 lines
5.9 KiB
Elixir
defmodule Mobilizon.Web.Email.Admin do
|
|
@moduledoc """
|
|
Handles emails sent to admins.
|
|
"""
|
|
|
|
use Phoenix.Swoosh, view: Mobilizon.Web.EmailView
|
|
|
|
import Mobilizon.Web.Gettext
|
|
|
|
alias Mobilizon.Config
|
|
alias Mobilizon.Reports.Report
|
|
alias Mobilizon.Users.User
|
|
|
|
alias Mobilizon.Web.Email
|
|
|
|
@spec report(User.t(), Report.t()) :: Swoosh.Email.t()
|
|
def report(%User{email: email} = user, %Report{} = report) do
|
|
locale = Map.get(user, :locale, "en")
|
|
Gettext.put_locale(locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"New report on Mobilizon instance %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
[to: email, subject: subject]
|
|
|> Email.base_email()
|
|
|> render_body(:report, %{locale: locale, subject: subject, report: report})
|
|
end
|
|
|
|
@spec user_email_change_old(User.t(), String.t()) :: Swoosh.Email.t()
|
|
def user_email_change_old(
|
|
%User{
|
|
locale: user_locale,
|
|
email: new_email
|
|
},
|
|
old_email
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator manually changed the email attached to your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
[to: old_email, subject: subject]
|
|
|> Email.base_email()
|
|
|> render_body(:admin_user_email_changed_old, %{
|
|
locale: user_locale,
|
|
subject: subject,
|
|
new_email: new_email,
|
|
old_email: old_email,
|
|
offer_unsupscription: false
|
|
})
|
|
end
|
|
|
|
@spec user_email_change_new(User.t(), String.t()) :: Swoosh.Email.t()
|
|
def user_email_change_new(
|
|
%User{
|
|
locale: user_locale,
|
|
email: new_email
|
|
},
|
|
old_email
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator manually changed the email attached to your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
[to: old_email, subject: subject]
|
|
|> Email.base_email()
|
|
|> render_body(:admin_user_email_changed_new, %{
|
|
locale: user_locale,
|
|
subject: subject,
|
|
new_email: new_email,
|
|
old_email: old_email,
|
|
offer_unsupscription: false
|
|
})
|
|
end
|
|
|
|
@spec user_role_change(User.t(), atom()) :: Swoosh.Email.t()
|
|
def user_role_change(
|
|
%User{
|
|
locale: user_locale,
|
|
email: email,
|
|
role: new_role
|
|
},
|
|
old_role
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator updated your role on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
[to: email, subject: subject]
|
|
|> Email.base_email()
|
|
|> render_body(:admin_user_role_changed, %{
|
|
locale: user_locale,
|
|
subject: subject,
|
|
old_role: old_role,
|
|
new_role: new_role,
|
|
offer_unsupscription: false
|
|
})
|
|
end
|
|
|
|
@spec user_confirmation(User.t()) :: Swoosh.Email.t()
|
|
def user_confirmation(%User{
|
|
locale: user_locale,
|
|
email: email
|
|
}) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator confirmed your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
[to: email, subject: subject]
|
|
|> Email.base_email()
|
|
|> render_body(:admin_user_confirmation, %{
|
|
locale: user_locale,
|
|
subject: subject,
|
|
offer_unsupscription: false
|
|
})
|
|
end
|
|
|
|
@spec user_email_change_old(User.t(), String.t()) :: Bamboo.Email.t()
|
|
def user_email_change_old(
|
|
%User{
|
|
locale: user_locale,
|
|
email: new_email
|
|
},
|
|
old_email
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator manually changed the email attached to your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
Email.base_email(to: old_email, subject: subject)
|
|
|> assign(:locale, user_locale)
|
|
|> assign(:subject, subject)
|
|
|> assign(:new_email, new_email)
|
|
|> assign(:old_email, old_email)
|
|
|> assign(:offer_unsupscription, false)
|
|
|> render(:admin_user_email_changed_old)
|
|
end
|
|
|
|
@spec user_email_change_new(User.t(), String.t()) :: Bamboo.Email.t()
|
|
def user_email_change_new(
|
|
%User{
|
|
locale: user_locale,
|
|
email: new_email
|
|
},
|
|
old_email
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator manually changed the email attached to your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
Email.base_email(to: new_email, subject: subject)
|
|
|> assign(:locale, user_locale)
|
|
|> assign(:subject, subject)
|
|
|> assign(:old_email, old_email)
|
|
|> assign(:new_email, new_email)
|
|
|> assign(:offer_unsupscription, false)
|
|
|> render(:admin_user_email_changed_new)
|
|
end
|
|
|
|
@spec user_role_change(User.t(), atom()) :: Bamboo.Email.t()
|
|
def user_role_change(
|
|
%User{
|
|
locale: user_locale,
|
|
email: email,
|
|
role: new_role
|
|
},
|
|
old_role
|
|
) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator updated your role on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
Email.base_email(to: email, subject: subject)
|
|
|> assign(:locale, user_locale)
|
|
|> assign(:subject, subject)
|
|
|> assign(:old_role, old_role)
|
|
|> assign(:new_role, new_role)
|
|
|> assign(:offer_unsupscription, false)
|
|
|> render(:admin_user_role_changed)
|
|
end
|
|
|
|
@spec user_confirmation(User.t()) :: Bamboo.Email.t()
|
|
def user_confirmation(%User{
|
|
locale: user_locale,
|
|
email: email
|
|
}) do
|
|
Gettext.put_locale(user_locale)
|
|
|
|
subject =
|
|
gettext(
|
|
"An administrator confirmed your account on %{instance}",
|
|
instance: Config.instance_name()
|
|
)
|
|
|
|
Email.base_email(to: email, subject: subject)
|
|
|> assign(:locale, user_locale)
|
|
|> assign(:subject, subject)
|
|
|> assign(:offer_unsupscription, false)
|
|
|> render(:admin_user_confirmation)
|
|
end
|
|
end
|