feat: don't allow blocking the doer

- In the case of organization blocking users, disallow blocking the doer.
- Resolves #5390
- Added integration test.
This commit is contained in:
Gusted 2024-12-30 00:09:07 +01:00
parent d071c09bf7
commit e14f2d0c84
No known key found for this signature in database
GPG key ID: FD821B732837125F
3 changed files with 21 additions and 0 deletions

View file

@ -53,6 +53,12 @@ func BlockedUsersBlock(ctx *context.Context) {
return
}
if u.ID == ctx.Doer.ID {
ctx.Flash.Error(ctx.Tr("settings.user_block_yourself"))
ctx.Redirect(ctx.Org.OrgLink + "/settings/blocked_users")
return
}
if err := user_service.BlockUser(ctx, ctx.Org.Organization.ID, u.ID); err != nil {
ctx.ServerError("BlockUser", err)
return