Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1e8cd5a

Browse files
author
Sachin Maheshwari
committedMar 19, 2020
logical error in checking exclude group
1 parent 1026ba6 commit 1e8cd5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/common/broadcastAPIHelper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ async function checkUserSkillsAndTracks(userId, bulkMessage, m) {
175175
*/
176176
async function checkUserGroup(userId, bulkMessage, userGroupInfo) {
177177
try {
178+
const excludeGroupSign = '!'
178179
const groups = _.get(bulkMessage, 'recipients.groups')
179180
let flag = false // default
181+
180182
if (groups.length > 0) {
181183
_.map(userGroupInfo, (o) => {
182184
// particular group only condition
@@ -186,13 +188,13 @@ async function checkUserGroup(userId, bulkMessage, userGroupInfo) {
186188
flag = true // default allow for all
187189
let excludeGroups = []
188190
_.map(groups, (g) => {
189-
if (_.startWith(g, '!')) {
191+
if (_.startWith(g, excludeGroupSign)) {
190192
excludeGroups.push(g)
191193
}
192194
})
193195
_.map(userGroupInfo, (o) => {
194196
// not allow if user is part of any private group i.e. excludeGroups
195-
if (_.indexOf(excludeGroups, _.get(o, "name")) >= 0) {
197+
if (_.indexOf(excludeGroups, (excludeGroupSign + _.get(o, "name"))) >= 0) {
196198
flag = false
197199
}
198200
})

0 commit comments

Comments
 (0)
Please sign in to comment.