fix emails

This commit is contained in:
shibao 2024-07-28 13:00:53 -04:00
parent c8130f7e3f
commit d573b8a421
9 changed files with 54 additions and 12 deletions

View File

@ -1,6 +1,7 @@
# v0.1.16
- Fix empty invite index page
- Fix faq copy
- Fix issue with emails
- Update deps
# v0.1.15

View File

@ -32,4 +32,4 @@ config :logger, level: :warning
config :phoenix, :plug_init_mode, :runtime
# Disable Oban
config :memex, Oban, queues: false, plugins: false
config :memex, Oban, queues: false, plugins: false, testing: :manual

View File

@ -66,12 +66,12 @@ msgstr ""
msgid "Welcome to memEx"
msgstr ""
#: lib/memex/accounts/email.ex:31
#: lib/memex/email.ex:31
#, elixir-autogen, elixir-format, fuzzy
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:37
#: lib/memex/email.ex:37
#, elixir-autogen, elixir-format, fuzzy
msgid "reset your memEx password"
msgstr ""
@ -86,7 +86,7 @@ msgstr ""
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:43
#: lib/memex/email.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "update your memEx email"
msgstr ""

View File

@ -66,12 +66,12 @@ msgstr ""
msgid "Welcome to memEx"
msgstr ""
#: lib/memex/accounts/email.ex:31
#: lib/memex/email.ex:31
#, elixir-autogen, elixir-format
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:37
#: lib/memex/email.ex:37
#, elixir-autogen, elixir-format
msgid "reset your memEx password"
msgstr ""
@ -86,7 +86,7 @@ msgstr ""
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:43
#: lib/memex/email.ex:43
#, elixir-autogen, elixir-format
msgid "update your memEx email"
msgstr ""

View File

@ -67,12 +67,12 @@ msgstr ""
msgid "Welcome to memEx"
msgstr ""
#: lib/memex/accounts/email.ex:31
#: lib/memex/email.ex:31
#, elixir-autogen, elixir-format, fuzzy
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:37
#: lib/memex/email.ex:37
#, elixir-autogen, elixir-format, fuzzy
msgid "reset your memEx password"
msgstr ""
@ -87,7 +87,7 @@ msgstr ""
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:43
#: lib/memex/email.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "update your memEx email"
msgstr ""

View File

@ -0,0 +1,40 @@
defmodule Memex.EmailWorkerTest do
use Memex.DataCase, async: true
def perform_job(worker, args) do
Oban.Testing.perform_job(worker, args, [])
end
test "sending welcome email" do
user = user_fixture()
{:ok, _user} =
perform_job(Memex.EmailWorker, %{
"email" => "welcome",
"user_id" => user.id,
"attrs" => %{"url" => "test_url"}
})
end
test "sending reset password email" do
user = user_fixture()
{:ok, _user} =
perform_job(Memex.EmailWorker, %{
"email" => "reset_password",
"user_id" => user.id,
"attrs" => %{"url" => "test_url"}
})
end
test "sending update email email" do
user = user_fixture()
{:ok, _user} =
perform_job(Memex.EmailWorker, %{
"email" => "update_email",
"user_id" => user.id,
"attrs" => %{"url" => "test_url"}
})
end
end

View File

@ -38,8 +38,9 @@ defmodule Memex.Fixtures do
def extract_user_token(fun) do
%{args: %{attrs: attrs, email: email_key, user_id: user_id}} = fun.(&"[TOKEN]#{&1}[TOKEN]")
# convert atoms to string keys
attrs = attrs |> Map.new(fn {atom_key, value} -> {atom_key |> Atom.to_string(), value} end)
attrs =
attrs
|> Map.new(fn {key, value} -> {Atom.to_string(key), value} end)
email =
email_key