mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-13 19:42:01 +00:00
almost fixed the notification bug.
This commit is contained in:
parent
93db6eeb09
commit
fca8fa7f7f
3 changed files with 19 additions and 2 deletions
|
|
@ -48,7 +48,8 @@ const mutations = {
|
|||
Vue.set(state.channels[channelID], "lastMessaged", Date.now());
|
||||
},
|
||||
addAllChannels(state, channels) {
|
||||
Vue.set(state, "channels", channels);
|
||||
const test = Object.assign(state.channels, channels);
|
||||
Vue.set(state, "channels", test);
|
||||
},
|
||||
channel(state, channel) {
|
||||
Vue.set(state.channels, channel.channelID, channel);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ const actions = {
|
|||
|
||||
const mutations = {
|
||||
SET_CHANNELS_IDS(state, {serverID, channelsIDs}) {
|
||||
Vue.set(state.channelsIDs, serverID, channelsIDs);
|
||||
const previousChannels = state.channelsIDs[serverID] || []
|
||||
Vue.set(state.channelsIDs, serverID, [...previousChannels, ...channelsIDs]);
|
||||
|
||||
},
|
||||
SET_SERVERS(state, servers) {
|
||||
state.servers = servers;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,20 @@ const actions = {
|
|||
let servers = user.servers || [];
|
||||
//convert array to object for servers
|
||||
servers = servers.reduce((obj, item) => {
|
||||
item.channels.forEach(element => {
|
||||
element.server = undefined
|
||||
element._id = undefined;
|
||||
element.__v = undefined;
|
||||
element.server_id = item.server_id
|
||||
console.log(element)
|
||||
|
||||
context.dispatch('channel', element)
|
||||
context.dispatch("servers/setChannelsIDs", {
|
||||
serverID: item.server_id,
|
||||
channelsIDs: [element.channelID]
|
||||
});
|
||||
});
|
||||
item.channels = undefined;
|
||||
obj[item.server_id] = item
|
||||
return obj
|
||||
}, {})
|
||||
|
|
|
|||
Loading…
Reference in a new issue