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

Commit 1810740

Browse files
authored
refactor(naming): cms_thread -> thread, thread -> thread_item (#350)
1 parent 1b9ae17 commit 1810740

31 files changed

+60
-61
lines changed

cover/excoveralls.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/groupher_server/cms/delegates/helper.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ defmodule GroupherServer.CMS.Delegate.Helper do
2828
%User{} = user,
2929
type \\ :article
3030
) do
31-
IO.inspect("hello?")
3231
supported_emotions = get_supported_mentions(type)
3332

3433
new_entries =

lib/groupher_server_web/resolvers/cms_resolver.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ defmodule GroupherServerWeb.Resolvers.CMS do
5555
end
5656

5757
def paged_articles(_root, ~m(thread filter)a, %{context: %{cur_user: user}}) do
58-
IO.inspect(filter, label: "the filter")
5958
CMS.paged_articles(thread, filter, user)
6059
end
6160

lib/groupher_server_web/schema/Helper/queries.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule GroupherServerWeb.Schema.Helper.Queries do
3636
@desc unquote("get paged #{action}ed users of an article")
3737
field unquote(:"#{action}ed_users"), :paged_users do
3838
arg(:id, non_null(:id))
39-
arg(:thread, :cms_thread, default_value: :post)
39+
arg(:thread, :thread, default_value: :post)
4040
arg(:filter, non_null(:paged_filter))
4141

4242
middleware(M.PageSizeProof)

lib/groupher_server_web/schema/account/account_mutations.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule GroupherServerWeb.Schema.Account.Mutations do
7272
field :add_to_collect, :collect_folder do
7373
arg(:article_id, non_null(:id))
7474
arg(:folder_id, non_null(:id))
75-
arg(:thread, :cms_thread, default_value: :post)
75+
arg(:thread, :thread, default_value: :post)
7676

7777
middleware(M.Authorize, :login)
7878
resolve(&R.Accounts.add_to_collect/3)
@@ -82,7 +82,7 @@ defmodule GroupherServerWeb.Schema.Account.Mutations do
8282
field :remove_from_collect, :collect_folder do
8383
arg(:article_id, non_null(:id))
8484
arg(:folder_id, non_null(:id))
85-
arg(:thread, :cms_thread, default_value: :post)
85+
arg(:thread, :thread, default_value: :post)
8686

8787
middleware(M.Authorize, :login)
8888
resolve(&R.Accounts.remove_from_collect/3)

lib/groupher_server_web/schema/cms/cms_misc.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServerWeb.Schema.CMS.Misc do
6666
value(:radar)
6767
end
6868

69-
enum :cms_thread do
69+
enum :thread do
7070
value(:post)
7171
value(:job)
7272
value(:user)
@@ -251,19 +251,19 @@ defmodule GroupherServerWeb.Schema.CMS.Misc do
251251

252252
@desc "common filter for upvoted articles"
253253
input_object :upvoted_articles_filter do
254-
field(:thread, :cms_thread)
254+
field(:thread, :thread)
255255
pagination_args()
256256
end
257257

258258
@desc "common filter for collect folders"
259259
input_object :collect_folders_filter do
260-
field(:thread, :cms_thread)
260+
field(:thread, :thread)
261261
pagination_args()
262262
end
263263

264264
@desc "common filter for collect articles"
265265
input_object :collected_articles_filter do
266-
field(:thread, :cms_thread)
266+
field(:thread, :thread)
267267
pagination_args()
268268
end
269269

lib/groupher_server_web/schema/cms/cms_queries.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
105105
field :partial_tags, list_of(:tag) do
106106
arg(:community_id, :id)
107107
arg(:community, :string)
108-
arg(:thread, :cms_thread, default_value: :post)
108+
arg(:thread, :thread, default_value: :post)
109109
arg(:all, :boolean, default_value: false)
110110

111111
resolve(&R.CMS.get_tags/3)
@@ -115,7 +115,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
115115
field :paged_article_comments, :paged_article_comments do
116116
arg(:id, non_null(:id))
117117
arg(:mode, :article_comments_mode, default_value: :replies)
118-
arg(:thread, :cms_thread, default_value: :post)
118+
arg(:thread, :thread, default_value: :post)
119119
arg(:filter, :comments_filter)
120120

121121
middleware(M.PageSizeProof)
@@ -125,7 +125,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
125125
@desc "get paged article comments participators"
126126
field :paged_article_comments_participators, :paged_users do
127127
arg(:id, non_null(:id))
128-
arg(:thread, :cms_thread, default_value: :post)
128+
arg(:thread, :thread, default_value: :post)
129129
arg(:filter, :paged_filter)
130130

131131
middleware(M.PageSizeProof)
@@ -144,7 +144,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
144144
@desc "get paged comments"
145145
field :paged_comments, :paged_comments do
146146
arg(:id, non_null(:id))
147-
arg(:thread, :cms_thread, default_value: :post)
147+
arg(:thread, :thread, default_value: :post)
148148
arg(:filter, :comments_filter)
149149

150150
middleware(M.PageSizeProof)
@@ -154,7 +154,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
154154
@desc "get paged comments participators"
155155
field :paged_comments_participators, :paged_users do
156156
arg(:id, non_null(:id))
157-
arg(:thread, :cms_thread, default_value: :post)
157+
arg(:thread, :thread, default_value: :post)
158158
arg(:filter, :paged_filter)
159159

