From 41d99d5108132ba3cb0f1acb9c1fb83e44b64d64 Mon Sep 17 00:00:00 2001 From: 21pages Date: Tue, 2 Apr 2024 23:18:52 +0800 Subject: [PATCH] fix forget password toast error when personal ab doesn't contain this id (#7589) Signed-off-by: 21pages --- flutter/lib/common/widgets/peer_card.dart | 6 ++++-- flutter/lib/models/ab_model.dart | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flutter/lib/common/widgets/peer_card.dart b/flutter/lib/common/widgets/peer_card.dart index d1aede0b6..dff81e6a3 100644 --- a/flutter/lib/common/widgets/peer_card.dart +++ b/flutter/lib/common/widgets/peer_card.dart @@ -750,8 +750,10 @@ abstract class BasePeerCard extends StatelessWidget { if (succ) { showToast(translate('Successful')); } else { - BotToast.showText( - contentColor: Colors.red, text: translate("Failed")); + if (tab.index == PeerTabIndex.ab.index) { + BotToast.showText( + contentColor: Colors.red, text: translate("Failed")); + } } }, padding: menuPadding, diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dart index 4f3a04a14..b166817c5 100644 --- a/flutter/lib/models/ab_model.dart +++ b/flutter/lib/models/ab_model.dart @@ -1490,7 +1490,7 @@ class Ab extends BaseAb { @override Future changePersonalHashPassword(String id, String hash) async { if (!personal) return false; - if (!peers.any((e) => e.id == id)) return false; + if (!peers.any((e) => e.id == id)) return true; return await _setPassword({"id": id, "hash": hash}); }