mirror of https://gitee.com/answerdev/answer.git
update review permission
This commit is contained in:
parent
d819ef24ec
commit
e445415ab9
|
@ -98,6 +98,8 @@ backend:
|
|||
revision:
|
||||
review_underway:
|
||||
other: "Revision review underway."
|
||||
no_permission:
|
||||
other: "No permission to Revision."
|
||||
user:
|
||||
email_or_password_wrong:
|
||||
other: *email_or_password_wrong
|
||||
|
|
|
@ -56,4 +56,5 @@ const (
|
|||
RecommendTagNotExist = "error.tag.recommend_tag_not_found"
|
||||
RecommendTagEnter = "error.tag.recommend_tag_enter"
|
||||
RevisionReviewUnderway = "error.revision.review_underway"
|
||||
RevisionNoPermission = "error.revision.no_permission"
|
||||
)
|
||||
|
|
|
@ -89,11 +89,23 @@ func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.Revisi
|
|||
var saveErr error
|
||||
switch objectType {
|
||||
case constant.QuestionObjectType:
|
||||
saveErr = rs.revisionAuditQuestion(ctx, revisionitem)
|
||||
if !req.CanReviewQuestion {
|
||||
saveErr = errors.BadRequest(reason.RevisionNoPermission)
|
||||
} else {
|
||||
saveErr = rs.revisionAuditQuestion(ctx, revisionitem)
|
||||
}
|
||||
case constant.AnswerObjectType:
|
||||
saveErr = rs.revisionAuditAnswer(ctx, revisionitem)
|
||||
if !req.CanReviewAnswer {
|
||||
saveErr = errors.BadRequest(reason.RevisionNoPermission)
|
||||
} else {
|
||||
saveErr = rs.revisionAuditAnswer(ctx, revisionitem)
|
||||
}
|
||||
case constant.TagObjectType:
|
||||
saveErr = rs.revisionAuditTag(ctx, revisionitem)
|
||||
if !req.CanReviewTag {
|
||||
saveErr = errors.BadRequest(reason.RevisionNoPermission)
|
||||
} else {
|
||||
saveErr = rs.revisionAuditTag(ctx, revisionitem)
|
||||
}
|
||||
}
|
||||
if saveErr != nil {
|
||||
return saveErr
|
||||
|
|
Loading…
Reference in New Issue