diff options
Diffstat (limited to 'internal/api/client/accounts')
-rw-r--r-- | internal/api/client/accounts/follow.go | 5 | ||||
-rw-r--r-- | internal/api/client/accounts/lookup.go | 7 | ||||
-rw-r--r-- | internal/api/client/accounts/note.go | 5 | ||||
-rw-r--r-- | internal/api/client/accounts/search.go | 7 | ||||
-rw-r--r-- | internal/api/client/accounts/statuses.go | 7 |
5 files changed, 31 insertions, 0 deletions
diff --git a/internal/api/client/accounts/follow.go b/internal/api/client/accounts/follow.go index 2e6e79964..8a6e99744 100644 --- a/internal/api/client/accounts/follow.go +++ b/internal/api/client/accounts/follow.go @@ -97,6 +97,11 @@ func (m *Module) AccountFollowPOSTHandler(c *gin.Context) { return } + if authed.Account.IsMoving() { + apiutil.ForbiddenAfterMove(c) + return + } + if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) return diff --git a/internal/api/client/accounts/lookup.go b/internal/api/client/accounts/lookup.go index f6bd97657..d2a8e76be 100644 --- a/internal/api/client/accounts/lookup.go +++ b/internal/api/client/accounts/lookup.go @@ -72,6 +72,13 @@ func (m *Module) AccountLookupGETHandler(c *gin.Context) { return } + if authed.Account.IsMoving() { + // For moving/moved accounts, just return + // empty to avoid breaking client apps. + apiutil.NotFoundAfterMove(c) + return + } + if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) return diff --git a/internal/api/client/accounts/note.go b/internal/api/client/accounts/note.go index 29ea01c9a..bcfd232ae 100644 --- a/internal/api/client/accounts/note.go +++ b/internal/api/client/accounts/note.go @@ -81,6 +81,11 @@ func (m *Module) AccountNotePOSTHandler(c *gin.Context) { return } + if authed.Account.IsMoving() { + apiutil.ForbiddenAfterMove(c) + return + } + if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) return diff --git a/internal/api/client/accounts/search.go b/internal/api/client/accounts/search.go index 183fc1347..13c135601 100644 --- a/internal/api/client/accounts/search.go +++ b/internal/api/client/accounts/search.go @@ -113,6 +113,13 @@ func (m *Module) AccountSearchGETHandler(c *gin.Context) { return } + if authed.Account.IsMoving() { + // For moving/moved accounts, just return + // empty to avoid breaking client apps. + apiutil.Data(c, http.StatusOK, apiutil.AppJSON, apiutil.EmptyJSONArray) + return + } + if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) return diff --git a/internal/api/client/accounts/statuses.go b/internal/api/client/accounts/statuses.go index cd93cb74e..7dd4cbe37 100644 --- a/internal/api/client/accounts/statuses.go +++ b/internal/api/client/accounts/statuses.go @@ -152,6 +152,13 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) { return } + if authed.Account.IsMoving() && targetAcctID != authed.Account.ID { + // For moving/moved accounts, allow the + // account to view its own statuses only. + apiutil.Data(c, http.StatusOK, apiutil.AppJSON, apiutil.EmptyJSONArray) + return + } + limit := 30 limitString := c.Query(LimitKey) if limitString != "" { |