Skip to content

Commit

Permalink
添加好友时,只检查对方的黑名单状态
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyrian2012 committed May 27, 2023
1 parent 26fbde6 commit 252204a
Showing 1 changed file with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3101,27 +3101,16 @@ public ErrorCode saveAddFriendRequest(String userId, WFCMessage.AddFriendRequest
}
}

MultiMap<String, FriendData> friendsMap = hzInstance.getMultiMap(USER_FRIENDS);

FriendData friendData1 = null;
Collection<FriendData> friendDatas = friendsMap.get(userId);
if (friendDatas == null || friendDatas.size() == 0) {
friendDatas = loadFriend(friendsMap, userId);
}
for (FriendData fd : friendDatas) {
if (fd.getFriendUid().equals(request.getTargetUid())) {
friendData1 = fd;
break;
}
}
if (friendData1 != null && friendData1.getBlacked() > 0 && !isAdmin) {
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
}

FriendData friendData1 = getFriendData(userId, request.getTargetUid());
if (friendData1 != null && friendData1.getState() == 0) {
return ErrorCode.ERROR_CODE_ALREADY_FRIENDS;
}

FriendData friendData2 = getFriendData(request.getTargetUid(), userId);
if (friendData2 != null && friendData2.getBlacked() > 0 && !isAdmin) {
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
}

WFCMessage.FriendRequest newRequest = WFCMessage.FriendRequest
.newBuilder()
.setFromUid(userId)
Expand Down

0 comments on commit 252204a

Please sign in to comment.