mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-23 09:30:50 +00:00
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:
parent
d071c09bf7
commit
e14f2d0c84
3 changed files with 21 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue