From 3f95f8c636766ddab529efccdbe628284bf8abf6 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 9 Nov 2018 19:36:19 +0100 Subject: [PATCH] fixed DM opening in Friend and StalkerNotifications --- .../FriendNotifications.plugin.js | 14 +++++++------- .../StalkerNotifications.plugin.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Plugins/FriendNotifications/FriendNotifications.plugin.js b/Plugins/FriendNotifications/FriendNotifications.plugin.js index 1decca57c4..9ff4335afb 100644 --- a/Plugins/FriendNotifications/FriendNotifications.plugin.js +++ b/Plugins/FriendNotifications/FriendNotifications.plugin.js @@ -115,7 +115,7 @@ class FriendNotifications { getDescription () {return "Notifies you when a friend either logs in or out. Click the Online Friend-Counter to display a timelog of the current session.";} - getVersion () {return "1.1.1";} + getVersion () {return "1.1.2";} getAuthor () {return "DevilBro";} @@ -224,6 +224,7 @@ class FriendNotifications { this.FriendUtils = BDFDB.WebModules.findByProperties(["getFriendIDs", "getRelationships"]); this.ChannelUtils = BDFDB.WebModules.findByProperties(["getDMFromUserId"]); this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties(["selectPrivateChannel"]); + this.PrivateChannelUtils = BDFDB.WebModules.findByProperties(["openPrivateChannel"]); this.UserMetaStore = BDFDB.WebModules.findByProperties(["getStatus", "getOnlineFriendCount"]); this.UserUtils = BDFDB.WebModules.findByProperties(["getUsers"]); @@ -244,12 +245,11 @@ class FriendNotifications { let string = `${BDFDB.encodeToHTML(data.name ? data.name : user.username)} is ${online ? "online" : "offline"}.`; let avatar = data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id)); let openChannel = () => { - if (settings.openOnClick){ - let DMid = this.ChannelUtils.getDMFromUserId(user.id); - if (DMid) { - require("electron").remote.getCurrentWindow().maximize(); - this.ChannelSwitchUtils.selectPrivateChannel(DMid); - } + if (settings.openOnClick) { + let DMid = this.ChannelStore.getDMFromUserId(user.id) + if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid); + else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id); + require("electron").remote.getCurrentWindow().maximize(); } }; if (!BDFDB.loadData(id, this, "desktop")) { diff --git a/Plugins/StalkerNotifications/StalkerNotifications.plugin.js b/Plugins/StalkerNotifications/StalkerNotifications.plugin.js index 832f782e11..3a3fda7724 100644 --- a/Plugins/StalkerNotifications/StalkerNotifications.plugin.js +++ b/Plugins/StalkerNotifications/StalkerNotifications.plugin.js @@ -127,7 +127,7 @@ class StalkerNotifications { getDescription () {return "Lets you observe the status of people that aren't your friends.";} - getVersion () {return "1.0.5";} + getVersion () {return "1.0.6";} getAuthor () {return "DevilBro";} @@ -275,6 +275,7 @@ class StalkerNotifications { this.ChannelUtils = BDFDB.WebModules.findByProperties(["getDMFromUserId"]); this.ChannelSwitchUtils = BDFDB.WebModules.findByProperties(["selectPrivateChannel"]); + this.PrivateChannelUtils = BDFDB.WebModules.findByProperties(["openPrivateChannel"]); this.UserMetaStore = BDFDB.WebModules.findByProperties(["getStatus", "getOnlineFriendCount"]); this.UserUtils = BDFDB.WebModules.findByProperties(["getUsers"]); @@ -328,12 +329,11 @@ class StalkerNotifications { let string = `${BDFDB.encodeToHTML(data.name ? data.name : user.username)} is ${online ? "online" : "offline"}.`; let avatar = data.removeIcon ? "" : (data.url ? data.url : BDFDB.getUserAvatar(user.id)); let openChannel = () => { - if (settings.openOnClick){ - let DMid = this.ChannelUtils.getDMFromUserId(user.id); - if (DMid) { - require("electron").remote.getCurrentWindow().maximize(); - this.ChannelSwitchUtils.selectPrivateChannel(DMid); - } + if (settings.openOnClick) { + let DMid = this.ChannelStore.getDMFromUserId(user.id) + if (DMid) this.ChannelSwitchUtils.selectPrivateChannel(DMid); + else this.PrivateChannelUtils.openPrivateChannel(BDFDB.myData.id, user.id); + require("electron").remote.getCurrentWindow().maximize(); } }; if (!users[id].desktop) {