[chore] Expose move endpoint again, small settings panel fixes (#2752)

This commit is contained in:
tobi 2024-03-13 14:45:50 +01:00 committed by GitHub
commit 92bf1f779b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 49 deletions

View file

@ -31,8 +31,6 @@ import (
//
// Move your account to another account.
//
// NOT IMPLEMENTED YET!
//
// ---
// tags:
// - accounts

View file

@ -113,5 +113,5 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H
// migration handlers
attachHandler(http.MethodPost, AliasPath, m.AccountAliasPOSTHandler)
// attachHandler(http.MethodPost, MovePath, m.AccountMovePOSTHandler) // todo: enable this only when Move is completed
attachHandler(http.MethodPost, MovePath, m.AccountMovePOSTHandler)
}

View file

@ -154,6 +154,17 @@ func (p *Processor) MoveSelf(
}
}
// If originAcct has already moved, ensure
// this move reattempt is to the same account.
if originAcct.IsMoving() &&
originAcct.MovedToURI != targetAcct.URI {
err := fmt.Errorf(
"your account is already Moving or has Moved to %s; you cannot also Move to %s",
originAcct.MovedToURI, targetAcct.URI,
)
return gtserror.NewErrorUnprocessableEntity(err, err.Error())
}
// Target account MUST be aliased to this
// account for this to be a valid Move.
if !slices.Contains(targetAcct.AlsoKnownAsURIs, originAcct.URI) {