Update EditUsers.plugin.js

This commit is contained in:
Mirco Wittrien 2020-05-19 15:48:43 +02:00
parent 7499e9ae10
commit 34e753d940
1 changed files with 13 additions and 10 deletions

View File

@ -1,12 +1,12 @@
//META{"name":"EditUsers","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditUsers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditUsers/EditUsers.plugin.js"}*// //META{"name":"EditUsers","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditUsers","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditUsers/EditUsers.plugin.js"}*//
var EditUsers = (_ => { var EditUsers = (_ => {
var changedUsers, settings; var changedUsers = {}, settings = {};
return class EditUsers { return class EditUsers {
getName () {return "EditUsers";} getName () {return "EditUsers";}
getVersion () {return "3.8.4";} getVersion () {return "3.8.5";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -14,7 +14,7 @@ var EditUsers = (_ => {
constructor () { constructor () {
this.changelog = { this.changelog = {
"improved":[["Performance","Reduced the amount of config calls to increase the performance"]] "fixed":[["Context Menu Update","Fixes for the context menu update, yaaaaaay"]]
}; };
this.patchedModules = { this.patchedModules = {
@ -235,22 +235,25 @@ var EditUsers = (_ => {
onUserContextMenu (e) { onUserContextMenu (e) {
if (e.instance.props.user) { if (e.instance.props.user) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["FluxContainer(MessageDeveloperModeGroup)", "DeveloperModeGroup"]}); let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["id", "devmode-copy-id"]]});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, { children.splice(index > -1 ? index : children.length, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Sub, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_localusersettings_text, label: this.labels.context_localusersettings_text,
render: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Group, { id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_usersettings_text, label: this.labels.submenu_usersettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-open"),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance); BDFDB.ContextMenuUtils.close(e.instance);
this.openUserSettingsModal(e.instance.props.user); this.openUserSettingsModal(e.instance.props.user);
} }
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItems.Item, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings_text, label: this.labels.submenu_resetsettings_text,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
disabled: !changedUsers[e.instance.props.user.id], disabled: !changedUsers[e.instance.props.user.id],
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(e.instance); BDFDB.ContextMenuUtils.close(e.instance);
@ -259,7 +262,7 @@ var EditUsers = (_ => {
} }
}) })
] ]
})] })
}) })
] ]
})); }));