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