Skip to content

Commit 9ce0c85

Browse files
committed
refactor: simplify email domain extraction in activity service
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 5e609a6 commit 9ce0c85

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

services/apps/data_sink_worker/src/service/activity.service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,14 +1508,11 @@ export default class ActivityService extends LoggerBase {
15081508
if (!isBot) {
15091509
// Trust the email the activity arrived with (username only).
15101510
// Public inbox domains (gmail, etc.) don't identify an org, so they're skipped.
1511-
const activityEmailDomain = isValidEmail(payload.activity.username)
1511+
const domain = isValidEmail(payload.activity.username)
15121512
? payload.activity.username.split('@')[1]?.toLowerCase()
15131513
: undefined
15141514

1515-
const affiliationEmailDomain =
1516-
activityEmailDomain && !isDomainExcluded(activityEmailDomain)
1517-
? activityEmailDomain
1518-
: undefined
1515+
const affiliationEmailDomain = domain && !isDomainExcluded(domain) ? domain : undefined
15191516

15201517
// associate activity with organization
15211518
payload.organizationId = await this.commonMemberService.findAffiliation(

0 commit comments

Comments
 (0)