summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-04-30 11:17:20 +0000
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-04-30 11:17:20 +0000
commitac01652de9eef36c3576524f791bd844c6016de8 (patch)
tree06dbb45975f5ac52c0eebaa64d6c5b824896eabb /internal
parent[bugfix] Fix nil ptr exception on creating user without running server first ... (diff)
downloadgotosocial-ac01652de9eef36c3576524f791bd844c6016de8.tar.xz
[bugfix] Fix migration unsetting bot flag (#4098)
Fixes an issue in the migration where bot actor type was being incorrectly set to Person. Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4086 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4098 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go b/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
index 6e753b569..7be070bee 100644
--- a/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
+++ b/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
@@ -28,6 +28,7 @@ import (
new_gtsmodel "code.superseriousbusiness.org/gotosocial/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness/new"
old_gtsmodel "code.superseriousbusiness.org/gotosocial/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness/old"
"code.superseriousbusiness.org/gotosocial/internal/log"
+ "code.superseriousbusiness.org/gotosocial/internal/util"
"github.com/uptrace/bun"
"github.com/uptrace/bun/dialect"
@@ -188,13 +189,27 @@ func init() {
for _, oldAccount := range oldAccounts {
var actorType new_gtsmodel.AccountActorType
- if oldAccount.Domain == "" && oldAccount.Username == host {
+ switch {
+
+ case oldAccount.Domain != "":
+ // Not our account, just parse new actor type.
+ actorType = new_gtsmodel.ParseAccountActorType(oldAccount.ActorType)
+
+ case oldAccount.Username == host:
// This is our instance account, override actor
// type to Service, as previously it was just person.
actorType = new_gtsmodel.AccountActorTypeService
- } else {
- // Not our instance account, just parse new actor type.
- actorType = new_gtsmodel.ParseAccountActorType(oldAccount.ActorType)
+
+ default:
+ // Not our instance account. Use old
+ // *Bot flag to determine actor type.
+ if util.PtrOrZero(oldAccount.Bot) {
+ // It's a bot.
+ actorType = new_gtsmodel.AccountActorTypeApplication
+ } else {
+ // Just normal men, just innocent men.
+ actorType = new_gtsmodel.AccountActorTypePerson
+ }
}
if actorType == new_gtsmodel.AccountActorTypeUnknown {