From f8a4b14a96c41d01e2e8c8059651bfa9a45f2a54 Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 11 Jan 2026 22:45:06 +0100 Subject: [PATCH] notifications big --- components/notification-badge.tsx | 12 +++++++++-- .../notifications/rocketchat-adapter.ts | 21 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/components/notification-badge.tsx b/components/notification-badge.tsx index dbf4aea..230cdfa 100644 --- a/components/notification-badge.tsx +++ b/components/notification-badge.tsx @@ -1,6 +1,6 @@ import React, { memo, useState, useEffect } from 'react'; import Link from 'next/link'; -import { Bell, Check, ExternalLink, AlertCircle, LogIn, Kanban } from 'lucide-react'; +import { Bell, Check, ExternalLink, AlertCircle, LogIn, Kanban, MessageSquare } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { useNotifications } from '@/hooks/use-notifications'; import { Button } from '@/components/ui/button'; @@ -209,12 +209,20 @@ export const NotificationBadge = memo(function NotificationBadge({ className }: Agilité )} + {notification.source === 'rocketchat' && ( + + + Parole + + )}

{formatDistanceToNow(new Date(notification.timestamp), { addSuffix: true })} {notification.source && ( - • {notification.source === 'leantime' ? 'Leantime' : notification.source} + • {notification.source === 'leantime' ? 'Leantime' : + notification.source === 'rocketchat' ? 'Parole' : + notification.source} )}

diff --git a/lib/services/notifications/rocketchat-adapter.ts b/lib/services/notifications/rocketchat-adapter.ts index 24e1c2d..5ad11b5 100644 --- a/lib/services/notifications/rocketchat-adapter.ts +++ b/lib/services/notifications/rocketchat-adapter.ts @@ -454,22 +454,33 @@ export class RocketChatAdapter implements NotificationAdapter { if (subscription.t === 'd') roomTypePath = 'direct'; else if (subscription.t === 'p') roomTypePath = 'group'; + // Format title similar to Leantime (simple and consistent) + const title = subscription.t === 'd' + ? 'Message' + : subscription.t === 'p' + ? 'Message de groupe' + : 'Message de canal'; + + // Format message with sender and room info + const senderName = messageUser.name || messageUser.username || 'Utilisateur'; + const formattedMessage = subscription.t === 'd' + ? `${senderName}: ${latestMessage.msg || ''}` + : `${senderName} dans ${roomName}: ${latestMessage.msg || ''}`; + const notification: Notification = { id: `rocketchat-${latestMessage._id}`, source: 'rocketchat', sourceId: latestMessage._id, type: 'message', - title: subscription.t === 'd' - ? `Message de ${messageUser.name || messageUser.username || 'Utilisateur'}` - : `${messageUser.name || messageUser.username || 'Utilisateur'} dans ${roomName}`, - message: latestMessage.msg || '', + title: title, + message: formattedMessage, link: `${this.baseUrl}/${roomTypePath}/${subscription.name}`, isRead: false, // All messages here are unread timestamp: new Date(latestMessage.ts), priority: subscription.alert ? 'high' : 'normal', user: { id: messageUser._id || '', - name: messageUser.name || messageUser.username || 'Utilisateur', + name: senderName, }, metadata: { roomId: subscription.rid,