|
|
|
@ -4,20 +4,21 @@
|
|
|
|
|
* @memberof Builtin.Attributes.Components.Modals
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { getModuleByDisplayName } from '@vizality/webpack';
|
|
|
|
|
import { getModule } from '@vizality/webpack';
|
|
|
|
|
import { patch, unpatch } from '@vizality/patcher';
|
|
|
|
|
import { findInTree } from '@vizality/util/react';
|
|
|
|
|
|
|
|
|
|
export const labels = [ 'Components', 'Modals', 'User' ];
|
|
|
|
|
|
|
|
|
|
export default builtin => {
|
|
|
|
|
const UserProfile = getModuleByDisplayName('UserProfile');
|
|
|
|
|
patch('vz-attributes-modal-user', UserProfile?.prototype, 'render', (_, res) => {
|
|
|
|
|
const UserProfile = getModule(m => m.default?.displayName === 'UserProfileModal');
|
|
|
|
|
patch('vz-attributes-modal-user', UserProfile, 'default', ([ props ], res) => {
|
|
|
|
|
try {
|
|
|
|
|
res.ref = elem => {
|
|
|
|
|
if (elem?._reactInternalFiber) {
|
|
|
|
|
const container = findInTree(elem._reactInternalFiber.return, el => el.stateNode?.setAttribute, { walkable: [ 'return' ] });
|
|
|
|
|
container?.stateNode?.children[0]?.setAttribute('vz-user-id', res.props?.user?.id);
|
|
|
|
|
container?.stateNode?.children[0]?.setAttribute('vz-user-id', props?.user?.id);
|
|
|
|
|
container?.stateNode?.children[0]?.setAttribute('vz-guild-id', props?.guildId);
|
|
|
|
|
container?.stateNode?.parentElement?.setAttribute('vz-modal', 'user');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|