diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index fd538cd6f5..cc44f5c70a 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -2,7 +2,7 @@ * @name EditUsers * @author DevilBro * @authorId 278543574059057154 - * @version 4.4.1 + * @version 4.4.2 * @description Allows you to locally edit Users * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,12 +17,13 @@ module.exports = (_ => { "info": { "name": "EditUsers", "author": "DevilBro", - "version": "4.4.1", + "version": "4.4.2", "description": "Allows you to locally edit Users" }, "changeLog": { "added": { - "Show Accountname": "Similar to 'Show Nickname' you can now enable 'Show Name' which will always show the account name of a user in '()', 'Show Nickname' has a higher priority than 'Show Name'" + "Show Accountname": "Similar to 'Show Nickname' you can now enable 'Show Name' which will always show the account name of a user in '()', 'Show Nickname' has a higher priority than 'Show Name'", + "Stream Preview": "Participants are also affected now" } } }; @@ -142,6 +143,7 @@ module.exports = (_ => { QuickSwitchUserResult: "render", SearchPopoutComponent: "render", PrivateChannelCallParticipants: "render", + VideoParticipants: "default", ChannelCall: "render", PictureInPictureVideo: "default", UserSummaryItem: "render" @@ -156,6 +158,7 @@ module.exports = (_ => { UserPopoutInfo: "UserPopoutInfo", MutualFriends: "default", VoiceUser: "render", + ParticipantsForSelectedParticipant: "default", Account: "render", PrivateChannelEmptyMessage: "default", MessageUsername: "default", @@ -615,7 +618,7 @@ module.exports = (_ => { let data = changedUsers[e.instance.props.user.id]; if (data && data.name) { let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id); - e.instance.props.nick = this.getUserNick(e.instance.props.user.id, e.instance.props.nick); + e.instance.props.nick = this.getUserNick(e.instance.props.user.id, e.instance.props.nick) || e.instance.props.nick; } } else { @@ -631,7 +634,7 @@ module.exports = (_ => { if (data) { e.instance.props.voiceStates[i] = Object.assign({}, e.instance.props.voiceStates[i]); e.instance.props.voiceStates[i].user = this.getUserData(e.instance.props.voiceStates[i].user.id); - e.instance.props.voiceStates[i].nick = this.getUserNick(e.instance.props.voiceStates[i].user.id, e.instance.props.voiceStates[i].member.nick); + e.instance.props.voiceStates[i].nick = this.getUserNick(e.instance.props.voiceStates[i].user.id, e.instance.props.voiceStates[i].member.nick) || e.instance.props.voiceStates[i].nick; } } } @@ -1152,13 +1155,45 @@ module.exports = (_ => { processPrivateChannelCallParticipants (e) { if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) { - for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id, true, true); + e.instance.props.participants = [].concat(e.instance.props.participants); + for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)}); + } + } + + processParticipantsForSelectedParticipant (e) { + if (this.settings.places.voiceChat) { + let popout = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "Popout"}); + if (popout && typeof popout.props.children == "function") { + let renderChildren = popout.props.children; + popout.props.children = BDFDB.TimeUtils.suppress((...args) => { + let renderedChildren = renderChildren(...args); + for (let viewer of renderedChildren.props.children) viewer.props.src = this.getUserAvatar(viewer.key); + return renderedChildren; + }); + } + if (popout && typeof popout.props.renderPopout == "function") { + let renderPopout = popout.props.renderPopout; + popout.props.renderPopout = BDFDB.TimeUtils.suppress((...args) => { + let renderedPopout = renderPopout(...args); + renderedPopout.props.users = [].concat(renderedPopout.props.users); + for (let i in renderedPopout.props.users) if (renderedPopout.props.users[i]) renderedPopout.props.users[i] = this.getUserData(renderedPopout.props.users[i].id); + return renderedPopout; + }); + } + } + } + + processVideoParticipants (e) { + if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.voiceChat) { + e.instance.props.participants = [].concat(e.instance.props.participants); + for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)}); } } processChannelCall (e) { - if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.dmCalls) { - for (let participant of e.instance.props.participants) if (participant && participant.user) participant.user = this.getUserData(participant.user.id); + if (BDFDB.ArrayUtils.is(e.instance.props.participants) && this.settings.places.voiceChat) { + e.instance.props.participants = [].concat(e.instance.props.participants); + for (let i in e.instance.props.participants) if (e.instance.props.participants[i] && e.instance.props.participants[i].user) e.instance.props.participants[i] = Object.assign({}, e.instance.props.participants[i], {user: this.getUserData(e.instance.props.participants[i].user.id)}); } }