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

Commit 7d65a6a

Browse files
committed
chore(article-comments): wip && clean up
1 parent 9bfe042 commit 7d65a6a

File tree

9 files changed

+6
-16
lines changed

9 files changed

+6
-16
lines changed

lib/groupher_server/cms/delegates/article_comment_action.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ defmodule GroupherServer.CMS.Delegate.ArticleCommentAction do
2222
ArticlePinedComment,
2323
ArticleCommentUpvote,
2424
ArticleCommentReply,
25+
Community,
2526
# TODO: remove spec type
2627
Post,
2728
Job
2829
}
2930

3031
alias Ecto.Multi
3132

33+
@article_threads Community.article_threads()
3234
@max_parent_replies_count ArticleComment.max_parent_replies_count()
3335
@pined_comment_limit ArticleComment.pined_comment_limit()
3436

@@ -264,7 +266,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCommentAction do
264266

265267
@spec get_full_comment(String.t()) :: {:ok, T.article_info()} | {:error, nil}
266268
defp get_full_comment(comment_id) do
267-
query = from(c in ArticleComment, where: c.id == ^comment_id, preload: :post, preload: :job)
269+
query = from(c in ArticleComment, where: c.id == ^comment_id, preload: ^@article_threads)
268270

269271
with {:ok, comment} <- Repo.one(query) |> done() do
270272
extract_article_info(comment)

test/groupher_server_web/mutation/cms/cms_manager_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Manager do
2828
}
2929
}
3030
"""
31-
@tag :wip2
31+
3232
test "root can markDelete a post", ~m(community user)a do
3333
post_attrs = mock_attrs(:post, %{community_id: community.id})
3434
{:ok, post} = CMS.create_article(community, :post, post_attrs, user)

test/groupher_server_web/mutation/cms/flags/post_flag_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defmodule GroupherServer.Test.Mutation.Flags.PostFlag do
2525
}
2626
}
2727
"""
28-
test "auth user can markDelete post", ~m(community post)a do
28+
test "auth user can markDelete post", ~m(post)a do
2929
variables = %{id: post.id}
3030

3131
passport_rules = %{"post.mark_delete" => true}

test/groupher_server_web/query/cms/comments/job_comment_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ defmodule GroupherServer.Test.Query.Comments.JobComment do
243243
assert results["totalCount"] == total_count
244244
end
245245

246-
@tag :wip2
247246
test "guest user can get paged comment with pinned comment in it",
248247
~m(guest_conn job user)a do
249248
total_count = 20

test/groupher_server_web/query/cms/comments/post_comment_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ defmodule GroupherServer.Test.Query.Comments.PostComment do
243243
assert results["totalCount"] == total_count
244244
end
245245

246-
@tag :wip2
247246
test "guest user can get paged comment with pinned comment in it",
248247
~m(guest_conn post user)a do
249248
total_count = 20

test/groupher_server_web/query/cms/comments/repo_comment_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ defmodule GroupherServer.Test.Query.Comments.RepoComment do
243243
assert results["totalCount"] == total_count
244244
end
245245

246-
@tag :wip2
247246
test "guest user can get paged comment with pinned comment in it",
248247
~m(guest_conn repo user)a do
249248
total_count = 20
@@ -364,7 +363,7 @@ defmodule GroupherServer.Test.Query.Comments.RepoComment do
364363
assert List.last(results["entries"]) |> Map.get("id") == to_string(comment.id)
365364
end
366365

367-
@tag :wip
366+
@tag :wip2
368367
test "guest user can get paged comment with upvotes_count", ~m(guest_conn repo user user2)a do
369368
total_count = 10
370369
page_size = 10

test/groupher_server_web/query/cms/flags/jobs_flags_test.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ defmodule GroupherServer.Test.Query.Flags.JobsFlags do
44
import Helper.Utils, only: [get_config: 2]
55

66
alias GroupherServer.CMS
7-
# alias GroupherServer.Repo
8-
9-
alias CMS.Job
107

118
@total_count 35
129
@page_size get_config(:general, :page_size)

test/groupher_server_web/query/cms/flags/posts_flags_test.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ defmodule GroupherServer.Test.Query.Flags.PostsFlags do
44
import Helper.Utils, only: [get_config: 2]
55

66
alias GroupherServer.CMS
7-
# alias GroupherServer.Repo
8-
9-
alias CMS.Post
107

118
@total_count 35
129
@page_size get_config(:general, :page_size)

test/groupher_server_web/query/cms/flags/repos_flags_test.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ defmodule GroupherServer.Test.Query.Flags.ReposFlags do
44
import Helper.Utils, only: [get_config: 2]
55

66
alias GroupherServer.CMS
7-
# alias GroupherServer.Repo
8-
9-
alias CMS.Repo
107

118
@total_count 35
129
@page_size get_config(:general, :page_size)

0 commit comments

Comments
 (0)