migrate chats module to pinia
This commit is contained in:
parent
6dead855d5
commit
5bc802932e
21 changed files with 192 additions and 198 deletions
|
|
@ -1,10 +1,8 @@
|
|||
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
||||
|
||||
export const maybeShowChatNotification = (store, chat) => {
|
||||
export const maybeShowChatNotification = (chat) => {
|
||||
if (!chat.lastMessage) return
|
||||
if (store.rootState.chats.currentChatId === chat.id && !document.hidden)
|
||||
return
|
||||
if (store.rootState.users.currentUser.id === chat.lastMessage.account_id)
|
||||
if (window.vuex.state.users.currentUser.id === chat.lastMessage.account_id)
|
||||
return
|
||||
|
||||
const opts = {
|
||||
|
|
@ -21,7 +19,7 @@ export const maybeShowChatNotification = (store, chat) => {
|
|||
opts.image = chat.lastMessage.attachment.preview_url
|
||||
}
|
||||
|
||||
showDesktopNotification(store.rootState, opts)
|
||||
showDesktopNotification(window.vuex.state, opts)
|
||||
}
|
||||
|
||||
export const buildFakeMessage = ({
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||
export const countExtraNotifications = (
|
||||
store,
|
||||
mergedConfig,
|
||||
unreadChatsCount,
|
||||
unreadAnnouncementCount,
|
||||
) => {
|
||||
const rootGetters = store.rootGetters || store.getters
|
||||
|
|
@ -200,9 +201,7 @@ export const countExtraNotifications = (
|
|||
}
|
||||
|
||||
return [
|
||||
mergedConfig.showChatsInExtraNotifications
|
||||
? rootGetters.unreadChatCount
|
||||
: 0,
|
||||
mergedConfig.showChatsInExtraNotifications ? unreadChatsCount : 0,
|
||||
mergedConfig.showAnnouncementsInExtraNotifications
|
||||
? unreadAnnouncementCount
|
||||
: 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue