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.

Commit1de1a89

Browse files
authored
refactor(article-comments): GQ workflow enhance && re-org (#325)
* chore(article-comments): clean up unused vars* test(article-comments): add floor & isPined test* test(article-comments): upvotes count test* test(article-comments): basic emotions test flow* test(article-comments): improve emotion test* test(article-comments): author flag & basic meta* test(article-comments): replyTo info make right* fix(article-comments): emotion perfermence issue* feat(article-comments): view has upvoted using dataloader* refactor(article-comments): rules for delete workflow* refactor(article-comments): rules for delete workflow && fix tests* refactor(article-comments): add article_comments_participators_count* refactor(article-comments): list mode wip* refactor(article-comments): timeline mode done* refactor(article-comments): re-org wip* refactor(article-comments): re-org wip* refactor(article-comments): improve replies test* fix(article-comments): replies edge case & add is_reply_to_others flag* refactor(article-comments): add list_article_comments_participators* refactor(article-comments): helper for raise custom error* refactor(article-comments): clean up
1 parentb217cdf commit1de1a89

File tree

28 files changed

+1181
-282
lines changed

28 files changed

+1181
-282
lines changed

‎lib/groupher_server/cms/article_comment.ex‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defmodule GroupherServer.CMS.ArticleComment do
3535
# 每篇文章最多含有置顶评论的条数
3636
@pined_comment_limit10
3737

38-
@doc"latest participators stores in articlecomment_participators field"
38+
@doc"latest participators stores in articlearticle_comment_participators field"
3939
defmax_participator_count(),do:@max_participator_count
4040
@doc"latest replies stores in article_comment replies field, used for frontend display"
4141
defmax_parent_replies_count(),do:@max_parent_replies_count
@@ -52,8 +52,6 @@ defmodule GroupherServer.CMS.ArticleComment do
5252
@typet::%ArticleComment{}
5353
schema"articles_comments"do
5454
field(:body_html,:string)
55-
field(:replies_count,:integer,default:0)
56-
5755
# 是否被折叠
5856
field(:is_folded,:boolean,default:false)
5957
# 是否被举报
@@ -76,6 +74,8 @@ defmodule GroupherServer.CMS.ArticleComment do
7674
belongs_to(:reply_to,ArticleComment,foreign_key::reply_to_id)
7775

7876
embeds_many(:replies,ArticleComment,on_replace::delete)
77+
field(:replies_count,:integer,default:0)
78+
7979
embeds_one(:emotions,Embeds.ArticleCommentEmotion,on_replace::update)
8080
embeds_one(:meta,Embeds.ArticleCommentMeta,on_replace::update)
8181

‎lib/groupher_server/cms/cms.ex‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ defmodule GroupherServer.CMS do
109109
defdelegateunset_community(community,thread,content_id),to:ArticleOperation
110110

111111
# Comment CURD
112-
defdelegatelist_article_comments(thread,article_id,filters),to:ArticleComment
113-
defdelegatelist_article_comments(thread,article_id,filters,user),to:ArticleComment
112+
defdelegatelist_article_comments(thread,article_id,filters,mode),to:ArticleComment
113+
defdelegatelist_article_comments(thread,article_id,filters,mode,user),to:ArticleComment
114+
114115
defdelegatelist_folded_article_comments(thread,article_id,filters),to:ArticleComment
115116
defdelegatelist_folded_article_comments(thread,article_id,filters,user),to:ArticleComment
116117
defdelegatelist_reported_article_comments(thread,article_id,filters),to:ArticleComment
@@ -119,9 +120,8 @@ defmodule GroupherServer.CMS do
119120
to:ArticleComment
120121

121122
defdelegatelist_comment_replies(comment_id,filters),to:ArticleComment
122-
123-
defdelegatelist_comments(thread,content_id,filters),to:CommentCURD
124-
defdelegatelist_comments_participators(thread,content_id,filters),to:CommentCURD
123+
defdelegatelist_comment_replies(comment_id,filters,user),to:ArticleComment
124+
defdelegatelist_article_comments_participators(thread,content_id,filters),to:ArticleComment
125125

126126
defdelegatecreate_article_comment(thread,article_id,args,user),to:ArticleComment
127127
defdelegateupvote_article_comment(comment_id,user),to:ArticleComment
@@ -144,6 +144,9 @@ defmodule GroupherServer.CMS do
144144
defdelegatelist_replies(thread,comment,user),to:CommentCURD
145145
defdelegatereply_comment(thread,comment,args,user),to:CommentCURD
146146

147+
defdelegatelist_comments(thread,content_id,filters),to:CommentCURD
148+
defdelegatelist_comments_participators(thread,content_id,filters),to:CommentCURD
149+
147150
# report
148151
defdelegatecreate_report(type,content_id,args,user),to:AbuseReport
149152

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp