Skip to content

Commit

Permalink
🚸 Prevent duplicate user block.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Feb 16, 2020
1 parent 3b039ae commit bf4b975
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/api/user_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,19 @@ class UserAPI {
}

static void fAddToBlacklist(BlacklistUser user) {
NetUtils.postWithCookieSet(API.addToBlacklist, data: {'fid': user.uid}).then((response) {
blacklist.add(user);
showToast('屏蔽成功');
Instances.eventBus.fire(BlacklistUpdateEvent());
unFollow(user.uid).catchError((e) {
debugPrint('Unfollow user failed: $e');
if (blacklist.contains(user)) {
showToast('仇恨值拉满啦!不要重复屏蔽噢~');
} else {
NetUtils.postWithCookieSet(API.addToBlacklist, data: {'fid': user.uid}).then((response) {
blacklist.add(user);
showToast('屏蔽成功');
Instances.eventBus.fire(BlacklistUpdateEvent());
unFollow(user.uid, fromBlacklist: true);
}).catchError((e) {
showToast('屏蔽失败');
debugPrint('Add $user to blacklist failed : $e');
});
}).catchError((e) {
showToast('屏蔽失败');
debugPrint('Add $user to blacklist failed : $e');
});
}
}

static void fRemoveFromBlacklist(BlacklistUser user) {
Expand Down

0 comments on commit bf4b975

Please sign in to comment.