Files
mostlymatter/webapp/channels/src/plugins/actions.js
Daniel Espino García d13429aa92 Enable import order (#24091)
* Enable import order

* Add new order groups and add consistent-type-imports

* Remove types group, move react to top and fix issues

* Add store and reducers to the redux group and move imports from types folder to the end

* Fix tsc

* Remove react rule

* Fix test

* Fix eslint disable
2023-09-06 12:51:55 +02:00

30 строки
1.1 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {hideRHSPlugin as hideRHSPluginAction} from 'actions/views/rhs';
import {getPluggableId} from 'selectors/rhs';
import {ActionTypes} from 'utils/constants';
export const removeWebappPlugin = (manifest) => {
return (dispatch) => {
dispatch(hideRHSPlugin(manifest.id));
dispatch({type: ActionTypes.REMOVED_WEBAPP_PLUGIN, data: manifest});
};
};
// hideRHSPlugin closes the RHS if currently showing this plugin.
const hideRHSPlugin = (manifestId) => {
return (dispatch, getState) => {
const state = getState();
const rhsPlugins = state.plugins.components.RightHandSidebarComponent || [];
const pluggableId = getPluggableId(state);
const pluginComponent = rhsPlugins.find((element) => element.id === pluggableId && element.pluginId === manifestId);
// Hide RHS if its showing this plugin
if (pluginComponent) {
dispatch(hideRHSPluginAction(pluggableId));
}
};
};