Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
367827c6ec
7 changed files with 14 additions and 9 deletions
|
|
@ -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<string, Role>; }>;
|
||||
getUnsafeMutableRoles(guildId: string): Record<string, Role>;
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<ModalRoot
|
||||
|
|
|
|||
|
|
@ -73,10 +73,11 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
|
|||
.with(MenuItemParentType.User, () => {
|
||||
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({
|
||||
|
|
|
|||
|
|
@ -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<T extends { id: string; type: number; }>(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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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())"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue