mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 11:52:25 -05: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:
parent
42a19cf390
commit
7ce3a1e6f3
4 changed files with 33 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue