Patch guild header popout context too
This commit is contained in:
parent
d92894697b
commit
700301ffbb
@ -178,12 +178,12 @@ export default definePlugin({
|
|||||||
start() {
|
start() {
|
||||||
addContextMenuPatch("user-context", this.userContextMenuPatch);
|
addContextMenuPatch("user-context", this.userContextMenuPatch);
|
||||||
addContextMenuPatch("channel-context", this.channelContextMenuPatch);
|
addContextMenuPatch("channel-context", this.channelContextMenuPatch);
|
||||||
addContextMenuPatch("guild-context", this.guildContextMenuPatch);
|
addContextMenuPatch(["guild-context", "guild-header-popout"], this.guildContextMenuPatch);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
removeContextMenuPatch("user-context", this.userContextMenuPatch);
|
removeContextMenuPatch("user-context", this.userContextMenuPatch);
|
||||||
removeContextMenuPatch("channel-context", this.channelContextMenuPatch);
|
removeContextMenuPatch("channel-context", this.channelContextMenuPatch);
|
||||||
removeContextMenuPatch("guild-context", this.guildContextMenuPatch);
|
removeContextMenuPatch(["guild-context", "guild-header-popout"], this.guildContextMenuPatch);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
import { addContextMenuPatch, findGroupChildrenByChildId, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { Menu } from "@webpack/common";
|
import { Menu } from "@webpack/common";
|
||||||
@ -13,13 +13,15 @@ import { Guild } from "discord-types/general";
|
|||||||
import { openGuildProfileModal } from "./GuildProfileModal";
|
import { openGuildProfileModal } from "./GuildProfileModal";
|
||||||
|
|
||||||
const Patch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild; }) => () => {
|
const Patch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild; }) => () => {
|
||||||
children.splice(-1, 0, (
|
const group = findGroupChildrenByChildId("privacy", children);
|
||||||
|
|
||||||
|
group?.push(
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="vc-server-profile"
|
id="vc-server-profile"
|
||||||
label="Server Profile"
|
label="Server Profile"
|
||||||
action={() => openGuildProfileModal(guild)}
|
action={() => openGuildProfileModal(guild)}
|
||||||
/>
|
/>
|
||||||
));
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
@ -29,10 +31,10 @@ export default definePlugin({
|
|||||||
tags: ["guild", "info"],
|
tags: ["guild", "info"],
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
addContextMenuPatch("guild-context", Patch);
|
addContextMenuPatch(["guild-context", "guild-header-popout"], Patch);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
removeContextMenuPatch("guild-context", Patch);
|
removeContextMenuPatch(["guild-context", "guild-header-popout"], Patch);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user