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)
|
// Push-Notification (fire-and-forget — blockt Response nicht)
|
||||||
void (async () => {
|
void (async () => {
|
||||||
const { sendChatPush, getDisplayName, truncatePreview } = await import(
|
try {
|
||||||
"../services/push"
|
const { sendChatPush, getDisplayName, truncatePreview } = await import(
|
||||||
);
|
"../services/push"
|
||||||
const senderName = await getDisplayName(senderId);
|
);
|
||||||
await sendChatPush({
|
const senderName = await getDisplayName(senderId);
|
||||||
receiverId,
|
const preview = truncatePreview(content || (opts?.attachmentUrl ? "📎 Anhang" : ""));
|
||||||
senderName,
|
console.log(`[dm-push] sender=${senderId} receiver=${receiverId} preview="${preview.slice(0, 30)}"`);
|
||||||
preview: truncatePreview(content || (opts?.attachmentUrl ? "📎 Anhang" : "")),
|
await sendChatPush({
|
||||||
data: { type: "dm", targetId: senderId, messageId: msg.id },
|
receiverId,
|
||||||
});
|
senderName,
|
||||||
|
preview,
|
||||||
|
data: { type: "dm", targetId: senderId, messageId: msg.id },
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error("[dm-push] failed:", err);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user