160160
middleware(M.PageSizeProof)
@@ -165,7 +165,7 @@ defmodule GroupherServerWeb.Schema.CMS.Queries do
165165
# TODO: remove
166166
field :comments, :paged_comments do
167167
arg(:id, non_null(:id))
168-
arg(:thread, :cms_thread, default_value: :post)
168+
arg(:thread, :thread, default_value: :post)
169169
arg(:filter, :comments_filter)
170170

171171
middleware(M.PageSizeProof)

lib/groupher_server_web/schema/cms/cms_types.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ defmodule GroupherServerWeb.Schema.CMS.Types do
202202
timestamp_fields()
203203
end
204204

205-
object :thread do
205+
object :thread_item do
206206
field(:id, :id)
207207
field(:title, :string)
208208
field(:raw, :string)
@@ -232,7 +232,7 @@ defmodule GroupherServerWeb.Schema.CMS.Types do
232232
field(:index, :integer)
233233
field(:logo, :string)
234234
field(:author, :user, resolve: dataloader(CMS, :author))
235-
field(:threads, list_of(:thread), resolve: dataloader(CMS, :threads))
235+
field(:threads, list_of(:thread_item), resolve: dataloader(CMS, :threads))
236236
field(:categories, list_of(:category), resolve: dataloader(CMS, :categories))
237237

238238
@desc "total count of post contents"
@@ -443,7 +443,7 @@ defmodule GroupherServerWeb.Schema.CMS.Types do
443443
end
444444

445445
object :paged_threads do
446-
field(:entries, list_of(:thread))
446+
field(:entries, list_of(:thread_item))
447447
pagination_fields()
448448
end
449449

lib/groupher_server_web/schema/cms/mutations/comment.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Comment do
88
@desc "write a comment"
99
field :create_article_comment, :article_comment do
1010
# TODO use thread and force community pass-in
11-
arg(:thread, :cms_thread, default_value: :post)
11+
arg(:thread, :thread, default_value: :post)
1212
arg(:id, non_null(:id))
1313
arg(:content, non_null(:string))
1414
# arg(:mention_users, list_of(:ids))
@@ -82,7 +82,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Comment do
8282
field :create_comment, :comment do
8383
# TODO use thread and force community pass-in
8484
arg(:community, non_null(:string))
85-
arg(:thread, :cms_thread, default_value: :post)
85+
arg(:thread, :thread, default_value: :post)
8686
arg(:id, non_null(:id))
8787
arg(:body, non_null(:string))
8888
arg(:mention_users, list_of(:ids))
@@ -97,7 +97,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Comment do
9797
@desc "update a comment"
9898
field :update_comment, :comment do
9999
arg(:id, non_null(:id))
100-
arg(:thread, :cms_thread, default_value: :post)
100+
arg(:thread, :thread, default_value: :post)
101101
arg(:body, non_null(:string))
102102

103103
# TDOO: use a comment resolver
@@ -107,7 +107,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Comment do
107107

108108
@desc "delete a comment"
109109
field :delete_comment, :comment do
110-
arg(:thread, :cms_thread, default_value: :post)
110+
arg(:thread, :thread, default_value: :post)
111111
arg(:id, non_null(:id))
112112

113113
middleware(M.Authorize, :login)
@@ -123,7 +123,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Comment do
123123
@desc "reply a exsiting comment"
124124
field :reply_comment, :comment do
125125
arg(:community, non_null(:string))
126-
arg(:thread, non_null(:cms_thread), default_value: :post)
126+
arg(:thread, non_null(:thread), default_value: :post)
127127
arg(:id, non_null(:id))
128128
arg(:body, non_null(:string))
129129
arg(:mention_users, list_of(:ids))

lib/groupher_server_web/schema/cms/mutations/community.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Community do
7676
end
7777

7878
@desc "create independent thread"
79-
field :create_thread, :thread do
79+
field :create_thread, :thread_item do
8080
arg(:title, non_null(:string))
8181
arg(:raw, non_null(:string))
8282
arg(:index, :integer, default_value: 0)
@@ -131,7 +131,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Community do
131131
arg(:title, non_null(:string))
132132
arg(:color, non_null(:rainbow_color_enum))
133133
arg(:community_id, non_null(:id))
134-
arg(:thread, :cms_thread, default_value: :post)
134+
arg(:thread, :thread, default_value: :post)
135135

136136
middleware(M.Authorize, :login)
137137
middleware(M.PassportLoader, source: :community)
@@ -147,7 +147,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Community do
147147
# arg(:color, non_null(:rainbow_color_enum))
148148
arg(:color, non_null(:rainbow_color_enum))
149149
arg(:community_id, non_null(:id))
150-
arg(:thread, :cms_thread, default_value: :post)
150+
arg(:thread, :thread, default_value: :post)
151151

152152
middleware(M.Authorize, :login)
153153
middleware(M.PassportLoader, source: :community)
@@ -160,7 +160,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Community do
160160
field :delete_tag, :tag do
161161
arg(:id, non_null(:id))
162162
arg(:community_id, non_null(:id))
163-
arg(:thread, :cms_thread, default_value: :post)
163+
arg(:thread, :thread, default_value: :post)
164164

165165
middleware(M.Authorize, :login)
166166
middleware(M.PassportLoader, source: :community)

0 commit comments

Comments
 (0)