summaryrefslogtreecommitdiff
path: root/internal/processing/account
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-06 14:39:40 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-06 14:39:40 +0200
commit8ae2440da3a9b66c379c5a9444b50e758deef61b (patch)
tree06b3ba58208434f6ddbd198a396159ac2c4d9c80 /internal/processing/account
parent[feature] Allow deleting avatar + header via settings panel (#3970) (diff)
downloadgotosocial-8ae2440da3a9b66c379c5a9444b50e758deef61b.tar.xz
[chore] Migrate accounts to new table, relax uniqueness constraint of actor `url` and collections (#3928)
* [chore] Migrate accounts to new table, relax uniqueness constraint of actor url and collections * fiddle with it! (that's what she said) * remove unused cache fields * sillyness * fix tiny whoopsie
Diffstat (limited to 'internal/processing/account')
-rw-r--r--internal/processing/account/alias.go5
-rw-r--r--internal/processing/account/delete.go4
-rw-r--r--internal/processing/account/delete_test.go2
-rw-r--r--internal/processing/account/get.go3
-rw-r--r--internal/processing/account/move.go6
-rw-r--r--internal/processing/account/update.go4
6 files changed, 18 insertions, 6 deletions
diff --git a/internal/processing/account/alias.go b/internal/processing/account/alias.go
index d7d4cf547..ca27a518c 100644
--- a/internal/processing/account/alias.go
+++ b/internal/processing/account/alias.go
@@ -107,9 +107,14 @@ func (p *Processor) Alias(
}
// Ensure we have account dereferenced.
+ //
+ // As this comes from user input, allow checking
+ // by URL to make things easier, not just to an
+ // exact AP URI (which a user might not even know).
targetAccount, _, err := p.federator.GetAccountByURI(ctx,
account.Username,
newAKA.uri,
+ true,
)
if err != nil {
err := fmt.Errorf(
diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go
index ab64c3270..2d3ef88de 100644
--- a/internal/processing/account/delete.go
+++ b/internal/processing/account/delete.go
@@ -528,7 +528,7 @@ func stubbifyAccount(account *gtsmodel.Account, origin string) []string {
account.Fields = nil
account.Note = ""
account.NoteRaw = ""
- account.Memorial = util.Ptr(false)
+ account.MemorializedAt = never
account.AlsoKnownAsURIs = nil
account.MovedToURI = ""
account.Discoverable = util.Ptr(false)
@@ -546,7 +546,7 @@ func stubbifyAccount(account *gtsmodel.Account, origin string) []string {
"fields",
"note",
"note_raw",
- "memorial",
+ "memorialized_at",
"also_known_as_uris",
"moved_to_uri",
"discoverable",
diff --git a/internal/processing/account/delete_test.go b/internal/processing/account/delete_test.go
index ee6fe1dfc..587071a11 100644
--- a/internal/processing/account/delete_test.go
+++ b/internal/processing/account/delete_test.go
@@ -64,7 +64,7 @@ func (suite *AccountDeleteTestSuite) TestAccountDeleteLocal() {
suite.Nil(updatedAccount.Fields)
suite.Zero(updatedAccount.Note)
suite.Zero(updatedAccount.NoteRaw)
- suite.False(*updatedAccount.Memorial)
+ suite.Zero(updatedAccount.MemorializedAt)
suite.Empty(updatedAccount.AlsoKnownAsURIs)
suite.False(*updatedAccount.Discoverable)
suite.WithinDuration(time.Now(), updatedAccount.SuspendedAt, 1*time.Minute)
diff --git a/internal/processing/account/get.go b/internal/processing/account/get.go
index eac0f0c3f..33eb4c101 100644
--- a/internal/processing/account/get.go
+++ b/internal/processing/account/get.go
@@ -66,10 +66,13 @@ func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account
// Perform a last-minute fetch of target account to
// ensure remote account header / avatar is cached.
+ //
+ // Match by URI only.
latest, _, err := p.federator.GetAccountByURI(
gtscontext.SetFastFail(ctx),
requestingAccount.Username,
targetAccountURI,
+ false,
)
if err != nil {
log.Errorf(ctx, "error fetching latest target account: %v", err)
diff --git a/internal/processing/account/move.go b/internal/processing/account/move.go
index 1c5209e70..c8665cf04 100644
--- a/internal/processing/account/move.go
+++ b/internal/processing/account/move.go
@@ -119,11 +119,15 @@ func (p *Processor) MoveSelf(
unlock := p.state.ProcessingLocks.Lock(lockKey)
defer unlock()
- // Ensure we have a valid, up-to-date representation of the target account.
+ // Ensure we have a valid, up-to-date
+ // representation of the target account.
+ //
+ // Match by uri only.
targetAcct, targetAcctable, err = p.federator.GetAccountByURI(
ctx,
originAcct.Username,
targetAcctURI,
+ false,
)
if err != nil {
const text = "error dereferencing moved_to_uri"
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go
index a833d72c1..60d2cb8f6 100644
--- a/internal/processing/account/update.go
+++ b/internal/processing/account/update.go
@@ -78,8 +78,8 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
}
if form.Bot != nil {
- account.Bot = form.Bot
- acctColumns = append(acctColumns, "bot")
+ account.ActorType = gtsmodel.AccountActorTypeService
+ acctColumns = append(acctColumns, "actor_type")
}
if form.Locked != nil {