fix emails
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
# v0.1.16
 | 
					# v0.1.16
 | 
				
			||||||
- Fix empty invite index page
 | 
					- Fix empty invite index page
 | 
				
			||||||
- Fix faq copy
 | 
					- Fix faq copy
 | 
				
			||||||
 | 
					- Fix issue with emails
 | 
				
			||||||
- Update deps
 | 
					- Update deps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# v0.1.15
 | 
					# v0.1.15
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,4 +32,4 @@ config :logger, level: :warning
 | 
				
			|||||||
config :phoenix, :plug_init_mode, :runtime
 | 
					config :phoenix, :plug_init_mode, :runtime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Disable Oban
 | 
					# Disable Oban
 | 
				
			||||||
config :memex, Oban, queues: false, plugins: false
 | 
					config :memex, Oban, queues: false, plugins: false, testing: :manual
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,12 +66,12 @@ msgstr ""
 | 
				
			|||||||
msgid "Welcome to memEx"
 | 
					msgid "Welcome to memEx"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:31
 | 
					#: lib/memex/email.ex:31
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "confirm your memEx account"
 | 
					msgid "confirm your memEx account"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:37
 | 
					#: lib/memex/email.ex:37
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "reset your memEx password"
 | 
					msgid "reset your memEx password"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
@@ -86,7 +86,7 @@ msgstr ""
 | 
				
			|||||||
msgid "this email was sent from memEx at %{url}"
 | 
					msgid "this email was sent from memEx at %{url}"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:43
 | 
					#: lib/memex/email.ex:43
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "update your memEx email"
 | 
					msgid "update your memEx email"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,12 +66,12 @@ msgstr ""
 | 
				
			|||||||
msgid "Welcome to memEx"
 | 
					msgid "Welcome to memEx"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:31
 | 
					#: lib/memex/email.ex:31
 | 
				
			||||||
#, elixir-autogen, elixir-format
 | 
					#, elixir-autogen, elixir-format
 | 
				
			||||||
msgid "confirm your memEx account"
 | 
					msgid "confirm your memEx account"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:37
 | 
					#: lib/memex/email.ex:37
 | 
				
			||||||
#, elixir-autogen, elixir-format
 | 
					#, elixir-autogen, elixir-format
 | 
				
			||||||
msgid "reset your memEx password"
 | 
					msgid "reset your memEx password"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
@@ -86,7 +86,7 @@ msgstr ""
 | 
				
			|||||||
msgid "this email was sent from memEx at %{url}"
 | 
					msgid "this email was sent from memEx at %{url}"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:43
 | 
					#: lib/memex/email.ex:43
 | 
				
			||||||
#, elixir-autogen, elixir-format
 | 
					#, elixir-autogen, elixir-format
 | 
				
			||||||
msgid "update your memEx email"
 | 
					msgid "update your memEx email"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,12 +67,12 @@ msgstr ""
 | 
				
			|||||||
msgid "Welcome to memEx"
 | 
					msgid "Welcome to memEx"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:31
 | 
					#: lib/memex/email.ex:31
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "confirm your memEx account"
 | 
					msgid "confirm your memEx account"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:37
 | 
					#: lib/memex/email.ex:37
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "reset your memEx password"
 | 
					msgid "reset your memEx password"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
@@ -87,7 +87,7 @@ msgstr ""
 | 
				
			|||||||
msgid "this email was sent from memEx at %{url}"
 | 
					msgid "this email was sent from memEx at %{url}"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: lib/memex/accounts/email.ex:43
 | 
					#: lib/memex/email.ex:43
 | 
				
			||||||
#, elixir-autogen, elixir-format, fuzzy
 | 
					#, elixir-autogen, elixir-format, fuzzy
 | 
				
			||||||
msgid "update your memEx email"
 | 
					msgid "update your memEx email"
 | 
				
			||||||
msgstr ""
 | 
					msgstr ""
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										40
									
								
								test/memex/email_worker_test.exs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								test/memex/email_worker_test.exs
									
									
									
									
									
										Normal 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
 | 
				
			||||||
@@ -38,8 +38,9 @@ defmodule Memex.Fixtures do
 | 
				
			|||||||
  def extract_user_token(fun) do
 | 
					  def extract_user_token(fun) do
 | 
				
			||||||
    %{args: %{attrs: attrs, email: email_key, user_id: user_id}} = fun.(&"[TOKEN]#{&1}[TOKEN]")
 | 
					    %{args: %{attrs: attrs, email: email_key, user_id: user_id}} = fun.(&"[TOKEN]#{&1}[TOKEN]")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # convert atoms to string keys
 | 
					    attrs =
 | 
				
			||||||
    attrs = attrs |> Map.new(fn {atom_key, value} -> {atom_key |> Atom.to_string(), value} end)
 | 
					      attrs
 | 
				
			||||||
 | 
					      |> Map.new(fn {key, value} -> {Atom.to_string(key), value} end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    email =
 | 
					    email =
 | 
				
			||||||
      email_key
 | 
					      email_key
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user