[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

@@ -65,6 +65,11 @@ func (p *processor) FollowCreate(ctx context.Context, requestingAccount *gtsmode
return p.RelationshipGet(ctx, requestingAccount, form.ID)
}
// check for attempt to follow self
if requestingAccount.ID == targetAcct.ID {
return nil, gtserror.NewErrorNotAcceptable(fmt.Errorf("accountfollowcreate: account %s cannot follow itself", requestingAccount.ID))
}
// make the follow request
newFollowID, err := id.NewRandomULID()
if err != nil {