diff options
author | 2022-06-25 11:14:05 +0200 | |
---|---|---|
committer | 2022-06-25 11:14:05 +0200 | |
commit | 3e4e57d5543277cdf42da03b20229851eb24be69 (patch) | |
tree | 36efe27a62a0e9ecfe943b7f3240a570385fae68 /internal/processing/account/createblock.go | |
parent | [bugfix] Fix 404 on status delete redraft (#668) (diff) | |
download | gotosocial-3e4e57d5543277cdf42da03b20229851eb24be69.tar.xz |
[bugfix] disallow following or blocking yoursel (#667)
Closes #664
Diffstat (limited to 'internal/processing/account/createblock.go')
-rw-r--r-- | internal/processing/account/createblock.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/processing/account/createblock.go b/internal/processing/account/createblock.go index e1bad0d38..dfe1475cb 100644 --- a/internal/processing/account/createblock.go +++ b/internal/processing/account/createblock.go @@ -46,6 +46,11 @@ func (p *processor) BlockCreate(ctx context.Context, requestingAccount *gtsmodel return p.RelationshipGet(ctx, requestingAccount, targetAccountID) } + // don't block yourself, silly + if requestingAccount.ID == targetAccountID { + return nil, gtserror.NewErrorNotAcceptable(fmt.Errorf("BlockCreate: account %s cannot block itself", requestingAccount.ID)) + } + // make the block block := >smodel.Block{} newBlockID, err := id.NewULID() |