aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorAutumnVN <autumnvnchino@gmail.com>2023-09-26 06:48:09 +0700
committerGitHub <noreply@github.com>2023-09-26 01:48:09 +0200
commitf32d25b641dc89b623ec0930396827bfcf4921b2 (patch)
treeaabb088f96e7b10a55ad5a99f221c8e92f0dc500 /src/plugins
parent4c7a2ba3406c2ba4ffc7237cdceaa8ebd2a491d3 (diff)
downloadVencord-f32d25b641dc89b623ec0930396827bfcf4921b2.tar.gz
Vencord-f32d25b641dc89b623ec0930396827bfcf4921b2.tar.bz2
Vencord-f32d25b641dc89b623ec0930396827bfcf4921b2.zip
viewRaw, viewIcons, permissionsViewer: fix some edge cases (#1745)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/permissionsViewer/index.tsx2
-rw-r--r--src/plugins/viewIcons/index.tsx3
-rw-r--r--src/plugins/viewRaw/index.tsx2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/permissionsViewer/index.tsx b/src/plugins/permissionsViewer/index.tsx
index 7de29b3..8f31080 100644
--- a/src/plugins/permissionsViewer/index.tsx
+++ b/src/plugins/permissionsViewer/index.tsx
@@ -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);
diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx
index 3bfe902..06a7c0a 100644
--- a/src/plugins/viewIcons/index.tsx
+++ b/src/plugins/viewIcons/index.tsx
@@ -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, (
@@ -111,7 +112,7 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U
};
const GuildContext: NavContextMenuPatchCallback = (children, { guild }: GuildContextProps) => () => {
- if(!guild) return;
+ if (!guild) return;
const { id, icon, banner } = guild;
if (!banner && !icon) return;
diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx
index 6012764..f516b5d 100644
--- a/src/plugins/viewRaw/index.tsx
+++ b/src/plugins/viewRaw/index.tsx
@@ -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;