Mentions window: filter list when we part a chan
Should some other client part a chan, then we need to clean up the list from the mentions window in case it's open in ours.
This commit is contained in:
parent
0d209fce09
commit
e999171f29
@ -12,10 +12,14 @@ socket.on("part", function (data) {
|
|||||||
|
|
||||||
const channel = store.getters.findChannel(data.chan);
|
const channel = store.getters.findChannel(data.chan);
|
||||||
|
|
||||||
if (channel) {
|
if (!channel) {
|
||||||
channel.network.channels.splice(
|
return;
|
||||||
channel.network.channels.findIndex((c) => c.id === data.chan),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channel.network.channels.splice(
|
||||||
|
channel.network.channels.findIndex((c) => c.id === data.chan),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch("partChannel", channel);
|
||||||
});
|
});
|
||||||
|
@ -130,6 +130,12 @@ const store = new Vuex.Store({
|
|||||||
state.messageSearchResults = value;
|
state.messageSearchResults = value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
actions: {
|
||||||
|
partChannel({commit, state}, netChan) {
|
||||||
|
const mentions = state.mentions.filter((msg) => !(msg.chanId === netChan.channel.id));
|
||||||
|
commit("mentions", mentions);
|
||||||
|
},
|
||||||
|
},
|
||||||
getters: {
|
getters: {
|
||||||
findChannelOnCurrentNetwork: (state) => (name) => {
|
findChannelOnCurrentNetwork: (state) => (name) => {
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user