Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit ac18652

Browse files
committed
refactor(cited-article): fix default meta && clean up
1 parent 7d0d5c5 commit ac18652

File tree

6 files changed

+4
-9
lines changed

6 files changed

+4
-9
lines changed

lib/groupher_server/cms/delegates/cite_tasks.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ defmodule GroupherServer.CMS.Delegate.CiteTasks do
7272

7373
defp update_cited_info(cited_contents) do
7474
clean_cited_contents = Enum.map(cited_contents, &Map.delete(&1, :cited_article))
75-
IO.inspect(clean_cited_contents, label: "clean_cited_contents")
76-
75+
# IO.inspect(clean_cited_contents, label: "clean_cited_contents")
7776
with true <- {0, nil} !== Repo.insert_all(CitedContent, clean_cited_contents) do
7877
update_citing_count(cited_contents)
7978
else

lib/groupher_server/cms/models/embeds/article_meta.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ defmodule GroupherServer.CMS.Model.Embeds.ArticleMeta do
2121
reported_count: 0,
2222
is_sinked: false,
2323
can_undo_sink: true,
24-
last_active_at: nil
24+
last_active_at: nil,
25+
citing_count: 0
2526
}
2627
end
2728

test/groupher_server/cms/articles/post_meta_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ defmodule GroupherServer.Test.CMS.PostMeta do
2020
end
2121

2222
describe "[cms post meta info]" do
23+
@tag :wip
2324
test "can get default meta info", ~m(user community post_attrs)a do
2425
assert {:error, _} = ORM.find_by(Author, user_id: user.id)
2526

test/groupher_server/cms/cite_contents/cite_blog_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Blog do
2929
end
3030

3131
describe "[cite basic]" do
32-
@tag :wip
3332
test "cited multi blog should work", ~m(user community blog2 blog3 blog4 blog5 blog_attrs)a do
3433
body =
3534
mock_rich_text(
@@ -63,7 +62,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Blog do
6362
assert blog5.meta.citing_count == 1
6463
end
6564

66-
@tag :wip
6765
test "cited blog itself should not work", ~m(user community blog_attrs)a do
6866
{:ok, blog} = CMS.create_article(community, :blog, blog_attrs, user)
6967

test/groupher_server/cms/cite_contents/cite_job_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Job do
2929
end
3030

3131
describe "[cite basic]" do
32-
@tag :wip
3332
test "cited multi job should work", ~m(user community job2 job3 job4 job5 job_attrs)a do
3433
body =
3534
mock_rich_text(
@@ -63,7 +62,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Job do
6362
assert job5.meta.citing_count == 1
6463
end
6564

66-
@tag :wip
6765
test "cited job itself should not work", ~m(user community job_attrs)a do
6866
{:ok, job} = CMS.create_article(community, :job, job_attrs, user)
6967

test/groupher_server/cms/cite_contents/cite_post_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Post do
2929
end
3030

3131
describe "[cite basic]" do
32-
@tag :wip
3332
test "cited multi post should work", ~m(user community post2 post3 post4 post5 post_attrs)a do
3433
body =
3534
mock_rich_text(
@@ -63,7 +62,6 @@ defmodule GroupherServer.Test.CMS.CiteContent.Post do
6362
assert post5.meta.citing_count == 1
6463
end
6564

66-
@tag :wip
6765
test "cited post itself should not work", ~m(user community post_attrs)a do
6866
{:ok, post} = CMS.create_article(community, :post, post_attrs, user)
6967

0 commit comments

Comments
 (0)