viewRaw, viewIcons, permissionsViewer: fix some edge cases (#1745)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
4c7a2ba340
commit
f32d25b641
@ -126,7 +126,7 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
|
||||
|
||||
function makeContextMenuPatch(childId: string | string[], type?: MenuItemParentType): NavContextMenuPatchCallback {
|
||||
return (children, props) => () => {
|
||||
if (!props) return children;
|
||||
if (!props || (type === MenuItemParentType.User && !props.user) || (type === MenuItemParentType.Guild && !props.guild)) return children;
|
||||
|
||||
const group = findGroupChildrenByChildId(childId, children);
|
||||
|
||||
|
@ -83,6 +83,7 @@ function openImage(url: string) {
|
||||
}
|
||||
|
||||
const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: UserContextProps) => () => {
|
||||
if (!user) return;
|
||||
const memberAvatar = GuildMemberStore.getMember(guildId!, user.id)?.avatar || null;
|
||||
|
||||
children.splice(-1, 0, (
|
||||
|
@ -119,7 +119,7 @@ const settings = definePluginSettings({
|
||||
|
||||
function MakeContextCallback(name: string) {
|
||||
const callback: NavContextMenuPatchCallback = (children, props) => () => {
|
||||
if (name === "Guild" && !props.guild) return;
|
||||
if ((name === "Guild" && !props.guild) || (name === "User" && !props.user)) return;
|
||||
const lastChild = children.at(-1);
|
||||
if (lastChild?.key === "developer-actions") {
|
||||
const p = lastChild.props;
|
||||
|
Loading…
Reference in New Issue
Block a user