Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit66c4062

Browse files
authored
feat(artiment-auditon): pending for artiment (#440)
* refactor(pending-state): basic flag for articles* refactor(pending-state): pasic set/unset operate* refactor(pending-state): basic legal/illegal workflow for articles* refactor(pending): test re-org, fix edge case* refactor(pending): audition hook for article* refactor(audit-hooks): add comment support, more tests* refactor(audit-hooks): enhance with cron job & more tests* refactor(comment): test with audit meta* fix(repo): missing pending field* fix: test error
1 parentf57dd92 commit66c4062

File tree

43 files changed

+1938
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1938
-93
lines changed

‎config/config.exs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ config :groupher_server, Helper.Scheduler,
158158
jobs:[
159159
# Every midnight
160160
{"@daily",{Helper.Scheduler,:clear_all_cache,[]}},
161-
{"@daily",{Helper.Scheduler,:archive_artiments,[]}}
161+
{"@daily",{Helper.Scheduler,:archive_artiments,[]}},
162+
# Every 59 minutes
163+
{"*/59 * * * *",{Helper.Scheduler,:articles_audition,[]}},
164+
# Every 29 minutes
165+
{"*/29 * * * *",{Helper.Scheduler,:comments_audition,[]}}
162166
]
163167

164168
# handle background jobs

‎lib/groupher_server/accounts/models/embeds/user_meta.ex‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ defmodule GroupherServer.Accounts.Model.Embeds.UserMeta do
3333
reported_count:0,
3434
reported_user_ids:[],
3535
follower_user_ids:[],
36-
following_user_ids:[]
36+
following_user_ids:[],
37+
# audit_artiment state
38+
has_illegal_articles:false,
39+
illegal_articles:[],
40+
has_illegal_comments:false,
41+
illegal_comments:[]
3742
}
3843

3944
@optional_fieldsMap.keys(@general_options)++
@@ -58,6 +63,12 @@ defmodule GroupherServer.Accounts.Model.Embeds.UserMeta do
5863
field(:follower_user_ids,{:array,:integer},default:[])
5964
field(:following_user_ids,{:array,:integer},default:[])
6065

66+
field(:has_illegal_articles,:boolean,default:false)
67+
field(:has_illegal_comments,:boolean,default:false)
68+
69+
field(:illegal_articles,{:array,:string},default:[])
70+
field(:illegal_comments,{:array,:string},default:[])
71+
6172
published_article_count_fields()
6273
end
6374

‎lib/groupher_server/cms/cms.ex‎

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule GroupherServer.CMS do
1515
ArticleCommunity,
1616
ArticleEmotion,
1717
CitedArtiment,
18-
CommentCurd,
18+
CommentCURD,
1919
ArticleCollect,
2020
ArticleUpvote,
2121
CommentAction,
@@ -86,9 +86,16 @@ defmodule GroupherServer.CMS do
8686
defdelegateread_article(thread,id),to:ArticleCURD
8787
defdelegateread_article(thread,id,user),to:ArticleCURD
8888

89-
defdelegatepaged_articles(queryable,filter),to:ArticleCURD
90-
defdelegatepaged_articles(queryable,filter,user),to:ArticleCURD
91-
defdelegatepaged_published_articles(queryable,filter,user),to:ArticleCURD
89+
defdelegateset_article_illegal(thread,id,attrs),to:ArticleCURD
90+
defdelegateset_article_illegal(article,attrs),to:ArticleCURD
91+
defdelegateunset_article_illegal(thread,id,attrs),to:ArticleCURD
92+
defdelegateunset_article_illegal(article,attrs),to:ArticleCURD
93+
defdelegateset_article_audit_failed(article,state),to:ArticleCURD
94+
95+
defdelegatepaged_articles(thread,filter),to:ArticleCURD
96+
defdelegatepaged_articles(thread,filter,user),to:ArticleCURD
97+
defdelegatepaged_published_articles(thread,filter,user),to:ArticleCURD
98+
defdelegatepaged_audit_failed_articles(thread,filter),to:ArticleCURD
9299

93100
defdelegatecreate_article(community,thread,attrs,user),to:ArticleCURD
94101
defdelegateupdate_article(article,attrs),to:ArticleCURD
@@ -153,33 +160,39 @@ defmodule GroupherServer.CMS do
153160

154161
# Comment CURD
155162

156-
defdelegatecomments_state(thread,article_id),to:CommentCurd
157-
defdelegatecomments_state(thread,article_id,user),to:CommentCurd
158-
defdelegateone_comment(id),to:CommentCurd
159-
defdelegateone_comment(id,user),to:CommentCurd
163+
defdelegateset_comment_illegal(comment_id,attrs),to:CommentCURD
164+
defdelegateunset_comment_illegal(comment_id,attrs),to:CommentCURD
165+
defdelegatepaged_audit_failed_comments(filter),to:CommentCURD
166+
167+
defdelegateset_comment_audit_failed(comment,state),to:CommentCURD
168+
169+
defdelegatecomments_state(thread,article_id),to:CommentCURD
170+
defdelegatecomments_state(thread,article_id,user),to:CommentCURD
171+
defdelegateone_comment(id),to:CommentCURD
172+
defdelegateone_comment(id,user),to:CommentCURD
160173

161-
defdelegateupdate_user_in_comments_participants(user),to:CommentCurd
162-
defdelegatepaged_comments(thread,article_id,filters,mode),to:CommentCurd
163-
defdelegatepaged_comments(thread,article_id,filters,mode,user),to:CommentCurd
174+
defdelegateupdate_user_in_comments_participants(user),to:CommentCURD
175+
defdelegatepaged_comments(thread,article_id,filters,mode),to:CommentCURD
176+
defdelegatepaged_comments(thread,article_id,filters,mode,user),to:CommentCURD
164177

165-
defdelegatepaged_published_comments(user,thread,filters),to:CommentCurd
166-
defdelegatepaged_published_comments(user,filters),to:CommentCurd
178+
defdelegatepaged_published_comments(user,thread,filters),to:CommentCURD
179+
defdelegatepaged_published_comments(user,filters),to:CommentCURD
167180

168-
defdelegatepaged_folded_comments(thread,article_id,filters),to:CommentCurd
169-
defdelegatepaged_folded_comments(thread,article_id,filters,user),to:CommentCurd
181+
defdelegatepaged_folded_comments(thread,article_id,filters),to:CommentCURD
182+
defdelegatepaged_folded_comments(thread,article_id,filters,user),to:CommentCURD
170183

171-
defdelegatepaged_comment_replies(comment_id,filters),to:CommentCurd
172-
defdelegatepaged_comment_replies(comment_id,filters,user),to:CommentCurd
184+
defdelegatepaged_comment_replies(comment_id,filters),to:CommentCURD
185+
defdelegatepaged_comment_replies(comment_id,filters,user),to:CommentCURD
173186

174-
defdelegatepaged_comments_participants(thread,content_id,filters),to:CommentCurd
187+
defdelegatepaged_comments_participants(thread,content_id,filters),to:CommentCURD
175188

176-
defdelegatecreate_comment(thread,article_id,args,user),to:CommentCurd
177-
defdelegateupdate_comment(comment,content),to:CommentCurd
178-
defdelegatedelete_comment(comment),to:CommentCurd
179-
defdelegatemark_comment_solution(comment,user),to:CommentCurd
180-
defdelegateundo_mark_comment_solution(comment,user),to:CommentCurd
189+
defdelegatecreate_comment(thread,article_id,args,user),to:CommentCURD
190+
defdelegateupdate_comment(comment,content),to:CommentCURD
191+
defdelegatedelete_comment(comment),to:CommentCURD
192+
defdelegatemark_comment_solution(comment,user),to:CommentCURD
193+
defdelegateundo_mark_comment_solution(comment,user),to:CommentCURD
181194

182-
defdelegatearchive_comments(),to:CommentCurd
195+
defdelegatearchive_comments(),to:CommentCURD
183196

184197
defdelegateupvote_comment(comment_id,user),to:CommentAction
185198
defdelegateundo_upvote_comment(comment_id,user),to:CommentAction
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
defmoduleGroupherServer.CMS.Constantdo
2+
@moduledoc"""
3+
constant used for CMS
4+
5+
NOTE: DO NOT modify, unless you know what you are doing
6+
"""
7+
@artiment_legal0
8+
@artiment_illegal1
9+
@artiment_audit_failed2
10+
11+
defpending(:legal),do:@artiment_legal
12+
defpending(:illegal),do:@artiment_illegal
13+
defpending(:audit_failed),do:@artiment_audit_failed
14+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp