mastodon/app/javascript/flavours/glitch/actions/boosts.js
fusagiko / takayamaki 382b2a506a [Glitch] Rewrite actions/modal and reducers/modal with typescript
Port 38c6216082 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2023-05-28 17:49:55 +02:00

33 lines
719 B
JavaScript

import { openModal } from './modal';
export const BOOSTS_INIT_MODAL = 'BOOSTS_INIT_MODAL';
export const BOOSTS_CHANGE_PRIVACY = 'BOOSTS_CHANGE_PRIVACY';
export function initBoostModal(props) {
return (dispatch, getState) => {
const default_privacy = getState().getIn(['compose', 'default_privacy']);
const privacy = props.status.get('visibility') === 'private' ? 'private' : default_privacy;
dispatch({
type: BOOSTS_INIT_MODAL,
privacy,
});
dispatch(openModal({
modalType: 'BOOST',
modalProps: props,
}));
};
}
export function changeBoostPrivacy(privacy) {
return dispatch => {
dispatch({
type: BOOSTS_CHANGE_PRIVACY,
privacy,
});
};
}