Skip to content

Commit

Permalink
fix: rejection reason note (#2480)
Browse files Browse the repository at this point in the history
Rejection notification should now add the message.
  • Loading branch information
sshanzel authored Nov 22, 2024
1 parent 7734a9a commit 88a123a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions __tests__/notifications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,8 @@ describe('storeNotificationBundle', () => {
sourceId: 'a',
createdById: '2',
status: SourcePostModerationStatus.Rejected,
rejectionReason: 'Other',
moderatorMessage: 'Lacks value.',
});
const type = NotificationType.SourcePostRejected;
const ctx: NotificationPostModerationContext = {
Expand All @@ -1343,9 +1345,9 @@ describe('storeNotificationBundle', () => {
expect(actual.notification.referenceId).toEqual(post.id);
expect(actual.notification.referenceType).toEqual('post_moderation');
expect(actual.notification.title).toEqual(
'Your post in A was not approved for the following reason: null. Please review the feedback and consider making changes before resubmitting.',
'Your post in A was not approved for the following reason: Other. Please review the feedback and consider making changes before resubmitting.',
);
expect(actual.notification.description).toBeFalsy();
expect(actual.notification.description).toEqual('Lacks value.');
expect(actual.notification.targetUrl).toEqual(
'http://localhost:5002/squads/a/moderate',
);
Expand Down
1 change: 1 addition & 0 deletions src/notifications/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const generateNotificationMap: Record<
.icon(NotificationIcon.Bell)
.referencePostModeration(ctx.post)
.targetSourceModeration(ctx.source)
.description(ctx.post.moderatorMessage ?? '')
.avatarSource(ctx.source),
source_post_submitted: (builder, ctx: NotificationPostModerationContext) =>
builder
Expand Down

0 comments on commit 88a123a

Please sign in to comment.