This commit is contained in:
Mirco Wittrien 2020-08-05 21:35:19 +02:00
parent 6edd8d61cb
commit 0a3350539e
4 changed files with 25 additions and 24 deletions

View File

@ -2414,6 +2414,16 @@
}
return false;
};
BDFDB.UserUtils.openMenu = function (id, guildId, e = BDFDB.InternalData.mousePosition) {
if (!id || !guildId) return;
let user = LibraryModules.UserStore.getUser(id);
if (user) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement((BDFDB.ModuleUtils.findByName("GuildChannelUserContextMenu", false) || {exports:{}}).exports.default, Object.assign({}, e, {
user: user,
guildId: guildId
}));
});
};
let GuildsRerenderTimeout;
BDFDB.GuildUtils = {};

File diff suppressed because one or more lines are too long

View File

@ -7,17 +7,13 @@ var JoinedAtDate = (_ => {
return class JoinedAtDate {
getName () {return "JoinedAtDate";}
getVersion () {return "1.2.3";}
getVersion () {return "1.2.4";}
getAuthor () {return "DevilBro";}
getDescription () {return "Displays the Joined At Date of the current Server for a Member in the UserPopout and UserModal.";}
constructor () {
this.changelog = {
"fixed":[["No member","no longer tries to fetch join date of no members"]]
};
this.patchedModules = {
after: {
UserPopout: "render",
@ -264,9 +260,9 @@ var JoinedAtDate = (_ => {
}
processUserPopout (e) {
if (e.instance.props.user && settings.addInUserPopout) {
if (e.instance.props.user && e.instance.props.guild && settings.addInUserPopout) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "CustomStatus"});
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user);
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user, e.instance.props.guild.id);
}
}
@ -276,16 +272,15 @@ var JoinedAtDate = (_ => {
e.returnvalue.props.children = (...args) => {
let renderedChildren = renderChildren(...args);
let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {name: ["DiscordTag", "ColoredFluxTag"]});
if (index > -1) this.injectDate(e.instance, children, 1, children[index].props.user);
if (index > -1) this.injectDate(e.instance, children, 1, children[index].props.user, BDFDB.ReactUtils.findValue(e.instance, "guildId", {up: true}));
return renderedChildren;
};
}
}
injectDate (instance, children, index, user) {
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return;
let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
if (!guildId || !BDFDB.LibraryModules.MemberStore.getMember(guildId, user.id)) return;
injectDate (instance, children, index, user, guildId) {
if (!guildId) guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
if (!BDFDB.ArrayUtils.is(children) || !user || !guildId || user.discriminator == "0000" || !BDFDB.LibraryModules.MemberStore.getMember(guildId, user.id)) return;
if (!loadedUsers[guildId]) loadedUsers[guildId] = {};
if (!requestedUsers[guildId]) requestedUsers[guildId] = {};
if (!BDFDB.ArrayUtils.is(requestedUsers[guildId][user.id])) {

View File

@ -7,17 +7,13 @@ var LastMessageDate = (_ => {
return class LastMessageDate {
getName () {return "LastMessageDate";}
getVersion () {return "1.1.8";}
getVersion () {return "1.1.9";}
getAuthor () {return "DevilBro";}
getDescription () {return "Displays the Date of the last sent Message of a Member for the current Server/DM in the UserPopout and UserModal.";}
constructor () {
this.changelog = {
"added":[["Settings","Added upper limit for $daysago, option to hide the default timestamp text and new year short form placeholder"]]
};
this.patchedModules = {
after: {
UserPopout: "render",
@ -276,7 +272,7 @@ var LastMessageDate = (_ => {
processUserPopout (e) {
if (e.instance.props.user && settings.addInUserPopout) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "CustomStatus"});
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user);
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user, e.instance.props.guild && e.instance.props.guild.id);
}
}
@ -286,17 +282,17 @@ var LastMessageDate = (_ => {
e.returnvalue.props.children = (...args) => {
let renderedChildren = renderChildren(...args);
let [children, index] = BDFDB.ReactUtils.findParent(renderedChildren, {name: ["DiscordTag", "ColoredFluxTag"]});
if (index > -1) this.injectDate(e.instance, children, 1, children[index].props.user);
if (index > -1) this.injectDate(e.instance, children, 1, children[index].props.user, BDFDB.ReactUtils.findValue(e.instance, "guildId", {up: true}));
return renderedChildren;
};
}
}
injectDate (instance, children, index, user) {
injectDate (instance, children, index, user, guildId) {
if (!guildId) guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return;
let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
let isGuild = !!guildId;
guildId = guildId || BDFDB.LibraryModules.LastChannelStore.getChannelId();
let isGuild = guildId && guildId != BDFDB.DiscordConstants.ME;
guildId = isGuild ? guildId : BDFDB.LibraryModules.LastChannelStore.getChannelId();
if (!guildId) return;
if (!loadedUsers[guildId]) loadedUsers[guildId] = {};
if (!requestedUsers[guildId]) requestedUsers[guildId] = {};