From 70129ba02bb2c88adec5dd8e3b0e2f5af76b21d8 Mon Sep 17 00:00:00 2001 From: olorin99 Date: Wed, 4 Feb 2026 13:43:03 +1000 Subject: [PATCH] Add helper to invalidate oauth identifiers and include in 1->2 database migration. --- lib/src/controller/controller.dart | 2 +- lib/src/controller/database/database.dart | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/controller/controller.dart b/lib/src/controller/controller.dart index 71174291..b9908895 100644 --- a/lib/src/controller/controller.dart +++ b/lib/src/controller/controller.dart @@ -655,7 +655,7 @@ class AppController with ChangeNotifier { case ServerSoftware.mbin: oauth2.Credentials? credentials = _accounts[account]?.oauth; if (credentials != null) { - String identifier = _servers[instance]!.oauthIdentifier!; + final identifier = _servers[instance]!.oauthIdentifier; httpClient = oauth2.Client( credentials, identifier: identifier, diff --git a/lib/src/controller/database/database.dart b/lib/src/controller/database/database.dart index 1134ee34..2ead21c7 100644 --- a/lib/src/controller/database/database.dart +++ b/lib/src/controller/database/database.dart @@ -450,6 +450,7 @@ class InterstellarDatabase extends _$InterstellarDatabase { schema.profiles, schema.profiles.hideEmojiReactions, ); + await invalidateOauth(); }, ), ); @@ -477,6 +478,12 @@ class InterstellarDatabase extends _$InterstellarDatabase { ), ); } + + Future invalidateOauth() async { + await (update(servers) + ..where((f) => f.oauthIdentifier.isNotNull())) + .write(ServersCompanion(oauthIdentifier: Value(null))); + } } late InterstellarDatabase database;