[bugfix] disallow following or blocking yoursel (#667)

Closes #664
This commit is contained in:
ugla
2022-06-25 11:14:05 +02:00
committed by GitHub
parent 0846b76e93
commit 3e4e57d554
4 changed files with 157 additions and 0 deletions

View File

@@ -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 := &gtsmodel.Block{}
newBlockID, err := id.NewULID()