Fix opening channel when clicking a push notification
This commit is contained in:
parent
c2ed3fae56
commit
a3be259567
@ -3,7 +3,6 @@
|
|||||||
import socket from "../socket";
|
import socket from "../socket";
|
||||||
import upload from "../upload";
|
import upload from "../upload";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import {initialize as routerInitialize} from "../router";
|
|
||||||
|
|
||||||
socket.once("configuration", function(data) {
|
socket.once("configuration", function(data) {
|
||||||
store.commit("serverConfiguration", data);
|
store.commit("serverConfiguration", data);
|
||||||
@ -17,8 +16,6 @@ socket.once("configuration", function(data) {
|
|||||||
upload.initialize();
|
upload.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
routerInitialize();
|
|
||||||
|
|
||||||
// If localStorage contains a theme that does not exist on this server, switch
|
// If localStorage contains a theme that does not exist on this server, switch
|
||||||
// back to its default theme.
|
// back to its default theme.
|
||||||
const currentTheme = data.themes.find((t) => t.name === store.state.settings.theme);
|
const currentTheme = data.themes.find((t) => t.name === store.state.settings.theme);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import socket from "../socket";
|
import socket from "../socket";
|
||||||
import storage from "../localStorage";
|
import storage from "../localStorage";
|
||||||
import {router, switchToChannel, navigate} from "../router";
|
import {router, switchToChannel, navigate, initialize as routerInitialize} from "../router";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import parseIrcUri from "../helpers/parseIrcUri";
|
import parseIrcUri from "../helpers/parseIrcUri";
|
||||||
|
|
||||||
@ -16,6 +16,10 @@ socket.on("init", function(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!store.state.appLoaded) {
|
if (!store.state.appLoaded) {
|
||||||
|
// Routes are initialized after networks data is merged
|
||||||
|
// so the route guard for channels works correctly on page load
|
||||||
|
routerInitialize();
|
||||||
|
|
||||||
store.commit("appLoaded");
|
store.commit("appLoaded");
|
||||||
|
|
||||||
if (window.g_TheLoungeRemoveLoading) {
|
if (window.g_TheLoungeRemoveLoading) {
|
||||||
|
@ -9,11 +9,12 @@ export default {togglePushSubscription};
|
|||||||
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 id = event.data.channel.substr(5); // remove "chan-" prefix
|
const id = parseInt(event.data.channel.substr(5), 10); // remove "chan-" prefix
|
||||||
|
|
||||||
const channelTarget = store.getters.findChannel(id);
|
const channelTarget = store.getters.findChannel(id);
|
||||||
|
|
||||||
if (channelTarget) {
|
if (channelTarget) {
|
||||||
switchToChannel(channelTarget);
|
switchToChannel(channelTarget.channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user