forked from kevadesu/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.
This commit is contained in:
parent
f911dc4025
commit
490646302e
3 changed files with 63 additions and 1 deletions
|
@ -3034,7 +3034,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