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

Commit 2fdccee

Browse files
authored
chore(rename): make_emotion -> emotion_to_comment (#339)
1 parent 076815e commit 2fdccee

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

lib/groupher_server/cms/cms.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ defmodule GroupherServer.CMS do
134134
defdelegate pin_article_comment(comment_id), to: ArticleComment
135135
defdelegate undo_pin_article_comment(comment_id), to: ArticleComment
136136

137-
defdelegate make_emotion(comment_id, args, user), to: ArticleComment
137+
defdelegate emotion_to_comment(comment_id, args, user), to: ArticleComment
138138
defdelegate fold_article_comment(comment_id, user), to: ArticleComment
139139
defdelegate unfold_article_comment(comment_id, user), to: ArticleComment
140140
defdelegate report_article_comment(comment_id, user), to: ArticleComment

lib/groupher_server/cms/delegates/article_comment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleComment do
225225
end
226226

227227
@doc "make emotion to a comment"
228-
def make_emotion(comment_id, emotion, %User{} = user) do
228+
def emotion_to_comment(comment_id, emotion, %User{} = user) do
229229
with {:ok, comment} <-
230230
ORM.find(ArticleComment, comment_id) do
231231
Multi.new()

test/groupher_server/cms/article_comment_emotions_test.exs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ defmodule GroupherServer.Test.CMS.ArticleCommentEmotions do
3636

3737
first_comment = List.first(all_comment)
3838

39-
{:ok, _} = CMS.make_emotion(first_comment.id, :downvote, user)
40-
{:ok, _} = CMS.make_emotion(first_comment.id, :beer, user)
41-
{:ok, _} = CMS.make_emotion(first_comment.id, :popcorn, user)
39+
{:ok, _} = CMS.emotion_to_comment(first_comment.id, :downvote, user)
40+
{:ok, _} = CMS.emotion_to_comment(first_comment.id, :beer, user)
41+
{:ok, _} = CMS.emotion_to_comment(first_comment.id, :popcorn, user)
4242

4343
{:ok, paged_comments} =
4444
CMS.list_article_comments(
@@ -82,8 +82,8 @@ defmodule GroupherServer.Test.CMS.ArticleCommentEmotions do
8282
parent_content = "parent comment"
8383
{:ok, parent_comment} = CMS.create_article_comment(:post, post.id, parent_content, user)
8484

85-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user)
86-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user2)
85+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user)
86+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user2)
8787

8888
{:ok, %{emotions: emotions}} = ORM.find(ArticleComment, parent_comment.id)
8989

@@ -97,8 +97,8 @@ defmodule GroupherServer.Test.CMS.ArticleCommentEmotions do
9797
parent_content = "parent comment"
9898
{:ok, parent_comment} = CMS.create_article_comment(:post, post.id, parent_content, user)
9999

100-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user)
101-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user)
100+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user)
101+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user)
102102

103103
{:ok, parent_comment} = ORM.find(ArticleComment, parent_comment.id)
104104

@@ -110,9 +110,9 @@ defmodule GroupherServer.Test.CMS.ArticleCommentEmotions do
110110
test "different user can make same emotions on same comment", ~m(post user user2 user3)a do
111111
{:ok, parent_comment} = CMS.create_article_comment(:post, post.id, "parent comment", user)
112112

113-
{:ok, _} = CMS.make_emotion(parent_comment.id, :beer, user)
114-
{:ok, _} = CMS.make_emotion(parent_comment.id, :beer, user2)
115-
{:ok, _} = CMS.make_emotion(parent_comment.id, :beer, user3)
113+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :beer, user)
114+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :beer, user2)
115+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :beer, user3)
116116

117117
{:ok, %{emotions: emotions}} = ORM.find(ArticleComment, parent_comment.id)
118118
# IO.inspect(emotions, label: "the parent_comment")
@@ -128,11 +128,11 @@ defmodule GroupherServer.Test.CMS.ArticleCommentEmotions do
128128
parent_content = "parent comment"
129129
{:ok, parent_comment} = CMS.create_article_comment(:post, post.id, parent_content, user)
130130

131-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user)
132-
{:ok, _} = CMS.make_emotion(parent_comment.id, :downvote, user)
133-
{:ok, _} = CMS.make_emotion(parent_comment.id, :beer, user)
134-
{:ok, _} = CMS.make_emotion(parent_comment.id, :heart, user)
135-
{:ok, _} = CMS.make_emotion(parent_comment.id, :orz, user)
131+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user)
132+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :downvote, user)
133+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :beer, user)
134+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :heart, user)
135+
{:ok, _} = CMS.emotion_to_comment(parent_comment.id, :orz, user)
136136

137137
{:ok, %{emotions: emotions}} = ORM.find(ArticleComment, parent_comment.id)
138138

test/groupher_server_web/query/cms/article_comment_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ defmodule GroupherServer.Test.Query.ArticleComment do
412412
comment = all_comment |> Enum.at(0)
413413
comment2 = all_comment |> Enum.at(1)
414414

415-
{:ok, _} = CMS.make_emotion(comment.id, :downvote, user)
416-
{:ok, _} = CMS.make_emotion(comment.id, :downvote, user2)
417-
{:ok, _} = CMS.make_emotion(comment2.id, :beer, user2)
415+
{:ok, _} = CMS.emotion_to_comment(comment.id, :downvote, user)
416+
{:ok, _} = CMS.emotion_to_comment(comment.id, :downvote, user2)
417+
{:ok, _} = CMS.emotion_to_comment(comment2.id, :beer, user2)
418418

419419
variables = %{id: post.id, thread: "POST", filter: %{page: 1, size: page_size}}
420420
results = guest_conn |> query_result(@query, variables, "pagedArticleComments")
@@ -463,8 +463,8 @@ defmodule GroupherServer.Test.Query.ArticleComment do
463463
comment = all_comment |> Enum.at(0)
464464
comment2 = all_comment |> Enum.at(1)
465465

466-
{:ok, _} = CMS.make_emotion(comment.id, :downvote, user)
467-
{:ok, _} = CMS.make_emotion(comment2.id, :downvote, user2)
466+
{:ok, _} = CMS.emotion_to_comment(comment.id, :downvote, user)
467+
{:ok, _} = CMS.emotion_to_comment(comment2.id, :downvote, user2)
468468

469469
variables = %{id: post.id, thread: "POST", filter: %{page: 1, size: page_size}}
470470
results = user_conn |> query_result(@query, variables, "pagedArticleComments")

0 commit comments

Comments
 (0)