Browse Source

remove xss filter since react-toastify can handle it

Yuki Takei 1 year ago
parent
commit
dc8ae33c15

+ 2 - 3
apps/app/src/components/Admin/UserGroupDetail/UserGroupDetailPage.tsx

@@ -18,7 +18,6 @@ import { toastSuccess, toastError } from '~/client/util/toastr';
 import type { IExternalUserGroupHasId } from '~/features/external-user-group/interfaces/external-user-group';
 import type { IExternalUserGroupHasId } from '~/features/external-user-group/interfaces/external-user-group';
 import type { PageActionOnGroupDelete, SearchType } from '~/interfaces/user-group';
 import type { PageActionOnGroupDelete, SearchType } from '~/interfaces/user-group';
 import { SearchTypes } from '~/interfaces/user-group';
 import { SearchTypes } from '~/interfaces/user-group';
-import { generalXssFilter } from '~/services/general-xss-filter';
 import { useIsAclEnabled } from '~/stores/context';
 import { useIsAclEnabled } from '~/stores/context';
 import { useUpdateUserGroupConfirmModal } from '~/stores/modal';
 import { useUpdateUserGroupConfirmModal } from '~/stores/modal';
 import { useSWRxUserGroupPages, useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups } from '~/stores/user-group';
 import { useSWRxUserGroupPages, useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups } from '~/stores/user-group';
@@ -220,11 +219,11 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
   const removeUserByUsername = useCallback(async(username: string) => {
   const removeUserByUsername = useCallback(async(username: string) => {
     try {
     try {
       await apiv3Delete(`/user-groups/${currentUserGroupId}/users/${username}`);
       await apiv3Delete(`/user-groups/${currentUserGroupId}/users/${username}`);
-      toastSuccess(`Removed "${generalXssFilter.process(username)}" from "${generalXssFilter.process(currentUserGroup?.name)}"`);
+      toastSuccess(`Removed "${username}" from "${currentUserGroup?.name}"`);
       mutateUserGroupRelationList();
       mutateUserGroupRelationList();
     }
     }
     catch (err) {
     catch (err) {
-      toastError(new Error(`Unable to remove "${generalXssFilter.process(username)}" from "${generalXssFilter.process(currentUserGroup?.name)}"`));
+      toastError(new Error(`Unable to remove "${username}" from "${currentUserGroup?.name}"`));
     }
     }
   }, [currentUserGroup?.name, currentUserGroupId, mutateUserGroupRelationList]);
   }, [currentUserGroup?.name, currentUserGroupId, mutateUserGroupRelationList]);
 
 

+ 2 - 3
apps/app/src/components/Admin/UserGroupDetail/UserGroupUserFormByInput.tsx

@@ -8,7 +8,6 @@ import { AsyncTypeahead } from 'react-bootstrap-typeahead';
 
 
 import { toastSuccess, toastError } from '~/client/util/toastr';
 import { toastSuccess, toastError } from '~/client/util/toastr';
 import type { SearchType } from '~/interfaces/user-group';
 import type { SearchType } from '~/interfaces/user-group';
-import { generalXssFilter } from '~/services/general-xss-filter';
 
 
 type Props = {
 type Props = {
   userGroup: IUserGroupHasId,
   userGroup: IUserGroupHasId,
@@ -36,11 +35,11 @@ export const UserGroupUserFormByInput: FC<Props> = (props) => {
 
 
     try {
     try {
       await onClickAddUserBtn(userName);
       await onClickAddUserBtn(userName);
-      toastSuccess(`Added "${generalXssFilter.process(userName)}" to "${generalXssFilter.process(userGroup.name)}"`);
+      toastSuccess(`Added "${userName}" to "${userGroup.name}"`);
       setInputUser([]);
       setInputUser([]);
     }
     }
     catch (err) {
     catch (err) {
-      toastError(new Error(`Unable to add "${generalXssFilter.process(userName)}" to "${generalXssFilter.process(userGroup.name)}"`));
+      toastError(new Error(`Unable to add "${userName}" to "${userGroup.name}"`));
     }
     }
   };
   };