Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return state;
}
case DELETE_PLAYLIST_START:
return setPlaylistLoading(state, payload.playlistID);
case DELETE_PLAYLIST_COMPLETE:
if (error) {
return setPlaylistLoading(state, meta.playlistID, false);
}
return {
...state,
// When deleting the selected playlist, select the active playlist instead.
selectedPlaylistID: state.selectedPlaylistID === payload.playlistID
? state.activePlaylistID
: state.selectedPlaylistID,
playlists: omit(state.playlists, payload.playlistID),
};
case ADD_MEDIA_START:
return setPlaylistLoading(state, payload.playlistID);
case ADD_MEDIA_COMPLETE:
if (error) {
return setPlaylistLoading(state, meta.playlistID, false);
}
return updatePlaylistAndItems(
state,
payload.playlistID,
(playlist) => ({
...playlist,
loading: false,
size: payload.newSize,
// this is merged in instead of replacing the state, because sometimes the
// JOIN event from the current user comes in before the LOAD event, and then
// the current user is sometimes excluded from the state. it looks like this
// approach could cause problems, too, though.
// TODO maybe replace state instead anyway and merge in the current user?
return {
...state,
...indexBy(payload.users, '_id'),
};
case USER_JOIN:
return {
...state,
[payload.user._id]: payload.user,
};
case USER_LEAVE:
return omit(state, payload.userID);
case CHANGE_USERNAME:
return updateUser(state, payload.userID, (user) => ({
...user,
username: payload.username,
}));
case USER_ADD_ROLES:
return updateUser(state, payload.userID, (user) => ({
...user,
roles: [...user.roles, ...payload.roles],
}));
case USER_REMOVE_ROLES:
return updateUser(state, payload.userID, (user) => ({
...user,
roles: user.roles.filter((role) => !payload.roles.includes(role)),
}));
default:
render() {
const validation = this.context.neoform.getValidation(this.props.name);
return createElement(Target, {
...omit(this.props, 'validator'),
validate: this.validate,
validationStatus: validation.status,
validationMessage: validation.message
});
}
}
this.setState((prevState) => ({
fields: omit(prevState.fields, name)
}));
}
return
}
kvMoves[name].pokemons.push({
...omit(pokemon, 'moves'),
move: {
learnable: move.learnable,
method: move.method,
},
})
return
}
kvMoves[name] = {
...omit(move, ['learnable', 'method']),
pokemons: [
{
...omit(pokemon, 'moves'),
move: {
learnable: move.learnable,
method: move.method,
},
},
],
}
})
})
),
selectedPlaylistID: meta.tempId,
};
}
case CREATE_PLAYLIST_COMPLETE:
if (error) {
return {
...state,
playlists: omit(state.playlists, `${meta.tempId}`),
};
}
return {
...state,
playlists: Object.assign(
deselectAll(omit(state.playlists, `${meta.tempId}`)),
{
[payload.playlist._id]: {
...payload.playlist,
selected: true,
},
},
),
selectedPlaylistID: payload.playlist._id,
};
case RENAME_PLAYLIST_START:
return setPlaylistLoading(state, payload.playlistID);
case RENAME_PLAYLIST_COMPLETE: {
if (error) {
return setPlaylistLoading(state, meta.playlistID, false);
}
const OmitProps = (props) => createElement(Target, (omit(props, propsToOmit)))
import {theme, inputProps} from './input';
const textareaProps = require('!!extract-react-types-loader!../../../../src/textarea/textarea.js');
const TextareaConfig: TConfig = {
imports: {
'baseui/textarea': {named: ['Textarea']},
},
scope: {
Textarea,
SIZE,
ADJOINED,
},
theme,
props: {
...omit(inputProps, ['type', 'startEnhancer', 'endEnhancer']),
overrides: {
value: undefined,
type: PropTypes.Custom,
description: 'Lets you customize all aspects of the component.',
custom: {
names: ['Input', 'InputContainer'],
sharedProps: {
$isFocused: {
type: PropTypes.Boolean,
description: 'True when the component is focused.',
},
$disabled: 'disabled',
$error: 'error',
$positive: 'positive',
$adjoined: 'adjoined',
$size: 'size',
case MUTE_USER:
return {
...state,
mutedUsers: {
...state.mutedUsers,
[payload.userID]: {
mutedBy: payload.moderatorID,
expiresAt: payload.expiresAt,
expirationTimer: payload.expirationTimer,
},
},
};
case UNMUTE_USER:
return {
...state,
mutedUsers: omit(state.mutedUsers, payload.userID),
};
default: {
const nextMessages = reduceNotifications(messages, action);
if (nextMessages !== messages) {
return { ...state, messages: nextMessages };
}
return state;
}
}
}
let name = move.name.toLowerCase()
if (name in kvMoves) {
if (kvMoves[name].pokemons.find((mon) => pokemon.id === mon.id)) {
return
}
kvMoves[name].pokemons.push({
...omit(pokemon, 'moves'),
move: {
learnable: move.learnable,
method: move.method,
},
})
return
}
kvMoves[name] = {
...omit(move, ['learnable', 'method']),
pokemons: [
{
...omit(pokemon, 'moves'),
move: {
learnable: move.learnable,
method: move.method,
},
},
],
}
})
})