feat(moderation): add real-time status updates via WebSocket
Broadcast moderation status changes to the author via WebSocket Update UI in real-time for Life Posts, Comments, and Discussions Hide retry moderation button while status is reviewing
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
import {
|
||||
api,
|
||||
getAuthToken,
|
||||
moderationUpdateEvent,
|
||||
notificationWebSocketUrl,
|
||||
type AuthUser,
|
||||
type LifeReactionType,
|
||||
@@ -140,9 +141,13 @@ async function connectNotifications() {
|
||||
return;
|
||||
}
|
||||
|
||||
unreadCount.value = message.unreadCount;
|
||||
if ('unreadCount' in message) {
|
||||
unreadCount.value = message.unreadCount;
|
||||
}
|
||||
if (message.type === 'notifications.created') {
|
||||
upsertNotification(message.notification);
|
||||
} else if (message.type === 'moderation.updated') {
|
||||
window.dispatchEvent(new CustomEvent(moderationUpdateEvent, { detail: message }));
|
||||
}
|
||||
} catch {
|
||||
// Invalid socket payloads are ignored.
|
||||
|
||||
Reference in New Issue
Block a user