Vendicated / Vencord

The cutest Discord client mod
https://vencord.dev
GNU General Public License v3.0
8.58k stars 1.21k forks source link

[Bug] ShowHiddenThings ModView #2708

Open ColynOrg opened 1 month ago

ColynOrg commented 1 month ago

Discord Account

CJStylesOrg

What happens when the bug or crash occurs?

the roles will not show up on the mod view at all despite the user having a role shown in their profile. i have tested this on Bread (304260051915374603) whom is a plugin developer in BetterDiscord. cases like this are rare but i managed to stumble upon this. Preview

What is the expected behaviour?

i expect the plugin to retrieve the users role and display them in the mod view, im unaware if this is related to discord or the plugin itself.

How do you recreate this bug or crash?

  1. press the mod view button on peoples profile until you notice the roles don't show up on the mod view despite them actually having roles.

Errors

GET https://canary.discord.com/api/v9/guilds/86004744966914048/audit-logs?limit=50&target_id=304260051915374603 403 (Forbidden)
A._end @ web.5654e7cdcca52e5b08a1.js:12
A.end @ web.5654e7cdcca52e5b08a1.js:12
(anonymous) @ web.5654e7cdcca52e5b08a1.js:12
l.then @ web.5654e7cdcca52e5b08a1.js:12
E @ web.5654e7cdcca52e5b08a1.js:12
(anonymous) @ web.5654e7cdcca52e5b08a1.js:12
I @ web.5654e7cdcca52e5b08a1.js:12
t @ e70441093a3116eaa948.js:1
a @ e70441093a3116eaa948.js:1
S @ e70441093a3116eaa948.js:1
e @ c7f4b1b26af37e6d391f.js:1
(anonymous) @ c7f4b1b26af37e6d391f.js:1
sF @ web.5654e7cdcca52e5b08a1.js:12
oV @ web.5654e7cdcca52e5b08a1.js:12
oD @ web.5654e7cdcca52e5b08a1.js:12
r5 @ web.5654e7cdcca52e5b08a1.js:12
(anonymous) @ web.5654e7cdcca52e5b08a1.js:12
oF @ web.5654e7cdcca52e5b08a1.js:12
oO @ web.5654e7cdcca52e5b08a1.js:12
N @ web.5654e7cdcca52e5b08a1.js:12
L @ web.5654e7cdcca52e5b08a1.js:12
T.C.<computed> @ web.5654e7cdcca52e5b08a1.js:1
D @ web.5654e7cdcca52e5b08a1.js:1
b @ web.5654e7cdcca52e5b08a1.js:1

Request Agreement

Sqaaakoi commented 1 month ago

discord doesn't show the highest role there by design Mod view roles component, with `filter(e=>null != e && e !== t.highestRoleId)` selected

make sure they have more than 1 role maybe this could be a feature that SHT removes this check?

Sqaaakoi commented 1 month ago

nvm i'm wrong. This is a stock Discord issue that we can fix (and need to fix). Discord is using MemberSafetyStore.getEnhancedMember(guildId, userId) to get the highest role, and opening Mod View from the context menu does not try to load that information. Viewing the Members page does load the required data, as that's where Mod View was originally invoked from. Permissions are required to load that data, so we need to patch this anyway. See attached annotated screenshot for what needs to be changed to fix this.

Diagram showing to remove MemberSafetyStore.getEnhancedMember and related get role call and to just find the highest role from the member's (passed to the component) role list and look it up in the same object like the listing of all other roles

EDIT: you can just do s[t.highestRoleId] EDIT 2: fixed explanation of bug for fix PR that links to this comment

Sqaaakoi commented 1 month ago

tl;dr: discord overcomplicated things and depends on stuff that isnt important at all here