Skip to content

Commit bd639bb

Browse files
authored
chore: just safer until we launch (#3186)
1 parent 05a1094 commit bd639bb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

__tests__/workers/notifications/warmIntroNotification.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DataSource } from 'typeorm';
22
import { warmIntroNotification as worker } from '../../../src/workers/notifications/warmIntroNotification';
33
import createOrGetConnection from '../../../src/db';
44

5-
import { Organization, User } from '../../../src/entity';
5+
import { Feature, FeatureType, Organization, User } from '../../../src/entity';
66
import { OpportunityJob } from '../../../src/entity/opportunities/OpportunityJob';
77
import { OpportunityUser } from '../../../src/entity/opportunities/user';
88
import { OpportunityUserType } from '../../../src/entity/opportunities/types';
@@ -24,6 +24,11 @@ describe('warmIntroNotification worker', () => {
2424
beforeEach(async () => {
2525
jest.resetAllMocks();
2626
await saveFixtures(con, User, usersFixture);
27+
await con.getRepository(Feature).insert({
28+
userId: '1',
29+
feature: FeatureType.Team,
30+
value: 1,
31+
});
2732
});
2833

2934
it('should be registered', () => {

src/workers/notifications/warmIntroNotification.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { logger } from '../../logger';
44
import { OpportunityJob } from '../../entity/opportunities/OpportunityJob';
55
import { OpportunityUserType } from '../../entity/opportunities/types';
66
import { WarmIntro } from '@dailydotdev/schema';
7+
import { Feature, FeatureType } from '../../entity';
78

89
export const warmIntroNotification: TypedNotificationWorker<'gondul.v1.warm-intro-generated'> =
910
{
@@ -24,6 +25,18 @@ export const warmIntroNotification: TypedNotificationWorker<'gondul.v1.warm-intr
2425
return;
2526
}
2627

28+
// TODO: Temporary until we happy to launch
29+
const isTeamMember = await con.getRepository(Feature).exists({
30+
where: {
31+
userId,
32+
feature: FeatureType.Team,
33+
value: 1,
34+
},
35+
});
36+
if (!isTeamMember) {
37+
return;
38+
}
39+
2740
const organization = await opportunity.organization;
2841
const users = await opportunity.users;
2942

0 commit comments

Comments
 (0)