Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit3cc2483

Browse files
committed
refactor(mailer): fix test error & mv send logic to later
1 parent988eed4 commit3cc2483

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

‎lib/groupher_server/cms/delegates/article_curd.ex‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -398,30 +398,10 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
398398
end
399399

400400
defpcreate_content_result({:ok,%{create_content:result}})do
401-
# Later.exec({__MODULE__, :nofify_admin_new_content, [result]})
402-
nofify_admin_new_content(result)
401+
Later.exec({__MODULE__,:nofify_admin_new_content,[result]})
403402
{:ok,result}
404403
end
405404

406-
defnofify_admin_new_content(%{id:id}=result)do
407-
target=result.__struct__
408-
preload=[:origial_community,author::user]
409-
410-
with{:ok,content}<-ORM.find(target,id,preload:preload)do
411-
info=%{
412-
id:content.id,
413-
title:content.title,
414-
digest:content.digest,
415-
author_name:content.author.user.nickname,
416-
community_raw:content.origial_community.raw,
417-
type:
418-
result.__struct__|>to_string|>String.split(".")|>List.last()|>String.downcase()
419-
}
420-
421-
Email.notify_admin(info,:new_content)
422-
end
423-
end
424-
425405
defpcreate_content_result({:error,:create_content,%Ecto.Changeset{}=result,_steps})do
426406
{:error,result}
427407
end
@@ -516,4 +496,23 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
516496
defpcontent_id(:job,id),do:%{job_id:id}
517497
defpcontent_id(:repo,id),do:%{repo_id:id}
518498
defpcontent_id(:video,id),do:%{video_id:id}
499+
500+
defpnofify_admin_new_content(%{id:id}=result)do
501+
target=result.__struct__
502+
preload=[:origial_community,author::user]
503+
504+
with{:ok,content}<-ORM.find(target,id,preload:preload)do
505+
info=%{
506+
id:content.id,
507+
title:content.title,
508+
digest:Map.get(content,:digest,content.title),
509+
author_name:content.author.user.nickname,
510+
community_raw:content.origial_community.raw,
511+
type:
512+
result.__struct__|>to_string|>String.split(".")|>List.last()|>String.downcase()
513+
}
514+
515+
Email.notify_admin(info,:new_content)
516+
end
517+
end
519518
end

‎test/groupher_server/mailer/email_test.exs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
defmoduleGroupherServer.Test.Mailerdo
22
@moduledoc"""
3-
mailer test, see details: https://github.com/thoughtbot/bamboo
3+
mailer test, see details: https://github.com/thoughtbot/bamboo
44
"""
55
useGroupherServer.TestTools
66
useBamboo.Test
77

88
importHelper.Utils,only:[get_config:2]
9-
@support_emailget_config(:system_emails,:support)
9+
@support_emailget_config(:system_emails,:support_email)
1010

1111
describe"basic email"do
1212
test"send welcome email when user has email addr"do

‎test/groupher_server_web/query/accounts/published_contents_test.exs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ defmodule GroupherServer.Test.Query.Accounts.PublishedContents do
110110
}
111111
}
112112
"""
113+
@tag:wip
113114
test"user can get paged published videos",~m(guest_conn user community)ado
114115
pub_videos=
115116
Enum.reduce(1..@publish_count,[],fn_,acc->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp