forked from forgejo/forgejo
[MODERATION] Show graceful error on comment creation
- When someone is blocked by the repository owner or issue poster and try to comment on that issue, they get shown a graceful error. - Adds integration test. (cherry picked from commit490646302e
) (cherry picked from commitd3d88667cb
)
This commit is contained in:
parent
856a2e0903
commit
6818de13a9
3 changed files with 63 additions and 1 deletions
|
@ -3065,7 +3065,11 @@ func NewComment(ctx *context.Context) {
|
|||
|
||||
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments)
|
||||
if err != nil {
|
||||
ctx.ServerError("CreateIssueComment", err)
|
||||
if errors.Is(err, user_model.ErrBlockedByUser) {
|
||||
ctx.Flash.Error(ctx.Tr("repo.issues.comment.blocked_by_user"))
|
||||
} else {
|
||||
ctx.ServerError("CreateIssueComment", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue