Update EditUsers.plugin.js
This commit is contained in:
parent
acee10f777
commit
20869ad916
|
@ -2,7 +2,7 @@
|
|||
* @name EditUsers
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.4.9
|
||||
* @version 4.5.0
|
||||
* @description Allows you to locally edit Users
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditUsers",
|
||||
"author": "DevilBro",
|
||||
"version": "4.4.9",
|
||||
"version": "4.5.0",
|
||||
"description": "Allows you to locally edit Users"
|
||||
}
|
||||
};
|
||||
|
@ -364,13 +364,18 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onDMContextMenu (e) {
|
||||
this.onUserContextMenu(e);
|
||||
if (e.instance.props.user) {
|
||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: this.createContextMenuEntry(e.instance.props.user)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.user) {
|
||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||
if (userName != e.instance.props.user.username && this.settings.places.contextMenu) {
|
||||
if (false && userName != e.instance.props.user.username && this.settings.places.contextMenu) {
|
||||
let [kickChilden, kickIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "kick"});
|
||||
if (kickIndex > -1) kickChilden[kickIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("KICK_USER", userName);
|
||||
let [banChilden, banIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "ban"});
|
||||
|
@ -380,41 +385,43 @@ module.exports = (_ => {
|
|||
let [unmuteChilden, unmuteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "unmute-channel"});
|
||||
if (unmuteIndex > -1) unmuteChilden[unmuteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("UNMUTE_CHANNEL", `@${userName}`);
|
||||
}
|
||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.context_localusersettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
|
||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: [
|
||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.submenu_usersettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
|
||||
action: _ => {
|
||||
this.openUserSettingsModal(e.instance.props.user);
|
||||
}
|
||||
}),
|
||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.submenu_resetsettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
|
||||
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
|
||||
disabled: !changedUsers[e.instance.props.user.id],
|
||||
action: event => {
|
||||
let remove = _ => {
|
||||
BDFDB.DataUtils.remove(this, "users", e.instance.props.user.id);
|
||||
this.forceUpdateAll(true);
|
||||
};
|
||||
if (event.shiftKey) remove();
|
||||
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
})
|
||||
}));
|
||||
if (e.subType == "useUserRolesItems") {
|
||||
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
||||
e.returnvalue.push(this.createContextMenuEntry(e.instance.props.user));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createContextMenuEntry (user) {
|
||||
return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.context_localusersettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
|
||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: [
|
||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.submenu_usersettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
|
||||
action: _ => this.openUserSettingsModal(user)
|
||||
}),
|
||||
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
label: this.labels.submenu_resetsettings,
|
||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
|
||||
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
|
||||
disabled: !changedUsers[user.id],
|
||||
action: event => {
|
||||
let remove = _ => {
|
||||
BDFDB.DataUtils.remove(this, "users", user.id);
|
||||
this.forceUpdateAll(true);
|
||||
};
|
||||
if (event.shiftKey) remove();
|
||||
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && e.instance.props.channel.isDM() && e.instance.props.type == BDFDB.LibraryComponents.ChannelTextAreaTypes.NORMAL && this.settings.places.chatTextarea) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.recipients[0]);
|
||||
|
@ -956,7 +963,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processAuditLogs (e) {
|
||||
if (e.instance.props.logs && this.settings.places.guildSettings) {
|
||||
if (e.instance.props.logs && this.settings.places.guildSettings) {
|
||||
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "renderUserQuickSelectItem")) BDFDB.PatchUtils.patch(this, e.instance, "renderUserQuickSelectItem", {after: e2 => {if (e2.methodArguments[0] && e2.methodArguments[0].user && changedUsers[e2.methodArguments[0].user.id]) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e2.returnValue, {props: [["children", e2.methodArguments[0].label]]});
|
||||
if (userName) {
|
||||
|
|
Loading…
Reference in New Issue