diff --git a/artifacts/api-server/src/routes/service-orders.ts b/artifacts/api-server/src/routes/service-orders.ts index 7a3f2741..035f0ad1 100644 --- a/artifacts/api-server/src/routes/service-orders.ts +++ b/artifacts/api-server/src/routes/service-orders.ts @@ -98,7 +98,10 @@ async function notifyUser( bodyAr: string, bodyEn: string, orderId: number, + actorId?: number, ) { + // Never notify users about actions they themselves initiated. + if (actorId !== undefined && actorId === userId) return; const [notification] = await db .insert(notificationsTable) .values({ @@ -163,6 +166,7 @@ router.post("/orders", requireAuth, async (req, res): Promise => { service.nameAr, service.nameEn, order.id, + userId, ); } await broadcastIncomingChanged(receivers); @@ -252,6 +256,7 @@ router.patch( enriched.service.nameAr, enriched.service.nameEn, orderId, + userId, ); await emitToUser(enriched.userId, "order_updated", enriched); } @@ -339,9 +344,10 @@ router.patch( const enriched = await loadOrder(orderId); - // Notify owner on every status change initiated by a receiver/admin (not by owner cancel) - const initiatedByOwner = existing.userId === userId; - if (!initiatedByOwner && enriched) { + // Notify owner on every status change — notifyUser will skip if the + // owner themselves initiated the action (e.g. owner-cancel, or an + // assignee transition where the owner also holds the receiver role). + if (enriched) { const titleMap: Record = { preparing: ["طلبك قيد التحضير", "Your order is being prepared"], completed: ["تم إكمال طلبك", "Your order is completed"], @@ -362,6 +368,7 @@ router.patch( bodyAr, bodyEn, orderId, + userId, ); } if (enriched) await emitToUser(enriched.userId, "order_updated", enriched); diff --git a/artifacts/teaboy-os/public/opengraph.jpg b/artifacts/teaboy-os/public/opengraph.jpg index 61bf0bf3..70c131e1 100644 Binary files a/artifacts/teaboy-os/public/opengraph.jpg and b/artifacts/teaboy-os/public/opengraph.jpg differ