diff --git a/Library/_res/0BDFDB.data.json b/Library/_res/0BDFDB.data.json index 31a4ec1f82..c0e0c73e1d 100644 --- a/Library/_res/0BDFDB.data.json +++ b/Library/_res/0BDFDB.data.json @@ -249,7 +249,7 @@ "ThreadCard": {"strings": ["threadId", "gotoThread", "container"]}, "ThreadSidebar": {"strings": ["channelId", "collectThreadMetadata", "SIDEBAR"]}, "TypingUsers": {"class": "typing"}, - "UnavailableGuildsButton": {"props": ["UnavailableGuildsButton"]}, + "UnavailableGuildsButton": {"strings": ["className", "default.guildsError"]}, "UnreadDMs": {"class": "guildsscroller"}, "Upload": {"class": "uploadmodal"}, "UserHook": {"class": "auditloguserhook"}, @@ -315,6 +315,7 @@ "GuildComponents MutedText": {"props": ["useMutedUntilText"], "value": "default"}, "GuildComponents Pill": {"strings": ["opacity:1,height:", "20:8", "default.item"]}, "GuildComponents Separator": {"strings": ["className", "default.guildSeparator"]}, + "GuildComponents UnavailableGuildsButton": {"strings": ["className", "default.guildsError"]}, "Header": {"name": "Header"}, "HeaderBarComponents": {"name": "HeaderBarContainer"}, "Image": {"props": ["ImageReadyStates"]}, diff --git a/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js b/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js index 3679c3abf4..044d14b68a 100644 --- a/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js +++ b/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js @@ -84,13 +84,13 @@ module.exports = (_ => { this.patchedModules = { after: { - Guilds: "render", + Guilds: "type", DefaultHomeButton: "DefaultHomeButton", DirectMessage: "render", Guild: "default", GuildFolder: "render", CircleIconButton: "render", - UnavailableGuildsButton: "UnavailableGuildsButton" + UnavailableGuildsButton: "default" } }; } @@ -161,36 +161,11 @@ module.exports = (_ => { } processGuilds (e) { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.checkTree(children); - return children; - }, "", this); - } - else this.checkTree(e.returnvalue); - } - - checkTree (returnvalue) { - let tree = BDFDB.ReactUtils.findChild(returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"}); - if (tree) { - let childrenRender = tree.props.children; - tree.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.handleGuilds(children); - return children; - }, "", this); - } - else this.handleGuilds(returnvalue); - } - - handleGuilds (returnvalue) { - let [errorChildren, errorIndex] = BDFDB.ReactUtils.findParent(returnvalue, {name: "FluxContainer()"}); - if (errorIndex > -1) errorChildren[errorIndex] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.UnavailableGuildsButton, { + let [errorChildren, errorIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "FluxContainer()"}); + if (errorIndex > -1) errorChildren[errorIndex] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.UnavailableGuildsButton, { unavailableGuilds: BDFDB.LibraryModules.GuildUnavailableStore.totalUnavailableGuilds }); - let scroller = BDFDB.ReactUtils.findChild(returnvalue, {props: [["className", BDFDB.disCN.guildsscroller]]}); + let scroller = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildsscroller]]}); if (scroller) { scroller.props.fade = true; scroller.type = BDFDB.LibraryComponents.Scrollers.Thin; diff --git a/Plugins/PinDMs/PinDMs.plugin.js b/Plugins/PinDMs/PinDMs.plugin.js index c71d24456e..63a1c3e6f7 100644 --- a/Plugins/PinDMs/PinDMs.plugin.js +++ b/Plugins/PinDMs/PinDMs.plugin.js @@ -98,11 +98,11 @@ module.exports = (_ => { this.patchedModules = { before: { PrivateChannelsList: "render", - UnreadDMs: "render" + UnreadDMs: "default" }, after: { PrivateChannelsList: "render", - UnreadDMs: "render", + UnreadDMs: "default", PrivateChannel: ["render", "componentDidMount"], DirectMessage: ["render", "componentDidMount", "componentWillUnmount"] } @@ -176,27 +176,11 @@ module.exports = (_ => { } onStart () { - // REMOVE 24.04.2021 - if (!BDFDB.DataUtils.load(this, "pinned", BDFDB.UserUtils.me.id)) { - let pinned = {}; - let channelListPinned = BDFDB.DataUtils.load(this, "dmCategories"); - let guildListPinned = BDFDB.DataUtils.load(this, "pinnedRecents"); - if (!BDFDB.ObjectUtils.isEmpty(channelListPinned)) pinned.channelList = channelListPinned; - if (!BDFDB.ObjectUtils.isEmpty(guildListPinned)) pinned.guildList = guildListPinned; - if (pinned.channelList || pinned.guildList) BDFDB.DataUtils.save(pinned, this, "pinned", BDFDB.UserUtils.me.id); - } this.forceUpdateAll(); } onStop () { this.forceUpdateAll(); - - let unreadDMsInstance = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name: "UnreadDMs", unlimited: true}); - if (unreadDMsInstance) { - delete unreadDMsInstance.props.pinnedPrivateChannelIds; - unreadDMsInstance.props.unreadPrivateChannelIds = BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds(); - BDFDB.ReactUtils.forceUpdate(unreadDMsInstance); - } } getSettingsPanel (collapseStates = {}) { @@ -664,7 +648,7 @@ module.exports = (_ => { children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", { className: BDFDB.disCNS.guildouter + BDFDB.disCN._pindmsrecentplaceholder, children: BDFDB.ReactUtils.createElement("div", { - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.DragPlaceholder, {}) + children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.DragPlaceholder, {}) }) })); } @@ -775,7 +759,7 @@ module.exports = (_ => { if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) { BDFDB.ListenerUtils.stopEvent(event); draggedChannel = e.instance.props.channel.id; - BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs"); + BDFDB.GuildUtils.rerenderAll(); let dragPreview = this.createDragPreview(e.node, event2); document.removeEventListener("mousemove", mousemove); document.removeEventListener("mouseup", mouseup); @@ -786,14 +770,14 @@ module.exports = (_ => { let update = maybeHoveredChannel != hoveredChannel; if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel; else hoveredChannel = null; - if (update) BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs"); + if (update) BDFDB.GuildUtils.rerenderAll(); }; let releasing = event3 => { BDFDB.DOMUtils.remove(dragPreview); if (hoveredChannel) releasedChannel = hoveredChannel; else draggedChannel = null; hoveredChannel = null; - BDFDB.PatchUtils.forceAllUpdates(this, "UnreadDMs"); + BDFDB.GuildUtils.rerenderAll(); document.removeEventListener("mousemove", dragging); document.removeEventListener("mouseup", releasing); };