move moving check to after error check

This commit is contained in:
tobi 2024-03-13 13:07:33 +01:00
parent f7a336205d
commit f899017b68
1 changed files with 7 additions and 6 deletions

View File

@ -117,12 +117,6 @@ func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
authed, err = oauth.Authed(c, false, false, false, false)
} else {
authed, err = oauth.Authed(c, true, true, true, true)
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 != nil {
@ -130,6 +124,13 @@ func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
return
}
if authed.Account != nil && 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