2020-07-15 15:50:08 +02:00
|
|
|
// @flow
|
|
|
|
import * as ACTIONS from 'constants/action_types';
|
2020-10-05 20:31:51 +02:00
|
|
|
import { selectPrefsReady } from 'redux/selectors/sync';
|
|
|
|
import { doAlertWaitingForSync } from 'redux/actions/app';
|
2020-07-15 15:50:08 +02:00
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
export const doToggleMuteChannel = (uri: string) => (dispatch: Dispatch, getState: GetState) => {
|
2020-10-05 20:31:51 +02:00
|
|
|
const state = getState();
|
|
|
|
const ready = selectPrefsReady(state);
|
|
|
|
|
|
|
|
if (!ready) {
|
|
|
|
return dispatch(doAlertWaitingForSync());
|
|
|
|
}
|
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
|
|
|
data: {
|
|
|
|
uri,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|