summaryrefslogtreecommitdiff
path: root/internal/processing/account/createfollow.go
diff options
context:
space:
mode:
authorLibravatar ugla <ugla@u8.is>2022-06-25 11:14:05 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-25 11:14:05 +0200
commit3e4e57d5543277cdf42da03b20229851eb24be69 (patch)
tree36efe27a62a0e9ecfe943b7f3240a570385fae68 /internal/processing/account/createfollow.go
parent[bugfix] Fix 404 on status delete redraft (#668) (diff)
downloadgotosocial-3e4e57d5543277cdf42da03b20229851eb24be69.tar.xz
[bugfix] disallow following or blocking yoursel (#667)
Closes #664
Diffstat (limited to 'internal/processing/account/createfollow.go')
-rw-r--r--internal/processing/account/createfollow.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/processing/account/createfollow.go b/internal/processing/account/createfollow.go
index cd2dcbd8c..49430b9fb 100644
--- a/internal/processing/account/createfollow.go
+++ b/internal/processing/account/createfollow.go
@@ -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 {