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

Commit db723ec

Browse files
authored
refactor(config): rename article_xxx -> xxx (#380)
* refactor(config): rename article_threads -> threads * refactor(config): rename supported_emotions -> emotions * chore: clean up unused warnings * chore: enhance active_at tests
1 parent 690bf55 commit db723ec

37 files changed

+59
-70
lines changed

config/config.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ config :groupher_server, :customization,
6262

6363
config :groupher_server, :article,
6464
# NOTE: do not change unless you know what you are doing
65-
article_threads: [:post, :job, :repo],
65+
threads: [:post, :job, :repo],
6666
# in this period, paged articles will sort front if non-article-author commented
6767
# 在此时间段内,一旦有非文章作者的用户评论,该文章就会排到前面
6868
active_period_days: %{
@@ -73,7 +73,7 @@ config :groupher_server, :article,
7373

7474
# NOTE: if you want to add/remove emotion, just edit the list below
7575
# and migrate the field to table "articles_users_emotions"
76-
supported_emotions: [
76+
emotions: [
7777
:upvote,
7878
:downvote,
7979
:beer,
@@ -86,7 +86,7 @@ config :groupher_server, :article,
8686
],
8787
# NOTE: if you want to add/remove emotion, just edit the list below
8888
# and migrate the field to table "articles_comments_users_emotions"
89-
comment_supported_emotions: [
89+
comment_emotions: [
9090
:downvote,
9191
:beer,
9292
:heart,

lib/groupher_server/accounts/delegates/collect_folder.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule GroupherServer.Accounts.Delegate.CollectFolder do
2424
# @max_article_count_per_collect_folder 300
2525

2626
@default_meta Embeds.CollectFolderMeta.default_meta()
27-
@article_threads get_config(:article, :article_threads)
27+
@article_threads get_config(:article, :threads)
2828

2929
@doc """
3030
list a user's not-private collect folders

lib/groupher_server/accounts/delegates/upvoted_articles.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule GroupherServer.Accounts.Delegate.UpvotedArticles do
1111
alias GroupherServer.CMS
1212
alias CMS.{ArticleUpvote}
1313

14-
@article_threads get_config(:article, :article_threads)
14+
@article_threads get_config(:article, :threads)
1515

1616
@doc """
1717
get paged upvoted articles

lib/groupher_server/accounts/embeds/collect_folder_meta.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule GroupherServer.Accounts.Embeds.CollectFolderMeta.Macros do
1212
"""
1313
import Helper.Utils, only: [get_config: 2]
1414

15-
@article_threads get_config(:article, :article_threads)
15+
@article_threads get_config(:article, :threads)
1616

1717
defmacro threads_fields() do
1818
@article_threads
@@ -34,7 +34,7 @@ defmodule GroupherServer.Accounts.Embeds.CollectFolderMeta do
3434
import GroupherServer.Accounts.Embeds.CollectFolderMeta.Macros
3535
import Helper.Utils, only: [get_config: 2]
3636

37-
@article_threads get_config(:article, :article_threads)
37+
@article_threads get_config(:article, :threads)
3838

3939
@optional_fields Enum.map(@article_threads, &:"#{&1}_count") ++
4040
Enum.map(@article_threads, &:"has_#{&1}")

lib/groupher_server/accounts/embeds/user_meta.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GroupherServer.Accounts.Embeds.UserMeta.Macro do
33

44
import Helper.Utils, only: [get_config: 2]
55

6-
@article_threads get_config(:article, :article_threads)
6+
@article_threads get_config(:article, :threads)
77

88
defmacro published_article_count_fields() do
99
@article_threads
@@ -26,7 +26,7 @@ defmodule GroupherServer.Accounts.Embeds.UserMeta do
2626
import GroupherServer.Accounts.Embeds.UserMeta.Macro
2727
import Helper.Utils, only: [get_config: 2]
2828

29-
@article_threads get_config(:article, :article_threads)
29+
@article_threads get_config(:article, :threads)
3030

3131
@general_options %{
3232
reported_count: 0,

lib/groupher_server/cms/abuse_report.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule GroupherServer.CMS.AbuseReport do
1313
alias GroupherServer.{Accounts, CMS}
1414
alias CMS.{ArticleComment, Embeds}
1515

16-
@article_threads get_config(:article, :article_threads)
16+
@article_threads get_config(:article, :threads)
1717

1818
# @required_fields ~w(article_comment_id user_id recived_user_id)a
1919
@optional_fields ~w(article_comment_id account_id operate_user_id deal_with report_cases_count)a

lib/groupher_server/cms/article_collect.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule GroupherServer.CMS.ArticleCollect do
1212
alias GroupherServer.Accounts
1313
alias Accounts.{User, CollectFolder}
1414

15-
@article_threads get_config(:article, :article_threads)
15+
@article_threads get_config(:article, :threads)
1616

1717
@required_fields ~w(user_id)a
1818
@optional_fields ~w(thread)a

lib/groupher_server/cms/article_comment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule GroupherServer.CMS.ArticleComment do
1414
alias CMS.{Embeds, ArticleCommentUpvote}
1515

1616
# alias Helper.HTML
17-
@article_threads get_config(:article, :article_threads)
17+
@article_threads get_config(:article, :threads)
1818

1919
@required_fields ~w(body_html author_id)a
2020
@optional_fields ~w(reply_to_id replies_count is_folded is_deleted floor is_article_author thread)a

lib/groupher_server/cms/article_comment_user_emotion.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule GroupherServer.CMS.ArticleCommentUserEmotion.Macros do
22
import Helper.Utils, only: [get_config: 2]
33

4-
@supported_emotions get_config(:article, :comment_supported_emotions)
4+
@supported_emotions get_config(:article, :comment_emotions)
55

66
defmacro emotion_fields() do
77
@supported_emotions
@@ -25,7 +25,7 @@ defmodule GroupherServer.CMS.ArticleCommentUserEmotion do
2525
alias GroupherServer.{Accounts, CMS}
2626
alias CMS.ArticleComment
2727

28-
@supported_emotions get_config(:article, :comment_supported_emotions)
28+
@supported_emotions get_config(:article, :comment_emotions)
2929

3030
@required_fields ~w(article_comment_id user_id recived_user_id)a
3131
@optional_fields Enum.map(@supported_emotions, &:"#{&1}")

lib/groupher_server/cms/article_pinned_comment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule GroupherServer.CMS.ArticlePinnedComment do
1414
alias CMS.ArticleComment
1515

1616
# alias Helper.HTML
17-
@article_threads get_config(:article, :article_threads)
17+
@article_threads get_config(:article, :threads)
1818

1919
@required_fields ~w(article_comment_id)a
2020
# @optional_fields ~w(post_id job_id repo_id)a

0 commit comments

Comments
 (0)