fix chat notifications
This commit is contained in:
parent
f030328cd1
commit
a659063fc2
2 changed files with 4 additions and 6 deletions
|
|
@ -11,13 +11,14 @@ export const maybeShowChatNotification = (chat) => {
|
||||||
title: chat.account.name,
|
title: chat.account.name,
|
||||||
icon: chat.account.profile_image_url,
|
icon: chat.account.profile_image_url,
|
||||||
body: chat.lastMessage.content,
|
body: chat.lastMessage.content,
|
||||||
|
type: 'chatMention',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chat.lastMessage.attachment?.type === 'image') {
|
if (chat.lastMessage.attachment?.type === 'image') {
|
||||||
opts.image = chat.lastMessage.attachment.preview_url
|
opts.image = chat.lastMessage.attachment.preview_url
|
||||||
}
|
}
|
||||||
|
|
||||||
showDesktopNotification(window.vuex.state, opts)
|
showDesktopNotification(opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildFakeMessage = ({
|
export const buildFakeMessage = ({
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,6 @@ export const useChatsStore = defineStore('chats', {
|
||||||
chat.lastMessage = updatedChat.lastMessage
|
chat.lastMessage = updatedChat.lastMessage
|
||||||
chat.unread = updatedChat.unread
|
chat.unread = updatedChat.unread
|
||||||
chat.updated_at = updatedChat.updated_at
|
chat.updated_at = updatedChat.updated_at
|
||||||
if (isNewMessage && chat.unread) {
|
|
||||||
maybeShowChatNotification(chat)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.chatList.data.push(updatedChat)
|
this.chatList.data.push(updatedChat)
|
||||||
this.chatList.idStore[updatedChat.id] = updatedChat
|
this.chatList.idStore[updatedChat.id] = updatedChat
|
||||||
|
|
@ -107,10 +104,10 @@ export const useChatsStore = defineStore('chats', {
|
||||||
chat.lastMessage = updatedChat.lastMessage
|
chat.lastMessage = updatedChat.lastMessage
|
||||||
chat.unread = updatedChat.unread
|
chat.unread = updatedChat.unread
|
||||||
chat.updated_at = updatedChat.updated_at
|
chat.updated_at = updatedChat.updated_at
|
||||||
}
|
} else {
|
||||||
if (!chat) {
|
|
||||||
this.chatList.data.unshift(updatedChat)
|
this.chatList.data.unshift(updatedChat)
|
||||||
}
|
}
|
||||||
|
maybeShowChatNotification(chat)
|
||||||
this.chatList.idStore[updatedChat.id] = updatedChat
|
this.chatList.idStore[updatedChat.id] = updatedChat
|
||||||
},
|
},
|
||||||
deleteChat(id) {
|
deleteChat(id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue