Files
outline/server/presenters/notification.ts
codegen-sh[bot]andTom Moor 4fc6ac1f15 Add in-app reaction notifications (#9893)
* Add ReactionsCreate notification event type

- Add ReactionsCreate to NotificationEventType enum and defaults
- Add notification settings UI with SmileyIcon and proper labels
- Create ReactionsCreateNotificationsTask to handle comment reactions
- Update NotificationsProcessor to handle comments.add_reaction events
- Add eventText and path handling in client Notification model
- Notifications are enabled by default but never send emails

* Applied automatic fixes

* Show the actual emoji in the notification

* Cleanup notifications if reaction is removed

* PR feedback

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-08-11 18:54:43 -04:00

32 lines
1.0 KiB
TypeScript

import { Notification } from "@server/models";
import { APIContext } from "@server/types";
import presentUser from "./user";
import { presentComment, presentDocument } from ".";
export default async function presentNotification(
ctx: APIContext | undefined,
notification: Notification
) {
return {
id: notification.id,
viewedAt: notification.viewedAt,
archivedAt: notification.archivedAt,
createdAt: notification.createdAt,
event: notification.event,
userId: notification.userId,
actorId: notification.actorId,
actor: notification.actor ? presentUser(notification.actor) : undefined,
commentId: notification.commentId,
comment: notification.comment
? presentComment(notification.comment)
: undefined,
documentId: notification.documentId,
document: notification.document
? await presentDocument(ctx, notification.document)
: undefined,
revisionId: notification.revisionId,
collectionId: notification.collectionId,
data: notification.data,
};
}