Skip to content

Commit

Permalink
Send appropriate notification when verification form got rejected
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Feb 7, 2023
1 parent 0334c3a commit d9dcfc8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/adapters/notifications/MockNotificationAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export class MockNotificationAdapter implements NotificationAdapterInterface {
return Promise.resolve(undefined);
}

verificationFormRejected(params: { project: Project }): Promise<void> {
logger.info('MockNotificationAdapter verificationFormRejected', {
projectSlug: params.project.slug,
});
return Promise.resolve(undefined);
}

donationGetPriceFailed(params: {
project: Project;
donationInfo: { txLink: string; reason: string };
Expand Down
1 change: 1 addition & 0 deletions src/adapters/notifications/NotificationAdapterInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface NotificationAdapterInterface {
projectBadgeRevokeLastWarning(params: { project: Project }): Promise<void>;
projectBadgeUpForRevoking(params: { project: Project }): Promise<void>;
projectUnVerified(params: { project: Project }): Promise<void>;
verificationFormRejected(params: { project: Project }): Promise<void>;

projectListed(params: { project: Project }): Promise<void>;

Expand Down
17 changes: 17 additions & 0 deletions src/adapters/notifications/NotificationCenterAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,23 @@ export class NotificationCenterAdapter implements NotificationAdapterInterface {
});
}

async verificationFormRejected(params: { project: Project }): Promise<void> {
const { project } = params;
const user = project.adminUser as User;
return sendProjectRelatedNotification({
project,
eventName: NOTIFICATIONS_EVENT_NAMES.VERIFICATION_FORM_REJECTED,
sendEmail: true,
segment: {
analyticsUserId: user.segmentUserId(),
anonymousId: user.segmentUserId(),
payload: getSegmentProjectAttributes({
project,
}),
},
});
}

async projectReceivedHeartReaction(params: {
project: Project;
userId: number;
Expand Down
1 change: 1 addition & 0 deletions src/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export enum NOTIFICATIONS_EVENT_NAMES {
PROJECT_REJECTED = 'Project unverified',

PROJECT_UNVERIFIED = 'Project unverified',
VERIFICATION_FORM_REJECTED = 'Form rejected',
PROJECT_UNVERIFIED_USERS_WHO_SUPPORT = 'Project unverified - Users who supported',
PROJECT_ACTIVATED = 'Project activated',
PROJECT_ACTIVATED_USERS_WHO_SUPPORT = 'Project activated - Users who supported',
Expand Down
2 changes: 1 addition & 1 deletion src/server/adminBro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ export const verifySingleVerificationForm = async (
project,
});
} else {
await getNotificationAdapter().projectUnVerified({
await getNotificationAdapter().verificationFormRejected({
project,
});
}
Expand Down

0 comments on commit d9dcfc8

Please sign in to comment.