Skip to content

Commit 75ff36e

Browse files
author
Sachin Maheshwari
committed
changes in public group logic so that only some groups should not get public messasge as per slack discussion - https://app.slack.com/client/T03R80JP7/CG2J9RH70/thread/CG2J9RH70-1583899598.019100
1 parent 8d42c73 commit 75ff36e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/common/broadcastAPIHelper.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,17 @@ async function checkUserGroup(userId, bulkMessage, userGroupInfo) {
184184
})
185185
} else { // no group condition means its for `public` no private group
186186
flag = true // default allow for all
187+
let excludeGroups = []
188+
_.map(groups, (g) => {
189+
if (_.startWith(g, '!')) {
190+
excludeGroups.push(g)
191+
}
192+
})
187193
_.map(userGroupInfo, (o) => {
188-
// not allow if user is part of any private group
189-
flag = (_.get(o, "privateGroup")) ? false : flag
194+
// not allow if user is part of any private group i.e. excludeGroups
195+
if (_.indexOf(excludeGroups, _.get(o, "name"))) {
196+
flag = false
197+
}
190198
})
191199
logger.info(`public group condition for userId ${userId}` +
192200
` and BC messageId ${bulkMessage.id}, the result is: ${flag}`)

0 commit comments

Comments
 (0)