This commit is contained in:
Mirco Wittrien 2020-06-27 22:56:53 +02:00
parent 1544e9534c
commit dacf684938
2 changed files with 15 additions and 21 deletions

View File

@ -338,7 +338,7 @@ var EditChannels = (_ => {
processRecentsChannelHeader (e) { processRecentsChannelHeader (e) {
if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) { if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel) { for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
child.props.channel = this.getChannelData(child.props.channel.id); child.props.channel = this.getChannelData(child.props.channel.id);
let oldType = child.type; let oldType = child.type;
child.type = (...args) => { child.type = (...args) => {

View File

@ -6,7 +6,7 @@ var EditServers = (_ => {
return class EditServers { return class EditServers {
getName () {return "EditServers";} getName () {return "EditServers";}
getVersion () {return "2.2.1";} getVersion () {return "2.2.2";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -14,7 +14,7 @@ var EditServers = (_ => {
constructor () { constructor () {
this.changelog = { this.changelog = {
"fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]] "fixed":[["Inbox update","Fixes for the inbox update"]]
}; };
this.patchedModules = { this.patchedModules = {
@ -22,14 +22,13 @@ var EditServers = (_ => {
Guild: "render", Guild: "render",
GuildIconWrapper: "render", GuildIconWrapper: "render",
MutualGuilds: "render", MutualGuilds: "render",
FriendRow: "render",
QuickSwitcher: "render", QuickSwitcher: "render",
QuickSwitchChannelResult: "render", QuickSwitchChannelResult: "render",
GuildSidebar: "render", GuildSidebar: "render",
GuildHeader: "render" GuildHeader: "render"
}, },
after: { after: {
MessagesPopout: "render", RecentsChannelHeader: "default",
Guild: "render", Guild: "render",
BlobMask: "render", BlobMask: "render",
GuildIconWrapper: "render", GuildIconWrapper: "render",
@ -280,10 +279,6 @@ var EditServers = (_ => {
if (settings.changeInMutualGuilds) for (let i in e.instance.props.mutualGuilds) e.instance.props.mutualGuilds[i].guild = this.getGuildData(e.instance.props.mutualGuilds[i].guild.id); if (settings.changeInMutualGuilds) for (let i in e.instance.props.mutualGuilds) e.instance.props.mutualGuilds[i].guild = this.getGuildData(e.instance.props.mutualGuilds[i].guild.id);
} }
processFriendRow (e) {
if (settings.changeInMutualGuilds) for (let i in e.instance.props.mutualGuilds) e.instance.props.mutualGuilds[i] = this.getGuildData(e.instance.props.mutualGuilds[i].id);
}
processQuickSwitcher (e) { processQuickSwitcher (e) {
if (settings.changeInQuickSwitcher) for (let i in e.instance.props.results) if (e.instance.props.results[i].type == "GUILD") e.instance.props.results[i].record = this.getGuildData(e.instance.props.results[i].record.id); if (settings.changeInQuickSwitcher) for (let i in e.instance.props.results) if (e.instance.props.results[i].type == "GUILD") e.instance.props.results[i].record = this.getGuildData(e.instance.props.results[i].record.id);
} }
@ -294,18 +289,17 @@ var EditServers = (_ => {
} }
} }
processMessagesPopout (e) { processRecentsChannelHeader (e) {
if (settings.changeInRecentMentions) { if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "VerticalScroller"}); for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
if (index > -1 && children[index].props.children && BDFDB.ArrayUtils.is(children[index].props.children[0])) for (let i in children[index].props.children[0]) { let oldType = child.type;
let divider = children[index].props.children[0][i]; child.type = (...args) => {
if (divider && divider.props && divider.props.className == BDFDB.disCN.messagespopoutchannelseparator) { let instance = oldType(...args);
let channel = BDFDB.ReactUtils.findValue(children[index].props.children[0][parseInt(i)+1], "channel"); let guildName = BDFDB.ReactUtils.findChild(instance, {props:[["className", BDFDB.disCN.recentmentionsguildname]]});
if (BDFDB.ChannelUtils.isTextChannel(channel)) { if (guildName) guildName.props.children = (this.getGuildData(e.instance.props.channel.guild_id) || {}).name || guildName.props.children;
let [children2, index2] = BDFDB.ReactUtils.findParent(divider, {props:[["className", BDFDB.disCN.messagespopoutguildname]]}); return instance;
if (index2 > -1) children2[index2].props.children = this.getGuildData(channel.guild_id).name; };
} child.type.displayName = oldType.displayName;
}
} }
} }
} }