Implement Credo software design suggestions
This commit is contained in:
@@ -13,11 +13,11 @@ defmodule Mobilizon.Web.Email.Admin do
|
||||
alias Mobilizon.Reports.Report
|
||||
alias Mobilizon.Users.User
|
||||
|
||||
alias Mobilizon.Web.Email
|
||||
alias Mobilizon.Web.{Email, Gettext}
|
||||
|
||||
@spec report(User.t(), Report.t(), String.t()) :: Bamboo.Email.t()
|
||||
def report(%User{email: email}, %Report{} = report, locale \\ "en") do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
|
||||
@@ -7,6 +7,8 @@ defmodule Mobilizon.Web.Email do
|
||||
|
||||
alias Mobilizon.Config
|
||||
|
||||
alias Mobilizon.Web.EmailView
|
||||
|
||||
@spec base_email(keyword()) :: Bamboo.Email.t()
|
||||
def base_email(args) do
|
||||
instance = Config.instance_config()
|
||||
@@ -16,7 +18,7 @@ defmodule Mobilizon.Web.Email do
|
||||
|> from({Config.instance_name(), Config.instance_email_from()})
|
||||
|> put_header("Reply-To", Config.instance_email_reply_to())
|
||||
|> assign(:instance, instance)
|
||||
|> put_html_layout({Mobilizon.Web.EmailView, "email.html"})
|
||||
|> put_text_layout({Mobilizon.Web.EmailView, "email.text"})
|
||||
|> put_html_layout({EmailView, "email.html"})
|
||||
|> put_text_layout({EmailView, "email.text"})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
alias Mobilizon.Storage.Repo
|
||||
alias Mobilizon.Users.User
|
||||
|
||||
alias Mobilizon.Web.Email
|
||||
alias Mobilizon.Web.{Gettext, Email}
|
||||
|
||||
@important_changes [:title, :begins_on, :ends_on, :status]
|
||||
|
||||
@@ -29,7 +29,7 @@ defmodule Mobilizon.Web.Email.Event do
|
||||
changes,
|
||||
locale \\ "en"
|
||||
) do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
|
||||
@@ -13,7 +13,7 @@ defmodule Mobilizon.Web.Email.Participation do
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Events.Participant
|
||||
|
||||
alias Mobilizon.Web.Email
|
||||
alias Mobilizon.Web.{Email, Gettext}
|
||||
|
||||
@doc """
|
||||
Send emails to local user
|
||||
@@ -46,7 +46,7 @@ defmodule Mobilizon.Web.Email.Participation do
|
||||
%Participant{event: event, role: :rejected},
|
||||
locale
|
||||
) do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
@@ -67,7 +67,7 @@ defmodule Mobilizon.Web.Email.Participation do
|
||||
%Participant{event: event, role: :participant},
|
||||
locale
|
||||
) do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
|
||||
@@ -13,7 +13,7 @@ defmodule Mobilizon.Web.Email.User do
|
||||
alias Mobilizon.Storage.Repo
|
||||
alias Mobilizon.Users.User
|
||||
|
||||
alias Mobilizon.Web.Email
|
||||
alias Mobilizon.Web.{Email, Gettext}
|
||||
|
||||
require Logger
|
||||
|
||||
@@ -22,7 +22,7 @@ defmodule Mobilizon.Web.Email.User do
|
||||
%User{email: email, confirmation_token: confirmation_token},
|
||||
locale \\ "en"
|
||||
) do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
@@ -42,7 +42,7 @@ defmodule Mobilizon.Web.Email.User do
|
||||
%User{email: email, reset_password_token: reset_password_token},
|
||||
locale \\ "en"
|
||||
) do
|
||||
Mobilizon.Web.Gettext.put_locale(locale)
|
||||
Gettext.put_locale(locale)
|
||||
|
||||
subject =
|
||||
gettext(
|
||||
|
||||
Reference in New Issue
Block a user