diff --git a/packages/discord-types/src/stores/GuildRoleStore.d.ts b/packages/discord-types/src/stores/GuildRoleStore.d.ts index 01e1cf831..dc822a33b 100644 --- a/packages/discord-types/src/stores/GuildRoleStore.d.ts +++ b/packages/discord-types/src/stores/GuildRoleStore.d.ts @@ -1,5 +1,6 @@ import { FluxStore, Guild, Role } from ".."; +// TODO: add the rest of the methods for GuildRoleStore export class GuildRoleStore extends FluxStore { serializeAllGuildRoles(): Array<{ partitionKey: string; values: Record; }>; getUnsafeMutableRoles(guildId: string): Record; diff --git a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx index a1c9fac11..6d6bed8a7 100644 --- a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx +++ b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx @@ -84,7 +84,7 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea const [selectedItemIndex, selectItem] = useState(0); const selectedItem = permissions[selectedItemIndex]; - const roles = GuildRoleStore.getSortedRoles(guild.id); + const roles = GuildRoleStore.getRolesSnapshot(guild.id); return ( { const member = GuildMemberStore.getMember(guildId, id!)!; - const permissions: RoleOrUserPermission[] = getSortedRolesForMember(guild, member).map(role => ({ - type: PermissionType.Role, - ...role - })); + const permissions: RoleOrUserPermission[] = getSortedRolesForMember(guild, member) + .map(role => ({ + type: PermissionType.Role, + ...role + })); if (guild.ownerId === id) { permissions.push({ diff --git a/src/plugins/permissionsViewer/utils.ts b/src/plugins/permissionsViewer/utils.ts index 2a8efe965..27e7494b7 100644 --- a/src/plugins/permissionsViewer/utils.ts +++ b/src/plugins/permissionsViewer/utils.ts @@ -29,6 +29,7 @@ export const { getGuildPermissionSpecMap } = findByPropsLazy("getGuildPermission export const cl = classNameFactory("vc-permviewer-"); export function getSortedRolesForMember({ id: guildId }: Guild, member: GuildMember) { + // the guild id is the @everyone role return GuildRoleStore .getSortedRoles(guildId) .filter(role => role.id === guildId || member.roles.includes(role.id)); @@ -46,7 +47,8 @@ export function sortUserRoles(roles: Role[]) { } export function sortPermissionOverwrites(overwrites: T[], guildId: string) { - const roles = Object.fromEntries(GuildRoleStore.getSortedRoles(guildId).map(role => [role.id, role] as const)); + const roles = GuildRoleStore.getRolesSnapshot(guildId); + return overwrites.sort((a, b) => { if (a.type !== PermissionType.Role || b.type !== PermissionType.Role) return 0; diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index e3d3301fb..67c2d5c31 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -188,13 +188,13 @@ export default definePlugin({ // Add the hidden eye icon if the channel is hidden { predicate: () => settings.store.showMode === ShowMode.EyeIconRight, - match: /\.name,{.{0,140}\.children.+?:null(?<=,channel:(\i).+?)/, + match: /\.Children\.count.+?:null(?<=,channel:(\i).+?)/, replace: (m, channel) => `${m},$self.isHiddenChannel(${channel})?$self.EyeRightIcon():null` }, // Add the hidden lock icon if the channel is hidden { predicate: () => settings.store.showMode === ShowMode.LockIconRight, - match: /\.name,{.{0,140}\.children.+?:null(?<=,channel:(\i).+?)/, + match: /\.Children\.count.+?:null(?<=,channel:(\i).+?)/, replace: (m, channel) => `${m},$self.isHiddenChannel(${channel})?$self.LockRightIcon():null` }, ] diff --git a/src/plugins/typingIndicator/index.tsx b/src/plugins/typingIndicator/index.tsx index ea6d4d2b2..a54df151d 100644 --- a/src/plugins/typingIndicator/index.tsx +++ b/src/plugins/typingIndicator/index.tsx @@ -173,7 +173,7 @@ export default definePlugin({ { find: "UNREAD_IMPORTANT:", replacement: { - match: /\.name,{.{0,140}\.children.+?:null(?<=,channel:(\i).+?)/, + match: /\.Children\.count.+?:null(?<=,channel:(\i).+?)/, replace: "$&,$self.TypingIndicator($1.id,$1.getGuildId())" } }, diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index 0af91b816..33bbdc198 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -75,6 +75,7 @@ waitForStore("PermissionStore", m => PermissionStore = m); waitForStore("PresenceStore", m => PresenceStore = m); waitForStore("ReadStateStore", m => ReadStateStore = m); waitForStore("GuildChannelStore", m => GuildChannelStore = m); +waitForStore("GuildRoleStore", m => GuildRoleStore = m); waitForStore("MessageStore", m => MessageStore = m); waitForStore("WindowStore", m => WindowStore = m); waitForStore("EmojiStore", m => EmojiStore = m);