fix(dm): add error handling and logging to DM push notifications
This commit is contained in:
parent
3a4e1ecfba
commit
e0b4d9f530
@ -61,16 +61,22 @@ export async function sendDirectMessage(
|
||||
|
||||
// Push-Notification (fire-and-forget — blockt Response nicht)
|
||||
void (async () => {
|
||||
try {
|
||||
const { sendChatPush, getDisplayName, truncatePreview } = await import(
|
||||
"../services/push"
|
||||
);
|
||||
const senderName = await getDisplayName(senderId);
|
||||
const preview = truncatePreview(content || (opts?.attachmentUrl ? "📎 Anhang" : ""));
|
||||
console.log(`[dm-push] sender=${senderId} receiver=${receiverId} preview="${preview.slice(0, 30)}"`);
|
||||
await sendChatPush({
|
||||
receiverId,
|
||||
senderName,
|
||||
preview: truncatePreview(content || (opts?.attachmentUrl ? "📎 Anhang" : "")),
|
||||
preview,
|
||||
data: { type: "dm", targetId: senderId, messageId: msg.id },
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("[dm-push] failed:", err);
|
||||
}
|
||||
})();
|
||||
|
||||
return msg;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user