diff --git a/internal/servants/web/priv.go b/internal/servants/web/priv.go index 5236cf4e..514bbdd7 100644 --- a/internal/servants/web/priv.go +++ b/internal/servants/web/priv.go @@ -36,8 +36,6 @@ var ( "public/video": core.AttachmentTypeVideo, "attachment": core.AttachmentTypeOther, } - - _MaxCommentCount = conf.AppSetting.MaxCommentCount ) type privSrv struct { @@ -517,7 +515,7 @@ func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateComment logrus.Errorf("Ds.GetPostByID err:%s", err) return nil, xerror.ServerError } - if post.CommentCount >= _MaxCommentCount { + if post.CommentCount >= conf.AppSetting.MaxCommentCount { return nil, _errMaxCommentCount } comment := &core.Comment{ @@ -728,7 +726,7 @@ func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) return nil, nil, atUserID, err } - if post.CommentCount >= _MaxCommentCount { + if post.CommentCount >= conf.AppSetting.MaxCommentCount { return nil, nil, atUserID, _errMaxCommentCount } diff --git a/internal/servants/web/pub.go b/internal/servants/web/pub.go index afc14779..f24913d1 100644 --- a/internal/servants/web/pub.go +++ b/internal/servants/web/pub.go @@ -37,8 +37,6 @@ var ( _ api.Pub = (*pubSrv)(nil) _ api.PubBinding = (*pubBinding)(nil) _ api.PubRender = (*pubRender)(nil) - - _MaxPageSize = conf.AppSetting.MaxPageSize ) const ( @@ -74,8 +72,8 @@ func (b *pubBinding) BindTweetComments(c *gin.Context) (*web.TweetCommentsReq, m func (s *pubSrv) TopicList(req *web.TopicListReq) (*web.TopicListResp, mir.Error) { // tags, err := broker.GetPostTags(¶m) num := req.Num - if num > _MaxPageSize { - num = _MaxPageSize + if num > conf.AppSetting.MaxPageSize { + num = conf.AppSetting.MaxPageSize } conditions := &core.ConditionsT{}