feature/IO-3000-messaging-sockets-migrations2 -
- Conversation Labels Synced - Job Tagging Synced Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -145,7 +145,6 @@ const redisSocketEvents = ({
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
});
|
||||
socket.emit("error", { message: "Failed to join conversation" });
|
||||
}
|
||||
};
|
||||
const leaveConversationRoom = ({ bodyshopId, conversationId }) => {
|
||||
@@ -162,6 +161,24 @@ const redisSocketEvents = ({
|
||||
}
|
||||
};
|
||||
|
||||
const conversationModified = ({ bodyshopId, conversationId, ...fields }) => {
|
||||
try {
|
||||
// Retrieve the room name for the conversation
|
||||
const room = getBodyshopConversationRoom({ bodyshopId, conversationId });
|
||||
// Emit the updated data to all clients in the room
|
||||
io.to(room).emit("conversation-changed", {
|
||||
conversationId,
|
||||
...fields
|
||||
});
|
||||
} catch (error) {
|
||||
logger.log("Failed to handle conversation modification", "error", "io-redis", null, {
|
||||
error: error.message,
|
||||
stack: error.stack
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
socket.on("conversation-modified", conversationModified);
|
||||
socket.on("join-bodyshop-conversation", joinConversationRoom);
|
||||
socket.on("leave-bodyshop-conversation", leaveConversationRoom);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user