Add opening the user’s profile modal
This commit is contained in:
parent
96952c3fef
commit
e524c50b65
|
@ -52,6 +52,7 @@ export const Modules = {
|
|||
get PruneMembersModal() { return this._getModule('PruneMembersModal'); },
|
||||
get NotificationSettingsModal() { return this._getModule('NotificationSettingsModal'); },
|
||||
get PrivacySettingsModal() { return this._getModule('PrivacySettingsModal'); },
|
||||
get UserProfileModal() { return this._getModule('UserProfileModal'); },
|
||||
|
||||
get DiscordPermissions() { return this.DiscordConstants.Permissions; }
|
||||
};
|
||||
|
|
|
@ -189,7 +189,7 @@ const KnownModules = {
|
|||
/* Modals */
|
||||
ModalStack: Filters.byProperties(['push', 'update', 'pop', 'popWithKey']),
|
||||
ConfirmModal: Filters.byPrototypeFields(['handleCancel', 'handleSubmit', 'handleMinorConfirm']),
|
||||
UserProfileModals: Filters.byProperties(['fetchMutualFriends', 'setSection']),
|
||||
UserProfileModal: Filters.byProperties(['fetchMutualFriends', 'setSection']),
|
||||
ChangeNicknameModal: Filters.byProperties(['open', 'changeNickname']),
|
||||
CreateChannelModal: Filters.byProperties(['open', 'createChannel']),
|
||||
PruneMembersModal: Filters.byProperties(['open', 'prune']),
|
||||
|
|
|
@ -108,6 +108,15 @@ export class User {
|
|||
Modules.RelationshipManager.removeRelationship(this.id, {location: 'Context Menu'});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the profile modal for this user.
|
||||
* @param {String} section The section to open (see DiscordConstants.UserProfileSections)
|
||||
*/
|
||||
openUserProfileModal(section = 'USER_INFO') {
|
||||
Modules.UserProfileModal.open(this.id);
|
||||
Modules.UserProfileModal.setSection(section);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const guild_members = new WeakMap();
|
||||
|
|
|
@ -22,7 +22,7 @@ export default class extends Module {
|
|||
this.patchMessage();
|
||||
this.patchChannelMember();
|
||||
this.patchNameTag();
|
||||
this.patchUserProfileModals();
|
||||
this.patchUserProfileModal();
|
||||
}
|
||||
|
||||
get contributors() {
|
||||
|
@ -167,13 +167,13 @@ export default class extends Module {
|
|||
}
|
||||
|
||||
/**
|
||||
* Patches UserProfileModals to inject profile badges into the modal once opened.
|
||||
* Patches UserProfileModal to inject profile badges into the modal once opened.
|
||||
* TODO: just patch the modal component
|
||||
*/
|
||||
async patchUserProfileModals() {
|
||||
const UserProfileModals = WebpackModules.getModuleByName('UserProfileModals');
|
||||
async patchUserProfileModal() {
|
||||
const UserProfileModal = WebpackModules.getModuleByName('UserProfileModal');
|
||||
|
||||
MonkeyPatch('BdUI', UserProfileModals).after('open', async (context, [userid]) => {
|
||||
MonkeyPatch('BdUI', UserProfileModal).after('open', async (context, [userid]) => {
|
||||
const c = contributors.find(c => c.id === userid);
|
||||
if (!c) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue