mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
fix(ServerCategoryEditor): unselectedRoles shouldn't include @everyone and unsafe roles
This commit is contained in:
parent
5e6b722290
commit
47fa58fd36
1 changed files with 13 additions and 2 deletions
|
@ -4,7 +4,13 @@ import { FaderOpacity } from '@roleypoly/design-system/atoms/fader';
|
|||
import { LargeText } from '@roleypoly/design-system/atoms/typography';
|
||||
import { EditorCategory } from '@roleypoly/design-system/molecules/editor-category';
|
||||
import { CategoryContainer } from '@roleypoly/design-system/organisms/role-picker/RolePicker.styled';
|
||||
import { Category, CategoryType, PresentableGuild, Role } from '@roleypoly/types';
|
||||
import {
|
||||
Category,
|
||||
CategoryType,
|
||||
PresentableGuild,
|
||||
Role,
|
||||
RoleSafety,
|
||||
} from '@roleypoly/types';
|
||||
import KSUID from 'ksuid';
|
||||
import { flatten, sortBy } from 'lodash';
|
||||
import React from 'react';
|
||||
|
@ -33,7 +39,12 @@ export const ServerCategoryEditor = (props: Props) => {
|
|||
|
||||
const unselectedRoles = React.useMemo(() => {
|
||||
const selectedRoles = flatten(props.guild.data.categories.map((c) => c.roles));
|
||||
return props.guild.roles.filter((r) => !selectedRoles.includes(r.id));
|
||||
return props.guild.roles.filter(
|
||||
(r) =>
|
||||
!selectedRoles.includes(r.id) &&
|
||||
r.id !== props.guild.id &&
|
||||
r.safety === RoleSafety.Safe
|
||||
);
|
||||
}, [props.guild.data.categories, props.guild.roles]);
|
||||
|
||||
const updateSingleCategory = (category: Category) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue