<commit_before>import {users as ActionTypes}  from "../actionTypes";
import {updateUsersList, updateUser, removeUser, updateUserRoleList, removeUserRoleFromList} from "../helpers";
const switchCase = [
    {
        condition: ActionTypes.RETRIEVED_USERS,
        functionToRun: (state, action) => {
            return {
                users: action.payload.Results,
                totalUsers: action.payload.TotalResults
            };
        }
    },
    {
        condition: ActionTypes.UPDATE_USER,
        functionToRun: (state, action) => {
            return {
                users: updateUsersList(state.users, action.payload)
            };
        }
    },
    {
        condition: ActionTypes.CREATE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            return {
                users: updateUsersList(state.users, action.payload),
                totalUsers: totalUsers + 1
            };
        }
    },
    {
        condition: ActionTypes.DELETE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            if (action.filter === 3 || action.filter === 5) {
                return {
                    users: updateUsersList(state.users, action.payload)
                };
            }
            else {
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
        }
    },
    {
        condition: ActionTypes.RESTORE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            if (action.filter === 3 || action.filter === 5) {
                return {
                    users: updateUsersList(state.users, action.payload)
                };
            }
            else {
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
        }
    },
    {
        condition: ActionTypes.USER_MADE_SUPERUSER,
        functionToRun: (state, action) => {            
            if (action.filter === 3) {
                let totalUsers = Object.assign(state.totalUsers);
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
        }
    },
    {
        condition: ActionTypes.ERASE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            return {
                users: removeUser(state.users, action.payload.userId),
                totalUsers: totalUsers - 1<commit_msg>DNN-10411: fixed action menu not updated issue<commit_after>import {users as ActionTypes}  from "../actionTypes";
import {updateUsersList, updateUser, removeUser, updateUserRoleList, removeUserRoleFromList} from "../helpers";
const switchCase = [
    {
        condition: ActionTypes.RETRIEVED_USERS,
        functionToRun: (state, action) => {
            return {
                users: action.payload.Results,
                totalUsers: action.payload.TotalResults
            };
        }
    },
    {
        condition: ActionTypes.UPDATE_USER,
        functionToRun: (state, action) => {
            return {
                users: updateUsersList(state.users, action.payload)
            };
        }
    },
    {
        condition: ActionTypes.CREATE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            return {
                users: updateUsersList(state.users, action.payload),
                totalUsers: totalUsers + 1
            };
        }
    },
    {
        condition: ActionTypes.DELETE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            if (action.filter === 3 || action.filter === 5) {
                return {
                    users: updateUsersList(state.users, action.payload)
                };
            }
            else {
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
        }
    },
    {
        condition: ActionTypes.RESTORE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            if (action.filter === 3 || action.filter === 5) {
                return {
                    users: updateUsersList(state.users, action.payload)
                };
            }
            else {
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
        }
    },
    {
        condition: ActionTypes.USER_MADE_SUPERUSER,
        functionToRun: (state, action) => { 
            let totalUsers = Object.assign(state.totalUsers);           
            if (action.filter === 3) {                
                return {
                    users: removeUser(state.users, action.payload.userId),
                    totalUsers: totalUsers - 1
                };
            }
            else {
                return {
                    users: state.users,
                    totalUsers: totalUsers
                };
            }
        }
    },
    {
        condition: ActionTypes.ERASE_USER,
        functionToRun: (state, action) => {
            let totalUsers = Object.assign(state.totalUsers);
            return {
                users: removeUser(state.users, action.payload.userId),
                totalUsers: totalUsers - 1
{'fraction_non_alphanumeric': 0.10015303519809556, 'fraction_numerical': 0.0042509777248767215, 'mean_word_length': 1.3424930306650737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5155994', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1439, 'n_words': 277}