mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Don't try to update suspended accounts (#2348)
* [bugfix] Don't try to update suspended accounts * bail early if requesting account suspended
This commit is contained in:
@@ -106,6 +106,13 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque
|
||||
return nil, gtserror.NewErrorUnauthorized(err)
|
||||
}
|
||||
|
||||
if !requestingAccount.SuspendedAt.IsZero() {
|
||||
// Account was marked as suspended by a
|
||||
// local admin action. Stop request early.
|
||||
err = fmt.Errorf("account %s marked as suspended", requestingAccount.ID)
|
||||
return nil, gtserror.NewErrorForbidden(err)
|
||||
}
|
||||
|
||||
blocked, err := p.state.DB.IsBlocked(ctx, requestedAccount.ID, requestingAccount.ID)
|
||||
if err != nil {
|
||||
err := gtserror.Newf("error checking block from account %s to account %s: %w", requestedAccount.ID, requestingAccount.ID, err)
|
||||
@@ -114,7 +121,7 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque
|
||||
|
||||
if blocked {
|
||||
err := fmt.Errorf("account %s blocks account %s", requestedAccount.ID, requestingAccount.ID)
|
||||
return nil, gtserror.NewErrorUnauthorized(err)
|
||||
return nil, gtserror.NewErrorForbidden(err)
|
||||
}
|
||||
|
||||
return data(person)
|
||||
|
Reference in New Issue
Block a user