Skip to content

Commit

Permalink
🔨 fix(alarm) : 차단 양방향 차단 단방향 차집합으로 알림 보낼 유저 정의
Browse files Browse the repository at this point in the history
  • Loading branch information
ImNM committed Jun 18, 2022
1 parent 8d6ffb9 commit 71fb858
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/apis/alarm/pushAlarm.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ export class PushAlarmProcessor {
return;
}

if (!userInfo) {
return;
}

// 차집합

const sendToOnlyBlockedUser = userInfo.blockedUsers.filter(
(x) => !userInfo.iBlockUsers.find((user) => user._id.equals(x._id)),
);

const userFcmInfoList = room.userList
? (room.userList as unknown as UserFcmInfoDto[])
: [];
Expand All @@ -100,7 +110,7 @@ export class PushAlarmProcessor {

const TokenArray = roomNameAndUserAlarmInfoArray.userFcmInfoList
.filter((e) => {
const checkIfIBlockUser = userInfo?.iBlockUsers.find((user) =>
const checkIfIBlockUser = sendToOnlyBlockedUser.find((user) =>
user._id.equals(e._id),
)
? false
Expand Down

0 comments on commit 71fb858

Please sign in to comment.