11 lines
398 B
TypeScript
11 lines
398 B
TypeScript
import { Notification } from '../../config/schema/actions/types.js';
|
|
|
|
export const summarizeNotification = (notification: Notification): string | null => {
|
|
const text = notification.body?.text ?? notification.heading?.text ?? null;
|
|
if (!text) {
|
|
return null;
|
|
}
|
|
const metadata = notification.metadata?.map((m) => m.text).join(', ');
|
|
return metadata ? `${text} [${metadata}]` : text;
|
|
};
|