Use switchToChannel instead of click
This commit is contained in:
parent
25da9dd63e
commit
80c6cfbd7c
@ -8,9 +8,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const $ = require("jquery");
|
||||
const socket = require("../../js/socket");
|
||||
|
||||
import NetworkForm from "../NetworkForm.vue";
|
||||
|
||||
export default {
|
||||
@ -41,11 +39,11 @@ export default {
|
||||
this.disabled = true;
|
||||
socket.emit("network:edit", data);
|
||||
|
||||
const sidebar = $("#sidebar");
|
||||
// TODO: move networks to vuex and update state when the network info comes in
|
||||
const network = this.$store.getters.findNetwork(data.uuid);
|
||||
network.name = network.channels[0].name = data.name;
|
||||
sidebar.find(`.network[data-uuid="${data.uuid}"] .chan.lobby .name`).click();
|
||||
|
||||
this.$root.switchToChannel(network.channels[0]);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -155,12 +155,10 @@ function notifyMessage(targetId, channel, activeChannel, msg) {
|
||||
this.close();
|
||||
window.focus();
|
||||
|
||||
const channelTarget = document.querySelector(
|
||||
"#sidebar .chan[data-id='" + targetId + "']"
|
||||
);
|
||||
const channelTarget = store.getters.findChannel(targetId);
|
||||
|
||||
if (channelTarget) {
|
||||
channelTarget.click();
|
||||
vueApp.switchToChannel(channelTarget);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
const storage = require("./localStorage");
|
||||
const socket = require("./socket");
|
||||
const vueApp = require("./vue");
|
||||
const store = require("./store").default;
|
||||
|
||||
let clientSubscribed = null;
|
||||
@ -10,12 +11,11 @@ let applicationServerKey;
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.addEventListener("message", (event) => {
|
||||
if (event.data && event.data.type === "open") {
|
||||
const channelTarget = document.querySelector(
|
||||
"#sidebar .chan[data-target='#" + event.data.channel + "']"
|
||||
);
|
||||
const id = event.data.channel.substr(5); // remove "chan-" prefix
|
||||
const channelTarget = store.getters.findChannel(id);
|
||||
|
||||
if (channelTarget) {
|
||||
channelTarget.click();
|
||||
vueApp.switchToChannel(channelTarget);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -156,7 +156,7 @@ self.addEventListener("notificationclick", function(event) {
|
||||
.then((clientList) => {
|
||||
if (clientList.length === 0) {
|
||||
if (clients.openWindow) {
|
||||
return clients.openWindow(`.#${event.notification.tag}`);
|
||||
return clients.openWindow(`.#/${event.notification.tag}`);
|
||||
}
|
||||
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user