error correction in notifications for already opened tickets
parent
52e63706c1
commit
18d0420949
|
@ -261,31 +261,31 @@ const NotificationsPopOver = () => {
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
user.queues.forEach(queue =>{
|
user.queues.forEach(queue =>{
|
||||||
if(queue.id === notify.data.queue?.id){
|
if(queue.id === notify.data?.queue?.id){
|
||||||
isQueue = true;
|
isQueue = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
if(!isQueue){
|
||||||
if(!isQueue && notify){
|
return;
|
||||||
return;
|
}else {
|
||||||
}else{
|
const notification = new Notification(`${i18n.t("tickets.notification.messagePeding")} ${notify.data?.queue?.name}`);
|
||||||
const notification = new Notification(`${i18n.t("tickets.notification.messagePeding")} ${notify.data.queue?.name}`);
|
notification.onclick = e => {
|
||||||
notification.onclick = e => {
|
e.preventDefault()
|
||||||
e.preventDefault()
|
window.focus()
|
||||||
window.focus()
|
historyRef.current.push(`/tickets`)
|
||||||
historyRef.current.push(`/tickets`)
|
|
||||||
}
|
|
||||||
|
|
||||||
setDesktopNotifications(prevState => {
|
|
||||||
const notfiticationIndex = prevState.findIndex(
|
|
||||||
n => n.tag === notification.tag
|
|
||||||
)
|
|
||||||
if (notfiticationIndex !== -1) {
|
|
||||||
prevState[notfiticationIndex] = notification
|
|
||||||
return [...prevState]
|
|
||||||
}
|
}
|
||||||
return [notification, ...prevState]
|
|
||||||
})
|
setDesktopNotifications(prevState => {
|
||||||
|
const notfiticationIndex = prevState.findIndex(
|
||||||
|
n => n.tag === notification.tag
|
||||||
|
)
|
||||||
|
if (notfiticationIndex !== -1) {
|
||||||
|
prevState[notfiticationIndex] = notification
|
||||||
|
return [...prevState]
|
||||||
|
}
|
||||||
|
return [notification, ...prevState]
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
soundAlertRef.current()
|
soundAlertRef.current()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue