Skip to content

Commit

Permalink
placeholder user name if null
Browse files Browse the repository at this point in the history
  • Loading branch information
kadamidev committed Oct 23, 2024
1 parent 5930d71 commit 622f51c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion desci-server/src/services/NotificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export const emitNotificationForAnnotation = async (annotationId: number) => {
}

const annotationAuthor = annotation.author;
const annotationAuthorName = annotationAuthor?.name || 'A user';
const node = annotation.node || annotation.attestation?.node;
const nodeOwner = node?.owner;

Expand All @@ -255,7 +256,7 @@ export const emitNotificationForAnnotation = async (annotationId: number) => {
const notificationData: CreateNotificationData = {
userId: nodeOwner.id,
type: NotificationType.COMMENTS,
title: `${annotationAuthor?.name} commented on your research object`,
title: `${annotationAuthorName} commented on your research object`,
message: `Your research object titled ${node.title}, has received a new comment.`, // TODO:: Ideally deserialize some of the message body from the annotation and show a truncated snippet
nodeUuid: node.uuid,
payload: { type: NotificationType.COMMENTS, nodeUuid: dotlessUuid, annotationId } as CommentPayload,
Expand Down

0 comments on commit 622f51c

Please sign in to comment.