Skip to content

Commit

Permalink
fix: 別アカウントで開いたときに異なるアカウントで表示されてしまうのを修正の再修正
Browse files Browse the repository at this point in the history
  • Loading branch information
4ster1sk committed Dec 12, 2024
1 parent 3605a7a commit 991ee25
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
8 changes: 7 additions & 1 deletion lib/router/app_router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class MisskeyNoteNotifier extends _$MisskeyNoteNotifier {
await navigateToNoteDetailPage(note, account: selectedAccount);
}

Future<void> openUserInOtherAccount(User user) async {
Future<void> openUserInOtherAccount(User user, String? host) async {
final accountContext = ref.read(accountContextProvider);
final selectedAccount = await ref.read(appRouterProvider).push<Account>(
AccountSelectRoute(
Expand All @@ -206,16 +206,16 @@ class MisskeyNoteNotifier extends _$MisskeyNoteNotifier {
if (user.host == null) {
switch (user) {
case UserLite():
user = user.copyWith(host: accountContext.getAccount.host);
user = user.copyWith(host: host ?? accountContext.getAccount.host);

case UserDetailedNotMe():
user = user.copyWith(host: accountContext.getAccount.host);
user = user.copyWith(host: host ?? accountContext.getAccount.host);

case UserDetailedNotMeWithRelations():
user = user.copyWith(host: accountContext.getAccount.host);
user = user.copyWith(host: host ?? accountContext.getAccount.host);

case MeDetailed():
user = user.copyWith(host: accountContext.getAccount.host);
user = user.copyWith(host: host ?? accountContext.getAccount.host);
}
}
await navigateToUserPage(user, account: selectedAccount);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/view/note_modal_sheet/note_modal_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class NoteModalSheet extends ConsumerWidget implements AutoRouteWrapper {
UserControlRoute(
account: accountContext.postAccount,
response: value,
host: ref.read(misskeyGetContextProvider).host,
),
);
case null:
Expand Down
2 changes: 1 addition & 1 deletion lib/view/note_modal_sheet/note_modal_sheet.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/view/user_page/user_control_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ enum UserControl {
class UserControlDialog extends HookConsumerWidget implements AutoRouteWrapper {
final Account account;
final UserDetailed response;
final String? host;

const UserControlDialog({
required this.account,
required this.response,
this.host,
super.key,
});

Expand Down Expand Up @@ -105,7 +107,7 @@ class UserControlDialog extends HookConsumerWidget implements AutoRouteWrapper {
final openUserInOtherAccount = useAsync(
() async => ref
.read(misskeyNoteNotifierProvider.notifier)
.openUserInOtherAccount(response),
.openUserInOtherAccount(response, host),
);

final isLoading = [
Expand Down
1 change: 1 addition & 0 deletions lib/view/user_page/user_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class UserDetail extends ConsumerWidget {
UserControlRoute(
account: ref.read(accountContextProvider).postAccount,
response: response,
host: ref.read(misskeyGetContextProvider).host,
),
),
icon: const Icon(Icons.more_vert),
Expand Down

0 comments on commit 991ee25

Please sign in to comment.