|
|
@@ -1,5 +1,5 @@
|
|
|
import React, {
|
|
|
- useState, useCallback, useEffect, useMemo,
|
|
|
+ useState, useCallback, useEffect,
|
|
|
} from 'react';
|
|
|
|
|
|
import {
|
|
|
@@ -18,7 +18,7 @@ import { toastSuccess, toastError } from '~/client/util/toastr';
|
|
|
import type { IExternalUserGroupHasId } from '~/features/external-user-group/interfaces/external-user-group';
|
|
|
import type { PageActionOnGroupDelete, SearchType } from '~/interfaces/user-group';
|
|
|
import { SearchTypes } from '~/interfaces/user-group';
|
|
|
-import { Xss } from '~/services/xss';
|
|
|
+import { generalXssFilter } from '~/services/general-xss-filter';
|
|
|
import { useIsAclEnabled } from '~/stores/context';
|
|
|
import { useUpdateUserGroupConfirmModal } from '~/stores/modal';
|
|
|
import { useSWRxUserGroupPages, useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups } from '~/stores/user-group';
|
|
|
@@ -54,7 +54,6 @@ type Props = {
|
|
|
const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
const { t } = useTranslation('admin');
|
|
|
const router = useRouter();
|
|
|
- const xss = useMemo(() => new Xss(), []);
|
|
|
const { userGroupId: currentUserGroupId, isExternalGroup } = props;
|
|
|
|
|
|
const { data: currentUserGroup } = useUserGroup(currentUserGroupId, isExternalGroup);
|
|
|
@@ -221,13 +220,13 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
const removeUserByUsername = useCallback(async(username: string) => {
|
|
|
try {
|
|
|
await apiv3Delete(`/user-groups/${currentUserGroupId}/users/${username}`);
|
|
|
- toastSuccess(`Removed "${xss.process(username)}" from "${xss.process(currentUserGroup?.name)}"`);
|
|
|
+ toastSuccess(`Removed "${generalXssFilter.process(username)}" from "${generalXssFilter.process(currentUserGroup?.name)}"`);
|
|
|
mutateUserGroupRelationList();
|
|
|
}
|
|
|
catch (err) {
|
|
|
- toastError(new Error(`Unable to remove "${xss.process(username)}" from "${xss.process(currentUserGroup?.name)}"`));
|
|
|
+ toastError(new Error(`Unable to remove "${generalXssFilter.process(username)}" from "${generalXssFilter.process(currentUserGroup?.name)}"`));
|
|
|
}
|
|
|
- }, [currentUserGroup?.name, currentUserGroupId, mutateUserGroupRelationList, xss]);
|
|
|
+ }, [currentUserGroup?.name, currentUserGroupId, mutateUserGroupRelationList]);
|
|
|
|
|
|
const showUpdateModal = useCallback((group: IUserGroupHasId) => {
|
|
|
setUpdateModalShown(true);
|