Compare commits

..

No commits in common. "435a577bedabba86cda50b31d1230a17208d4fd1" and "3ced558b184dee55df92be88d35086536dce4386" have entirely different histories.

2 changed files with 4 additions and 9 deletions

View File

@ -451,16 +451,15 @@ const MessagesList = ({ ticketId, isGroup }) => {
socket.on("connect", onConnectMessagesList) socket.on("connect", onConnectMessagesList)
const onAppMessageMessagesList = (data) => { const onAppMessageMessagesList = (data) => {
if (+data.message.ticketId !== +ticketId) return
if (data.action === "create") { if (data.action === "create" && data.ticket.id == ticketId) {
dispatch({ type: "ADD_MESSAGE", payload: data.message }) dispatch({ type: "ADD_MESSAGE", payload: data.message })
scrollToBottom() scrollToBottom()
} }
if (data.action === "update") { if (data.action === "update" && data.ticket.id == ticketId) {
dispatch({ type: "UPDATE_MESSAGE", payload: data.message }) dispatch({ type: "UPDATE_MESSAGE", payload: data.message })
} }
} }

View File

@ -143,15 +143,11 @@ const Ticket = () => {
socket.on("connect", onConnectTicket) socket.on("connect", onConnectTicket)
const onTicketTicket = (data) => { const onTicketTicket = (data) => {
const isSameTicket = +data?.ticket?.id === +ticketId || +data.ticketId === +ticketId if (data.action === "update" && data.ticket.id == ticketId) {
if (!isSameTicket) return
if (data.action === "update") {
setTicket(data.ticket) setTicket(data.ticket)
} }
if (data.action === "deleteForever") { if (data.action === "delete") {
console.log('delete forever')
toast.success("Ticket deleted sucessfully.") toast.success("Ticket deleted sucessfully.")
history.push("/tickets") history.push("/tickets")
} }