diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/api/client/accounts/accountmove.go | 2 | ||||
-rw-r--r-- | internal/api/client/accounts/accounts.go | 2 | ||||
-rw-r--r-- | internal/processing/account/move.go | 11 |
3 files changed, 12 insertions, 3 deletions
diff --git a/internal/api/client/accounts/accountmove.go b/internal/api/client/accounts/accountmove.go index 4f311e106..3698c06a3 100644 --- a/internal/api/client/accounts/accountmove.go +++ b/internal/api/client/accounts/accountmove.go @@ -31,8 +31,6 @@ import ( // // Move your account to another account. // -// NOT IMPLEMENTED YET! -// // --- // tags: // - accounts diff --git a/internal/api/client/accounts/accounts.go b/internal/api/client/accounts/accounts.go index 000c27d78..c94fbfbaa 100644 --- a/internal/api/client/accounts/accounts.go +++ b/internal/api/client/accounts/accounts.go @@ -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) } diff --git a/internal/processing/account/move.go b/internal/processing/account/move.go index ca8dd4dea..a68c8f750 100644 --- a/internal/processing/account/move.go +++ b/internal/processing/account/move.go @@ -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) { |