Improve Redux types part 6/Remove GenericAction (#26005)
* Remove remaining usage of GenericAction in mapDispatchToProps * Remove usage of GenericAction when testing initial state * Remove usage of GenericAction from reducers * Remove GenericAction
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8e165c7685
Коммит
6c0900f1be
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getUserAudits} from 'mattermost-redux/actions/users';
|
import {getUserAudits} from 'mattermost-redux/actions/users';
|
||||||
import {getCurrentUserId, getUserAudits as getCurrentUserAudits} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId, getUserAudits as getCurrentUserAudits} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {GlobalState} from 'types/store';
|
import type {GlobalState} from 'types/store';
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getUserAudits,
|
getUserAudits,
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {isMarketplaceEnabled} from 'mattermost-redux/selectors/entities/general'
|
|||||||
import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles';
|
import {haveICurrentTeamPermission} from 'mattermost-redux/selectors/entities/roles';
|
||||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {isCombinedUserActivityPost} from 'mattermost-redux/utils/post_list';
|
import {isCombinedUserActivityPost} from 'mattermost-redux/utils/post_list';
|
||||||
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
|
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
|
||||||
import {isSystemAdmin} from 'mattermost-redux/utils/user_utils';
|
import {isSystemAdmin} from 'mattermost-redux/utils/user_utils';
|
||||||
@@ -73,7 +72,7 @@ function mapStateToProps(state: GlobalState, ownProps: Props) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
handleBindingClick,
|
handleBindingClick,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import type {Team} from '@mattermost/types/teams';
|
|||||||
import {getGroupsNotAssociatedToTeam, linkGroupSyncable, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups';
|
import {getGroupsNotAssociatedToTeam, linkGroupSyncable, getAllGroupsAssociatedToTeam} from 'mattermost-redux/actions/groups';
|
||||||
import {getGroupsNotAssociatedToTeam as selectGroupsNotAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups';
|
import {getGroupsNotAssociatedToTeam as selectGroupsNotAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {setModalSearchTerm} from 'actions/views/search';
|
import {setModalSearchTerm} from 'actions/views/search';
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ function mapStateToProps(state: GlobalState, ownProps: Props) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getGroupsNotAssociatedToTeam,
|
getGroupsNotAssociatedToTeam,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getMyTeams} from 'mattermost-redux/selectors/entities/teams';
|
import {getMyTeams} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {deferNavigation} from 'actions/admin_actions.jsx';
|
import {deferNavigation} from 'actions/admin_actions.jsx';
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
@@ -32,7 +31,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
deferNavigation,
|
deferNavigation,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {updateUserRoles} from 'mattermost-redux/actions/users';
|
import {updateUserRoles} from 'mattermost-redux/actions/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {GlobalState} from 'types/store';
|
import type {GlobalState} from 'types/store';
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
updateUserRoles,
|
updateUserRoles,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {updateTeamMemberSchemeRoles, getTeamMembersForUser, getTeamsForUser, removeUserFromTeam} from 'mattermost-redux/actions/teams';
|
import {updateTeamMemberSchemeRoles, getTeamMembersForUser, getTeamsForUser, removeUserFromTeam} from 'mattermost-redux/actions/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getTeamMembersForUser,
|
getTeamMembersForUser,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import type {GlobalState} from '@mattermost/types/store';
|
|||||||
|
|
||||||
import {getTeamStats as loadTeamStats} from 'mattermost-redux/actions/teams';
|
import {getTeamStats as loadTeamStats} from 'mattermost-redux/actions/teams';
|
||||||
import {getTeamStats} from 'mattermost-redux/selectors/entities/teams';
|
import {getTeamStats} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import TeamInList from './team_in_list';
|
import TeamInList from './team_in_list';
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
loadTeamStats,
|
loadTeamStats,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
disablePlugin,
|
disablePlugin,
|
||||||
} from 'mattermost-redux/actions/admin';
|
} from 'mattermost-redux/actions/admin';
|
||||||
import {appsFeatureFlagEnabled} from 'mattermost-redux/selectors/entities/apps';
|
import {appsFeatureFlagEnabled} from 'mattermost-redux/selectors/entities/apps';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import PluginManagement from './plugin_management';
|
import PluginManagement from './plugin_management';
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ function mapStateToProps(state: any) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
uploadPlugin,
|
uploadPlugin,
|
||||||
|
|||||||
@@ -6,11 +6,10 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {revokeUserAccessToken} from 'mattermost-redux/actions/users';
|
import {revokeUserAccessToken} from 'mattermost-redux/actions/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import RevokeTokenButton from './revoke_token_button';
|
import RevokeTokenButton from './revoke_token_button';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
revokeUserAccessToken,
|
revokeUserAccessToken,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getLogs, getPlainLogs} from 'mattermost-redux/actions/admin';
|
import {getLogs, getPlainLogs} from 'mattermost-redux/actions/admin';
|
||||||
import * as Selectors from 'mattermost-redux/selectors/entities/admin';
|
import * as Selectors from 'mattermost-redux/selectors/entities/admin';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {GlobalState} from 'types/store';
|
import type {GlobalState} from 'types/store';
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getLogs,
|
getLogs,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {addUserToTeam} from 'mattermost-redux/actions/teams';
|
|||||||
import {updateUserActive} from 'mattermost-redux/actions/users';
|
import {updateUserActive} from 'mattermost-redux/actions/users';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getUser} from 'mattermost-redux/selectors/entities/users';
|
import {getUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {setNavigationBlocked} from 'actions/admin_actions.jsx';
|
import {setNavigationBlocked} from 'actions/admin_actions.jsx';
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
const apiActions = bindActionCreators({
|
const apiActions = bindActionCreators({
|
||||||
updateUserActive,
|
updateUserActive,
|
||||||
addUserToTeam,
|
addUserToTeam,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
removeUserFromTeam,
|
removeUserFromTeam,
|
||||||
updateTeamMemberSchemeRoles,
|
updateTeamMemberSchemeRoles,
|
||||||
} from 'mattermost-redux/actions/teams';
|
} from 'mattermost-redux/actions/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getTeamsData: getTeamsForUser,
|
getTeamsData: getTeamsForUser,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
import {getTeam as fetchTeam, membersMinusGroupMembers, patchTeam, removeUserFromTeam, updateTeamMemberSchemeRoles, addUserToTeam, deleteTeam, unarchiveTeam} from 'mattermost-redux/actions/teams';
|
import {getTeam as fetchTeam, membersMinusGroupMembers, patchTeam, removeUserFromTeam, updateTeamMemberSchemeRoles, addUserToTeam, deleteTeam, unarchiveTeam} from 'mattermost-redux/actions/teams';
|
||||||
import {getAllGroups, getGroupsAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups';
|
import {getAllGroups, getGroupsAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups';
|
||||||
import {getTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {setNavigationBlocked} from 'actions/admin_actions';
|
import {setNavigationBlocked} from 'actions/admin_actions';
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ function mapStateToProps(state: GlobalState, props: OwnProps) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getTeam: fetchTeam,
|
getTeam: fetchTeam,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {getConfig} from 'mattermost-redux/selectors/entities/admin';
|
|||||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {makeGetCategory} from 'mattermost-redux/selectors/entities/preferences';
|
import {makeGetCategory} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUser, isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser, isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators(
|
actions: bindActionCreators(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type {Dispatch} from 'redux';
|
|||||||
import {savePreferences} from 'mattermost-redux/actions/preferences';
|
import {savePreferences} from 'mattermost-redux/actions/preferences';
|
||||||
import {get as getPreference} from 'mattermost-redux/selectors/entities/preferences';
|
import {get as getPreference} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {dismissNotice} from 'actions/views/notice';
|
import {dismissNotice} from 'actions/views/notice';
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
dismissNotice,
|
dismissNotice,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {incrementAnnouncementBarCount, decrementAnnouncementBarCount} from 'actions/views/announcement_bar';
|
import {incrementAnnouncementBarCount, decrementAnnouncementBarCount} from 'actions/views/announcement_bar';
|
||||||
import {getAnnouncementBarCount} from 'selectors/views/announcement_bar';
|
import {getAnnouncementBarCount} from 'selectors/views/announcement_bar';
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
incrementAnnouncementBarCount,
|
incrementAnnouncementBarCount,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {getConfig, getLicense, warnMetricsStatus as getWarnMetricsStatus} from '
|
|||||||
import {haveISystemPermission} from 'mattermost-redux/selectors/entities/roles';
|
import {haveISystemPermission} from 'mattermost-redux/selectors/entities/roles';
|
||||||
import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||||
import {getDisplayableErrors} from 'mattermost-redux/selectors/errors';
|
import {getDisplayableErrors} from 'mattermost-redux/selectors/errors';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {dismissNotice} from 'actions/views/notice';
|
import {dismissNotice} from 'actions/views/notice';
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
const dismissFirstError = dismissError.bind(null, 0);
|
const dismissFirstError = dismissError.bind(null, 0);
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
import RenewalLink from './renewal_link';
|
import RenewalLink from './renewal_link';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators(
|
actions: bindActionCreators(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getMissingProfilesByIds} from 'mattermost-redux/actions/users';
|
import {getMissingProfilesByIds} from 'mattermost-redux/actions/users';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {GlobalState} from 'types/store';
|
import type {GlobalState} from 'types/store';
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getMissingProfilesByIds,
|
getMissingProfilesByIds,
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {goToLastViewedChannel} from 'actions/views/channel';
|
import {goToLastViewedChannel} from 'actions/views/channel';
|
||||||
|
|
||||||
import CloseChannel from './close_channel';
|
import CloseChannel from './close_channel';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
goToLastViewedChannel,
|
goToLastViewedChannel,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ import type {ConnectedProps} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {leaveChannel} from 'actions/views/channel';
|
import {leaveChannel} from 'actions/views/channel';
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
import LeaveChannel from './leave_channel';
|
import LeaveChannel from './leave_channel';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
leaveChannel,
|
leaveChannel,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {showChannelMembers} from 'actions/views/rhs';
|
import {showChannelMembers} from 'actions/views/rhs';
|
||||||
import {getIsRhsOpen, getRhsState} from 'selectors/rhs';
|
import {getIsRhsOpen, getRhsState} from 'selectors/rhs';
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ const mapStateToProps = (state: GlobalState) => ({
|
|||||||
rhsOpen: getIsRhsOpen(state) && getRhsState(state) === RHSStates.CHANNEL_MEMBERS,
|
rhsOpen: getIsRhsOpen(state) && getRhsState(state) === RHSStates.CHANNEL_MEMBERS,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
showChannelMembers,
|
showChannelMembers,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -6,11 +6,10 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {favoriteChannel, unfavoriteChannel} from 'mattermost-redux/actions/channels';
|
import {favoriteChannel, unfavoriteChannel} from 'mattermost-redux/actions/channels';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import ToggleFavoriteChannel from './toggle_favorite_channel';
|
import ToggleFavoriteChannel from './toggle_favorite_channel';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
favoriteChannel,
|
favoriteChannel,
|
||||||
unfavoriteChannel,
|
unfavoriteChannel,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {closeRightHandSide, showChannelInfo} from 'actions/views/rhs';
|
import {closeRightHandSide, showChannelInfo} from 'actions/views/rhs';
|
||||||
import {getIsRhsOpen, getRhsState} from 'selectors/rhs';
|
import {getIsRhsOpen, getRhsState} from 'selectors/rhs';
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ const mapStateToProps = (state: GlobalState) => ({
|
|||||||
rhsOpen: getIsRhsOpen(state) && getRhsState(state) === RHSStates.CHANNEL_INFO,
|
rhsOpen: getIsRhsOpen(state) && getRhsState(state) === RHSStates.CHANNEL_INFO,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
closeRightHandSide,
|
closeRightHandSide,
|
||||||
showChannelInfo,
|
showChannelInfo,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {closeRightHandSide, showPinnedPosts} from 'actions/views/rhs';
|
import {closeRightHandSide, showPinnedPosts} from 'actions/views/rhs';
|
||||||
import {getRhsState} from 'selectors/rhs';
|
import {getRhsState} from 'selectors/rhs';
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ const mapStateToProps = (state: GlobalState) => ({
|
|||||||
hasPinnedPosts: getRhsState(state) === RHSStates.PIN,
|
hasPinnedPosts: getRhsState(state) === RHSStates.PIN,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
closeRightHandSide,
|
closeRightHandSide,
|
||||||
showPinnedPosts,
|
showPinnedPosts,
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggle as toggleLhs} from 'actions/views/lhs';
|
import {toggle as toggleLhs} from 'actions/views/lhs';
|
||||||
|
|
||||||
import CollapseLhsButton from './collapse_lhs_button';
|
import CollapseLhsButton from './collapse_lhs_button';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
toggleLhs,
|
toggleLhs,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleMenu as toggleRhsMenu} from 'actions/views/rhs';
|
import {toggleMenu as toggleRhsMenu} from 'actions/views/rhs';
|
||||||
|
|
||||||
import CollapseRhsButton from './collapse_rhs_button';
|
import CollapseRhsButton from './collapse_rhs_button';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
toggleRhsMenu,
|
toggleRhsMenu,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openRHSSearch} from 'actions/views/rhs';
|
import {openRHSSearch} from 'actions/views/rhs';
|
||||||
|
|
||||||
import ShowSearchButton from './show_search_button';
|
import ShowSearchButton from './show_search_button';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openRHSSearch,
|
openRHSSearch,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -6,11 +6,10 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {updateChannelNotifyProps} from 'mattermost-redux/actions/channels';
|
import {updateChannelNotifyProps} from 'mattermost-redux/actions/channels';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import UnmuteChannelButton from './unmute_channel_button';
|
import UnmuteChannelButton from './unmute_channel_button';
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: Dispatch<GenericAction>) => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
updateChannelNotifyProps,
|
updateChannelNotifyProps,
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import {withRouter} from 'react-router-dom';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {onChannelByIdentifierEnter} from './actions';
|
import {onChannelByIdentifierEnter} from './actions';
|
||||||
import ChannelIdentifierRouter from './channel_identifier_router';
|
import ChannelIdentifierRouter from './channel_identifier_router';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
onChannelByIdentifierEnter,
|
onChannelByIdentifierEnter,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type {Dispatch} from 'redux';
|
|||||||
import {deleteCustomEmoji} from 'mattermost-redux/actions/emojis';
|
import {deleteCustomEmoji} from 'mattermost-redux/actions/emojis';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getUser, getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getUser, getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {getDisplayNameByUser} from 'utils/utils';
|
import {getDisplayNameByUser} from 'utils/utils';
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ function mapStateToProps(state: GlobalState, ownProps: Props) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
deleteCustomEmoji,
|
deleteCustomEmoji,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
import {getFilesDropdownPluginMenuItems} from 'selectors/plugins';
|
import {getFilesDropdownPluginMenuItems} from 'selectors/plugins';
|
||||||
@@ -29,7 +28,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import type {Post} from '@mattermost/types/posts';
|
|||||||
|
|
||||||
import {makeGetFilesForPost} from 'mattermost-redux/selectors/entities/files';
|
import {makeGetFilesForPost} from 'mattermost-redux/selectors/entities/files';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
@@ -53,7 +52,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import type {Dispatch} from 'redux';
|
|||||||
import type {FileInfo} from '@mattermost/types/files';
|
import type {FileInfo} from '@mattermost/types/files';
|
||||||
|
|
||||||
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import type {GlobalState} from '@mattermost/types/store';
|
|||||||
|
|
||||||
import {getFilePublicLink} from 'mattermost-redux/actions/files';
|
import {getFilePublicLink} from 'mattermost-redux/actions/files';
|
||||||
import * as Selectors from 'mattermost-redux/selectors/entities/files';
|
import * as Selectors from 'mattermost-redux/selectors/entities/files';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import GetPublicLinkModal from './get_public_link_modal';
|
import GetPublicLinkModal from './get_public_link_modal';
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getFilePublicLink,
|
getFilePublicLink,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
|||||||
import {getIsOnboardingFlowEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
import {getIsOnboardingFlowEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
|
import {isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
import {getUserGuideDropdownPluginMenuItems} from 'selectors/plugins';
|
import {getUserGuideDropdownPluginMenuItems} from 'selectors/plugins';
|
||||||
@@ -36,7 +35,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
import SettingsButton from './settings_button';
|
import SettingsButton from './settings_button';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import {getExternalBotAccounts} from 'mattermost-redux/selectors/entities/bots';
|
|||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getAppsBotIDs} from 'mattermost-redux/selectors/entities/integrations';
|
import {getAppsBotIDs} from 'mattermost-redux/selectors/entities/integrations';
|
||||||
import * as UserSelectors from 'mattermost-redux/selectors/entities/users';
|
import * as UserSelectors from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import Bots from './bots';
|
import Bots from './bots';
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
fetchAppsBotIDs,
|
fetchAppsBotIDs,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {loadTranslations} from 'actions/views/root';
|
import {loadTranslations} from 'actions/views/root';
|
||||||
import {getCurrentLocale, getTranslations} from 'selectors/i18n';
|
import {getCurrentLocale, getTranslations} from 'selectors/i18n';
|
||||||
|
|
||||||
@@ -23,7 +21,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
loadTranslations,
|
loadTranslations,
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import {connect} from 'react-redux';
|
|||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {leaveChannel} from 'actions/views/channel';
|
import {leaveChannel} from 'actions/views/channel';
|
||||||
|
|
||||||
import LeaveChannelModal from './leave_channel_modal';
|
import LeaveChannelModal from './leave_channel_modal';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
leaveChannel,
|
leaveChannel,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {removeUserFromTeam as leaveTeam} from 'mattermost-redux/actions/teams';
|
|||||||
import {getMyChannels} from 'mattermost-redux/selectors/entities/channels';
|
import {getMyChannels} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getCurrentUserId, getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId, getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleSideBarRightMenuAction} from 'actions/global_actions';
|
import {toggleSideBarRightMenuAction} from 'actions/global_actions';
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
leaveTeam,
|
leaveTeam,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {autoUpdateTimezone} from 'mattermost-redux/actions/timezone';
|
|||||||
import {getChannel, getCurrentChannelId, isManuallyUnread} from 'mattermost-redux/selectors/entities/channels';
|
import {getChannel, getCurrentChannelId, isManuallyUnread} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import {getLicense, getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getLicense, getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getCurrentUser, shouldShowTermsOfService} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser, shouldShowTermsOfService} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction, ThunkActionFunc} from 'mattermost-redux/types/actions';
|
import type {ThunkActionFunc} from 'mattermost-redux/types/actions';
|
||||||
|
|
||||||
import {getChannelURL} from 'selectors/urls';
|
import {getChannelURL} from 'selectors/urls';
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ const getChannelURLAction = (channelId: string, teamId: string, url: string): Th
|
|||||||
return getHistory().push(getChannelURL(state, channel, teamId));
|
return getHistory().push(getChannelURL(state, channel, teamId));
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
autoUpdateTimezone,
|
autoUpdateTimezone,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import {
|
|||||||
getCurrentRelativeTeamUrl,
|
getCurrentRelativeTeamUrl,
|
||||||
} from 'mattermost-redux/selectors/entities/teams';
|
} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getCurrentUser, isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser, isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
import {showMentions, showFlaggedPosts, closeRightHandSide, closeMenu as closeRhsMenu} from 'actions/views/rhs';
|
import {showMentions, showFlaggedPosts, closeRightHandSide, closeMenu as closeRhsMenu} from 'actions/views/rhs';
|
||||||
@@ -94,7 +93,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import type {Post} from '@mattermost/types/posts';
|
|||||||
import {createSelector} from 'mattermost-redux/selectors/create_selector';
|
import {createSelector} from 'mattermost-redux/selectors/create_selector';
|
||||||
import {makeGetPostsForThread} from 'mattermost-redux/selectors/entities/posts';
|
import {makeGetPostsForThread} from 'mattermost-redux/selectors/entities/posts';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {updateThreadToastStatus} from 'actions/views/threads';
|
import {updateThreadToastStatus} from 'actions/views/threads';
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
updateThreadToastStatus,
|
updateThreadToastStatus,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
|||||||
import {get} from 'mattermost-redux/selectors/entities/preferences';
|
import {get} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getProfilesInCurrentChannel, getCurrentUserId, getUser, getTotalUsersStats as getTotalUsersStatsSelector} from 'mattermost-redux/selectors/entities/users';
|
import {getProfilesInCurrentChannel, getCurrentUserId, getUser, getTotalUsersStats as getTotalUsersStatsSelector} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
|
|
||||||
@@ -54,7 +53,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getTotalUsersStats,
|
getTotalUsersStats,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {getMissingProfilesByIds, getMissingProfilesByUsernames} from 'mattermost
|
|||||||
import {Preferences} from 'mattermost-redux/constants';
|
import {Preferences} from 'mattermost-redux/constants';
|
||||||
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUser, makeGetProfilesByIdsAndUsernames} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser, makeGetProfilesByIdsAndUsernames} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import CombinedSystemMessage from './combined_system_message';
|
import CombinedSystemMessage from './combined_system_message';
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getMissingProfilesByIds,
|
getMissingProfilesByIds,
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {removePost} from 'mattermost-redux/actions/posts';
|
import {removePost} from 'mattermost-redux/actions/posts';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {createPost} from 'actions/post_actions';
|
import {createPost} from 'actions/post_actions';
|
||||||
|
|
||||||
import FailedPostOptions from './failed_post_options';
|
import FailedPostOptions from './failed_post_options';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
createPost,
|
createPost,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {removePost} from 'mattermost-redux/actions/posts';
|
|||||||
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import {getPost} from 'mattermost-redux/selectors/entities/posts';
|
import {getPost} from 'mattermost-redux/selectors/entities/posts';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import PostAddChannelMember from './post_add_channel_member';
|
import PostAddChannelMember from './post_add_channel_member';
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
addChannelMember,
|
addChannelMember,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
|||||||
import {getOpenGraphMetadataForUrl} from 'mattermost-redux/selectors/entities/posts';
|
import {getOpenGraphMetadataForUrl} from 'mattermost-redux/selectors/entities/posts';
|
||||||
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {editPost} from 'actions/views/posts';
|
import {editPost} from 'actions/views/posts';
|
||||||
import {arePreviewsCollapsed} from 'selectors/preferences';
|
import {arePreviewsCollapsed} from 'selectors/preferences';
|
||||||
@@ -45,7 +44,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({editPost}, dispatch),
|
actions: bindActionCreators({editPost}, dispatch),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
|
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleEmbedVisibility} from 'actions/post_actions';
|
import {toggleEmbedVisibility} from 'actions/post_actions';
|
||||||
import {isEmbedVisible} from 'selectors/posts';
|
import {isEmbedVisible} from 'selectors/posts';
|
||||||
@@ -27,7 +26,7 @@ function mapStateToProps(state: GlobalState, ownProps: Omit<Props, 'appsEnabled'
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({toggleEmbedVisibility}, dispatch),
|
actions: bindActionCreators({toggleEmbedVisibility}, dispatch),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {getCloudLimits, getCloudLimitsLoaded} from 'mattermost-redux/selectors/e
|
|||||||
import {getCurrentChannelId, getCurrentUserId} from 'mattermost-redux/selectors/entities/common';
|
import {getCurrentChannelId, getCurrentUserId} from 'mattermost-redux/selectors/entities/common';
|
||||||
import {getLimitedViews, getPost} from 'mattermost-redux/selectors/entities/posts';
|
import {getLimitedViews, getPost} from 'mattermost-redux/selectors/entities/posts';
|
||||||
import {getUsage} from 'mattermost-redux/selectors/entities/usage';
|
import {getUsage} from 'mattermost-redux/selectors/entities/usage';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {emitShortcutReactToLastPostFrom} from 'actions/post_actions';
|
import {emitShortcutReactToLastPostFrom} from 'actions/post_actions';
|
||||||
import {getShortcutReactToLastPostEmittedFrom} from 'selectors/emojis';
|
import {getShortcutReactToLastPostEmittedFrom} from 'selectors/emojis';
|
||||||
@@ -56,7 +55,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
emitShortcutReactToLastPostFrom,
|
emitShortcutReactToLastPostFrom,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {getPost, isPostPriorityEnabled} from 'mattermost-redux/selectors/entitie
|
|||||||
import {get} from 'mattermost-redux/selectors/entities/preferences';
|
import {get} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getUser} from 'mattermost-redux/selectors/entities/users';
|
import {getUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleEmbedVisibility} from 'actions/post_actions';
|
import {toggleEmbedVisibility} from 'actions/post_actions';
|
||||||
import {isEmbedVisible} from 'selectors/posts';
|
import {isEmbedVisible} from 'selectors/posts';
|
||||||
@@ -67,7 +66,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({toggleEmbedVisibility}, dispatch),
|
actions: bindActionCreators({toggleEmbedVisibility}, dispatch),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import type {Emoji} from '@mattermost/types/emojis';
|
import type {Emoji} from '@mattermost/types/emojis';
|
||||||
|
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleReaction} from 'actions/post_actions';
|
import {toggleReaction} from 'actions/post_actions';
|
||||||
import {getEmojiMap} from 'selectors/emojis';
|
import {getEmojiMap} from 'selectors/emojis';
|
||||||
import {getCurrentLocale} from 'selectors/i18n';
|
import {getCurrentLocale} from 'selectors/i18n';
|
||||||
@@ -17,7 +15,7 @@ import type {GlobalState} from 'types/store';
|
|||||||
|
|
||||||
import PostReaction from './post_recent_reactions';
|
import PostReaction from './post_recent_reactions';
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
toggleReaction,
|
toggleReaction,
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {createSelector} from 'mattermost-redux/selectors/create_selector';
|
|||||||
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
|
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';
|
||||||
import {canAddReactions, canRemoveReactions} from 'mattermost-redux/selectors/entities/reactions';
|
import {canAddReactions, canRemoveReactions} from 'mattermost-redux/selectors/entities/reactions';
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {getEmojiImageUrl} from 'mattermost-redux/utils/emoji_utils';
|
import {getEmojiImageUrl} from 'mattermost-redux/utils/emoji_utils';
|
||||||
|
|
||||||
import {addReaction} from 'actions/post_actions';
|
import {addReaction} from 'actions/post_actions';
|
||||||
@@ -69,7 +68,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
addReaction,
|
addReaction,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import type {Post} from '@mattermost/types/posts';
|
|||||||
|
|
||||||
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import {canAddReactions} from 'mattermost-redux/selectors/entities/reactions';
|
import {canAddReactions} from 'mattermost-redux/selectors/entities/reactions';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleReaction} from 'actions/post_actions';
|
import {toggleReaction} from 'actions/post_actions';
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
toggleReaction,
|
toggleReaction,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {bindActionCreators} from 'redux';
|
|||||||
import type {Dispatch} from 'redux';
|
import type {Dispatch} from 'redux';
|
||||||
|
|
||||||
import {getMyTeams} from 'mattermost-redux/selectors/entities/teams';
|
import {getMyTeams} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {setUnreadFilterEnabled} from 'actions/views/channel_sidebar';
|
import {setUnreadFilterEnabled} from 'actions/views/channel_sidebar';
|
||||||
import {isUnreadFilterEnabled} from 'selectors/views/channel_sidebar';
|
import {isUnreadFilterEnabled} from 'selectors/views/channel_sidebar';
|
||||||
@@ -24,7 +23,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
setUnreadFilterEnabled,
|
setUnreadFilterEnabled,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {makeGetChannelUnreadCount} from 'mattermost-redux/selectors/entities/cha
|
|||||||
import {getCurrentUserId, getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common';
|
import {getCurrentUserId, getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getInt} from 'mattermost-redux/selectors/entities/preferences';
|
import {getInt} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {isChannelMuted} from 'mattermost-redux/utils/channel_utils';
|
import {isChannelMuted} from 'mattermost-redux/utils/channel_utils';
|
||||||
|
|
||||||
import {markMostRecentPostInChannelAsUnread, unsetEditingPost} from 'actions/post_actions';
|
import {markMostRecentPostInChannelAsUnread, unsetEditingPost} from 'actions/post_actions';
|
||||||
@@ -67,7 +66,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
markMostRecentPostInChannelAsUnread,
|
markMostRecentPostInChannelAsUnread,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {getCurrentChannelId, getUnreadChannelIds} from 'mattermost-redux/selecto
|
|||||||
import {shouldShowUnreadsCategory, isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
import {shouldShowUnreadsCategory, isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getThreadCountsInCurrentTeam} from 'mattermost-redux/selectors/entities/threads';
|
import {getThreadCountsInCurrentTeam} from 'mattermost-redux/selectors/entities/threads';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {switchToChannelById} from 'actions/views/channel';
|
import {switchToChannelById} from 'actions/views/channel';
|
||||||
import {
|
import {
|
||||||
@@ -59,7 +58,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
close,
|
close,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openMenu as openRhsMenu} from 'actions/views/rhs';
|
import {openMenu as openRhsMenu} from 'actions/views/rhs';
|
||||||
import {getIsRhsMenuOpen} from 'selectors/rhs';
|
import {getIsRhsMenuOpen} from 'selectors/rhs';
|
||||||
@@ -31,7 +30,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openRhsMenu,
|
openRhsMenu,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type {Dispatch} from 'redux';
|
|||||||
|
|
||||||
import {getFilePublicLink} from 'mattermost-redux/actions/files';
|
import {getFilePublicLink} from 'mattermost-redux/actions/files';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {toggleEmbedVisibility} from 'actions/post_actions';
|
import {toggleEmbedVisibility} from 'actions/post_actions';
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
@@ -28,7 +27,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
toggleEmbedVisibility,
|
toggleEmbedVisibility,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {Preferences} from 'mattermost-redux/constants';
|
|||||||
import {get, getBool, getInt} from 'mattermost-redux/selectors/entities/preferences';
|
import {get, getBool, getInt} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone';
|
import {getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone';
|
||||||
import {getCurrentUser, getStatusForUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser, getStatusForUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {openModal} from 'actions/views/modals';
|
import {openModal} from 'actions/views/modals';
|
||||||
import {setStatusDropdown} from 'actions/views/status_dropdown';
|
import {setStatusDropdown} from 'actions/views/status_dropdown';
|
||||||
@@ -58,7 +57,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
openModal,
|
openModal,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import {getUser, updateUserActive} from 'mattermost-redux/actions/users';
|
|||||||
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentRelativeTeamUrl, getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentRelativeTeamUrl, getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {removeUserFromTeamAndGetStats} from 'actions/team_actions';
|
import {removeUserFromTeamAndGetStats} from 'actions/team_actions';
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
getMyTeamMembers,
|
getMyTeamMembers,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import {isCollapsedThreadsEnabled} from 'mattermost-redux/selectors/entities/pre
|
|||||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import {getThread} from 'mattermost-redux/selectors/entities/threads';
|
import {getThread} from 'mattermost-redux/selectors/entities/threads';
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {selectPostCard} from 'actions/views/rhs';
|
import {selectPostCard} from 'actions/views/rhs';
|
||||||
import {updateThreadLastOpened} from 'actions/views/threads';
|
import {updateThreadLastOpened} from 'actions/views/threads';
|
||||||
@@ -71,7 +70,7 @@ function makeMapStateToProps() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
fetchRHSAppsBindings,
|
fetchRHSAppsBindings,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import type {GlobalState} from '@mattermost/types/store';
|
|||||||
import {getCurrentChannel, getUnreadStatus} from 'mattermost-redux/selectors/entities/channels';
|
import {getCurrentChannel, getUnreadStatus} from 'mattermost-redux/selectors/entities/channels';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import UnreadsStatusHandler from './unreads_status_handler';
|
import UnreadsStatusHandler from './unreads_status_handler';
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ function mapStateToProps(state: GlobalState, {location: {pathname}}: Props): Com
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
}, dispatch),
|
}, dispatch),
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {Preferences} from 'mattermost-redux/constants';
|
|||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||||
import {get as getPreference} from 'mattermost-redux/selectors/entities/preferences';
|
import {get as getPreference} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions.js';
|
|
||||||
|
|
||||||
import type {GlobalState} from 'types/store';
|
import type {GlobalState} from 'types/store';
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ export function mapStateToProps(state: GlobalState) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
|
function mapDispatchToProps(dispatch: Dispatch) {
|
||||||
return {
|
return {
|
||||||
actions: bindActionCreators({
|
actions: bindActionCreators({
|
||||||
savePreferences,
|
savePreferences,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type {ServerError} from '@mattermost/types/errors';
|
|||||||
|
|
||||||
import {UserTypes} from 'mattermost-redux/action_types';
|
import {UserTypes} from 'mattermost-redux/action_types';
|
||||||
import {Client4} from 'mattermost-redux/client';
|
import {Client4} from 'mattermost-redux/client';
|
||||||
import type {GenericAction, DispatchFunc, GetStateFunc, NewActionFuncAsync} from 'mattermost-redux/types/actions';
|
import type {DispatchFunc, GetStateFunc, NewActionFuncAsync} from 'mattermost-redux/types/actions';
|
||||||
|
|
||||||
import {logError} from './errors';
|
import {logError} from './errors';
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ function dispatcher(type: ActionType, data: any, dispatch: DispatchFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function requestData(type: ActionType): GenericAction {
|
export function requestData(type: ActionType) {
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
data: null,
|
data: null,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import {AdminTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {AdminTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import PluginState from 'mattermost-redux/constants/plugins';
|
import PluginState from 'mattermost-redux/constants/plugins';
|
||||||
import reducer, {convertAnalyticsRowsToStats} from 'mattermost-redux/reducers/entities/admin';
|
import reducer, {convertAnalyticsRowsToStats} from 'mattermost-redux/reducers/entities/admin';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import deepFreezeAndThrowOnMutation from 'mattermost-redux/utils/deep_freeze';
|
import deepFreezeAndThrowOnMutation from 'mattermost-redux/utils/deep_freeze';
|
||||||
|
|
||||||
type ReducerState = ReturnType<typeof reducer>;
|
type ReducerState = ReturnType<typeof reducer>;
|
||||||
@@ -13,10 +12,10 @@ describe('reducers.entities.admin', () => {
|
|||||||
describe('pluginStatuses', () => {
|
describe('pluginStatuses', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = {};
|
const state = {};
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {};
|
const expectedState = {};
|
||||||
|
|
||||||
const actualState = reducer({pluginStatuses: state} as ReducerState, action as GenericAction);
|
const actualState = reducer({pluginStatuses: state} as ReducerState, action);
|
||||||
expect(actualState.pluginStatuses).toEqual(expectedState);
|
expect(actualState.pluginStatuses).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -602,10 +601,10 @@ describe('reducers.entities.admin', () => {
|
|||||||
describe('ldapGroups', () => {
|
describe('ldapGroups', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = {};
|
const state = {};
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {};
|
const expectedState = {};
|
||||||
|
|
||||||
const actualState = reducer({ldapGroups: state} as ReducerState, action as GenericAction);
|
const actualState = reducer({ldapGroups: state} as ReducerState, action);
|
||||||
expect(actualState.ldapGroups).toEqual(expectedState);
|
expect(actualState.ldapGroups).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -868,10 +867,10 @@ describe('reducers.entities.admin', () => {
|
|||||||
describe('Data Retention', () => {
|
describe('Data Retention', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = {};
|
const state = {};
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {};
|
const expectedState = {};
|
||||||
|
|
||||||
const actualState = reducer({dataRetentionCustomPolicies: state} as ReducerState, action as GenericAction);
|
const actualState = reducer({dataRetentionCustomPolicies: state} as ReducerState, action);
|
||||||
expect(actualState.dataRetentionCustomPolicies).toEqual(expectedState);
|
expect(actualState.dataRetentionCustomPolicies).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {ClusterInfo, AnalyticsRow} from '@mattermost/types/admin';
|
import type {ClusterInfo, AnalyticsRow} from '@mattermost/types/admin';
|
||||||
@@ -18,9 +19,8 @@ import type {RelationOneToOne, IDMappedObjects} from '@mattermost/types/utilitie
|
|||||||
import {AdminTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {AdminTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import {Stats} from 'mattermost-redux/constants';
|
import {Stats} from 'mattermost-redux/constants';
|
||||||
import PluginState from 'mattermost-redux/constants/plugins';
|
import PluginState from 'mattermost-redux/constants/plugins';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function logs(state: string[] = [], action: GenericAction) {
|
function logs(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_LOGS: {
|
case AdminTypes.RECEIVED_LOGS: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -33,7 +33,7 @@ function logs(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function plainLogs(state: string[] = [], action: GenericAction) {
|
function plainLogs(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_PLAIN_LOGS: {
|
case AdminTypes.RECEIVED_PLAIN_LOGS: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -46,7 +46,7 @@ function plainLogs(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function audits(state: Record<string, Audit> = {}, action: GenericAction) {
|
function audits(state: Record<string, Audit> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_AUDITS: {
|
case AdminTypes.RECEIVED_AUDITS: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -63,7 +63,7 @@ function audits(state: Record<string, Audit> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function config(state: Partial<AdminConfig> = {}, action: GenericAction) {
|
function config(state: Partial<AdminConfig> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_CONFIG: {
|
case AdminTypes.RECEIVED_CONFIG: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -90,7 +90,7 @@ function config(state: Partial<AdminConfig> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevTrialLicense(state: Partial<AdminConfig> = {}, action: GenericAction) {
|
function prevTrialLicense(state: Partial<AdminConfig> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.PREV_TRIAL_LICENSE_SUCCESS: {
|
case AdminTypes.PREV_TRIAL_LICENSE_SUCCESS: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -100,7 +100,7 @@ function prevTrialLicense(state: Partial<AdminConfig> = {}, action: GenericActio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function environmentConfig(state: Partial<EnvironmentConfig> = {}, action: GenericAction) {
|
function environmentConfig(state: Partial<EnvironmentConfig> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_ENVIRONMENT_CONFIG: {
|
case AdminTypes.RECEIVED_ENVIRONMENT_CONFIG: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -113,7 +113,7 @@ function environmentConfig(state: Partial<EnvironmentConfig> = {}, action: Gener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function complianceReports(state: Record<string, Compliance> = {}, action: GenericAction) {
|
function complianceReports(state: Record<string, Compliance> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_COMPLIANCE_REPORT: {
|
case AdminTypes.RECEIVED_COMPLIANCE_REPORT: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -135,7 +135,7 @@ function complianceReports(state: Record<string, Compliance> = {}, action: Gener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clusterInfo(state: ClusterInfo[] = [], action: GenericAction) {
|
function clusterInfo(state: ClusterInfo[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_CLUSTER_STATUS: {
|
case AdminTypes.RECEIVED_CLUSTER_STATUS: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -148,7 +148,7 @@ function clusterInfo(state: ClusterInfo[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function samlCertStatus(state: Partial<SamlCertificateStatus> = {}, action: GenericAction) {
|
function samlCertStatus(state: Partial<SamlCertificateStatus> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_SAML_CERT_STATUS: {
|
case AdminTypes.RECEIVED_SAML_CERT_STATUS: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -250,7 +250,7 @@ export function convertAnalyticsRowsToStats(data: AnalyticsRow[], name: string):
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
function analytics(state: Record<string, number | AnalyticsRow[]> = {}, action: GenericAction) {
|
function analytics(state: Record<string, number | AnalyticsRow[]> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_SYSTEM_ANALYTICS: {
|
case AdminTypes.RECEIVED_SYSTEM_ANALYTICS: {
|
||||||
const stats = convertAnalyticsRowsToStats(action.data, action.name);
|
const stats = convertAnalyticsRowsToStats(action.data, action.name);
|
||||||
@@ -264,7 +264,7 @@ function analytics(state: Record<string, number | AnalyticsRow[]> = {}, action:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function teamAnalytics(state: RelationOneToOne<Team, Record<string, number | AnalyticsRow[]>> = {}, action: GenericAction) {
|
function teamAnalytics(state: RelationOneToOne<Team, Record<string, number | AnalyticsRow[]>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_TEAM_ANALYTICS: {
|
case AdminTypes.RECEIVED_TEAM_ANALYTICS: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -281,7 +281,7 @@ function teamAnalytics(state: RelationOneToOne<Team, Record<string, number | Ana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAccessTokens(state: Record<string, UserAccessToken> = {}, action: GenericAction) {
|
function userAccessTokens(state: Record<string, UserAccessToken> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_USER_ACCESS_TOKEN: {
|
case AdminTypes.RECEIVED_USER_ACCESS_TOKEN: {
|
||||||
return {...state, [action.data.id]: action.data};
|
return {...state, [action.data.id]: action.data};
|
||||||
@@ -324,7 +324,7 @@ function userAccessTokens(state: Record<string, UserAccessToken> = {}, action: G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAccessTokensByUser(state: RelationOneToOne<UserProfile, Record<string, UserAccessToken>> = {}, action: GenericAction) {
|
function userAccessTokensByUser(state: RelationOneToOne<UserProfile, Record<string, UserAccessToken>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_USER_ACCESS_TOKEN: { // UserAccessToken
|
case AdminTypes.RECEIVED_USER_ACCESS_TOKEN: { // UserAccessToken
|
||||||
const nextUserState: UserAccessToken | Record<string, UserAccessToken> = {...(state[action.data.user_id] || {})};
|
const nextUserState: UserAccessToken | Record<string, UserAccessToken> = {...(state[action.data.user_id] || {})};
|
||||||
@@ -400,7 +400,7 @@ function userAccessTokensByUser(state: RelationOneToOne<UserProfile, Record<stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugins(state: Record<string, PluginRedux> = {}, action: GenericAction) {
|
function plugins(state: Record<string, PluginRedux> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_PLUGINS: {
|
case AdminTypes.RECEIVED_PLUGINS: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -446,7 +446,7 @@ function plugins(state: Record<string, PluginRedux> = {}, action: GenericAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginStatuses(state: Record<string, PluginStatusRedux> = {}, action: GenericAction) {
|
function pluginStatuses(state: Record<string, PluginStatusRedux> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_PLUGIN_STATUSES: {
|
case AdminTypes.RECEIVED_PLUGIN_STATUSES: {
|
||||||
const nextState: any = {};
|
const nextState: any = {};
|
||||||
@@ -547,7 +547,7 @@ function pluginStatuses(state: Record<string, PluginStatusRedux> = {}, action: G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ldapGroupsCount(state = 0, action: GenericAction) {
|
function ldapGroupsCount(state = 0, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_LDAP_GROUPS:
|
case AdminTypes.RECEIVED_LDAP_GROUPS:
|
||||||
return action.data.count;
|
return action.data.count;
|
||||||
@@ -558,7 +558,7 @@ function ldapGroupsCount(state = 0, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ldapGroups(state: Record<string, MixedUnlinkedGroupRedux> = {}, action: GenericAction) {
|
function ldapGroups(state: Record<string, MixedUnlinkedGroupRedux> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_LDAP_GROUPS: {
|
case AdminTypes.RECEIVED_LDAP_GROUPS: {
|
||||||
const nextState: any = {};
|
const nextState: any = {};
|
||||||
@@ -614,7 +614,7 @@ function ldapGroups(state: Record<string, MixedUnlinkedGroupRedux> = {}, action:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function samlMetadataResponse(state: Partial<SamlMetadataResponse> = {}, action: GenericAction) {
|
function samlMetadataResponse(state: Partial<SamlMetadataResponse> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_SAML_METADATA_RESPONSE: {
|
case AdminTypes.RECEIVED_SAML_METADATA_RESPONSE: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -624,7 +624,7 @@ function samlMetadataResponse(state: Partial<SamlMetadataResponse> = {}, action:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dataRetentionCustomPolicies(state: IDMappedObjects<DataRetentionCustomPolicy> = {}, action: GenericAction): IDMappedObjects<DataRetentionCustomPolicy> {
|
function dataRetentionCustomPolicies(state: IDMappedObjects<DataRetentionCustomPolicy> = {}, action: AnyAction): IDMappedObjects<DataRetentionCustomPolicy> {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.CREATE_DATA_RETENTION_CUSTOM_POLICY_SUCCESS:
|
case AdminTypes.CREATE_DATA_RETENTION_CUSTOM_POLICY_SUCCESS:
|
||||||
case AdminTypes.RECEIVED_DATA_RETENTION_CUSTOM_POLICY:
|
case AdminTypes.RECEIVED_DATA_RETENTION_CUSTOM_POLICY:
|
||||||
@@ -658,7 +658,7 @@ function dataRetentionCustomPolicies(state: IDMappedObjects<DataRetentionCustomP
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function dataRetentionCustomPoliciesCount(state = 0, action: GenericAction) {
|
function dataRetentionCustomPoliciesCount(state = 0, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AdminTypes.RECEIVED_DATA_RETENTION_CUSTOM_POLICIES:
|
case AdminTypes.RECEIVED_DATA_RETENTION_CUSTOM_POLICIES:
|
||||||
return action.data.total_count;
|
return action.data.total_count;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {AppBinding, AppCommandFormMap, AppsState} from '@mattermost/types/apps';
|
import type {AppBinding, AppCommandFormMap} from '@mattermost/types/apps';
|
||||||
|
|
||||||
import {AppsTypes} from 'mattermost-redux/action_types';
|
import {AppsTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {validateBindings} from 'mattermost-redux/utils/apps';
|
import {validateBindings} from 'mattermost-redux/utils/apps';
|
||||||
|
|
||||||
export function mainBindings(state: AppBinding[] = [], action: GenericAction): AppBinding[] {
|
export function mainBindings(state: AppBinding[] = [], action: AnyAction): AppBinding[] {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AppsTypes.FAILED_TO_FETCH_APP_BINDINGS: {
|
case AppsTypes.FAILED_TO_FETCH_APP_BINDINGS: {
|
||||||
if (!state.length) {
|
if (!state.length) {
|
||||||
@@ -34,7 +34,7 @@ export function mainBindings(state: AppBinding[] = [], action: GenericAction): A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mainForms(state: AppCommandFormMap = {}, action: GenericAction): AppCommandFormMap {
|
function mainForms(state: AppCommandFormMap = {}, action: AnyAction): AppCommandFormMap {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AppsTypes.RECEIVED_APP_BINDINGS:
|
case AppsTypes.RECEIVED_APP_BINDINGS:
|
||||||
return {};
|
return {};
|
||||||
@@ -56,7 +56,7 @@ const main = combineReducers({
|
|||||||
forms: mainForms,
|
forms: mainForms,
|
||||||
});
|
});
|
||||||
|
|
||||||
function rhsBindings(state: AppBinding[] = [], action: GenericAction): AppBinding[] {
|
function rhsBindings(state: AppBinding[] = [], action: AnyAction): AppBinding[] {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AppsTypes.RECEIVED_APP_RHS_BINDINGS: {
|
case AppsTypes.RECEIVED_APP_RHS_BINDINGS: {
|
||||||
const bindings = action.data;
|
const bindings = action.data;
|
||||||
@@ -67,7 +67,7 @@ function rhsBindings(state: AppBinding[] = [], action: GenericAction): AppBindin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function rhsForms(state: AppCommandFormMap = {}, action: GenericAction): AppCommandFormMap {
|
function rhsForms(state: AppCommandFormMap = {}, action: AnyAction): AppCommandFormMap {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AppsTypes.RECEIVED_APP_RHS_BINDINGS:
|
case AppsTypes.RECEIVED_APP_RHS_BINDINGS:
|
||||||
return {};
|
return {};
|
||||||
@@ -89,7 +89,7 @@ const rhs = combineReducers({
|
|||||||
forms: rhsForms,
|
forms: rhsForms,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function pluginEnabled(state = true, action: GenericAction): boolean {
|
export function pluginEnabled(state = true, action: AnyAction): boolean {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AppsTypes.APPS_PLUGIN_ENABLED: {
|
case AppsTypes.APPS_PLUGIN_ENABLED: {
|
||||||
return true;
|
return true;
|
||||||
@@ -109,8 +109,8 @@ export function pluginEnabled(state = true, action: GenericAction): boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (combineReducers({
|
export default combineReducers({
|
||||||
main,
|
main,
|
||||||
rhs,
|
rhs,
|
||||||
pluginEnabled,
|
pluginEnabled,
|
||||||
}) as (b: AppsState, a: GenericAction) => AppsState);
|
});
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Bot} from '@mattermost/types/bots';
|
import type {Bot} from '@mattermost/types/bots';
|
||||||
|
|
||||||
import {BotTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {BotTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function accounts(state: Record<string, Bot> = {}, action: GenericAction) {
|
function accounts(state: Record<string, Bot> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case BotTypes.RECEIVED_BOT_ACCOUNTS: {
|
case BotTypes.RECEIVED_BOT_ACCOUNTS: {
|
||||||
const newBots = action.data;
|
const newBots = action.data;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {ChannelCategory} from '@mattermost/types/channel_categories';
|
import type {ChannelCategory} from '@mattermost/types/channel_categories';
|
||||||
@@ -9,10 +10,9 @@ import type {Team} from '@mattermost/types/teams';
|
|||||||
import type {IDMappedObjects, RelationOneToOne} from '@mattermost/types/utilities';
|
import type {IDMappedObjects, RelationOneToOne} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {ChannelCategoryTypes, TeamTypes, UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
import {ChannelCategoryTypes, TeamTypes, UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {removeItem} from 'mattermost-redux/utils/array_utils';
|
import {removeItem} from 'mattermost-redux/utils/array_utils';
|
||||||
|
|
||||||
export function byId(state: IDMappedObjects<ChannelCategory> = {}, action: GenericAction) {
|
export function byId(state: IDMappedObjects<ChannelCategory> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelCategoryTypes.RECEIVED_CATEGORIES: {
|
case ChannelCategoryTypes.RECEIVED_CATEGORIES: {
|
||||||
const categories: ChannelCategory[] = action.data;
|
const categories: ChannelCategory[] = action.data;
|
||||||
@@ -132,7 +132,7 @@ export function byId(state: IDMappedObjects<ChannelCategory> = {}, action: Gener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function orderByTeam(state: RelationOneToOne<Team, Array<ChannelCategory['id']>> = {}, action: GenericAction) {
|
export function orderByTeam(state: RelationOneToOne<Team, Array<ChannelCategory['id']>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelCategoryTypes.RECEIVED_CATEGORY_ORDER: {
|
case ChannelCategoryTypes.RECEIVED_CATEGORY_ORDER: {
|
||||||
const teamId: string = action.data.teamId;
|
const teamId: string = action.data.teamId;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import {isEqual} from 'lodash';
|
import {isEqual} from 'lodash';
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@@ -23,12 +24,11 @@ import type {
|
|||||||
import {AdminTypes, ChannelTypes, UserTypes, SchemeTypes, GroupTypes, PostTypes} from 'mattermost-redux/action_types';
|
import {AdminTypes, ChannelTypes, UserTypes, SchemeTypes, GroupTypes, PostTypes} from 'mattermost-redux/action_types';
|
||||||
import {General} from 'mattermost-redux/constants';
|
import {General} from 'mattermost-redux/constants';
|
||||||
import {MarkUnread} from 'mattermost-redux/constants/channels';
|
import {MarkUnread} from 'mattermost-redux/constants/channels';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {channelListToMap, splitRoles} from 'mattermost-redux/utils/channel_utils';
|
import {channelListToMap, splitRoles} from 'mattermost-redux/utils/channel_utils';
|
||||||
|
|
||||||
import messageCounts from './channels/message_counts';
|
import messageCounts from './channels/message_counts';
|
||||||
|
|
||||||
function removeMemberFromChannels(state: RelationOneToOne<Channel, Record<string, ChannelMembership>>, action: GenericAction) {
|
function removeMemberFromChannels(state: RelationOneToOne<Channel, Record<string, ChannelMembership>>, action: AnyAction) {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
Object.keys(state).forEach((channel) => {
|
Object.keys(state).forEach((channel) => {
|
||||||
nextState[channel] = {...nextState[channel]};
|
nextState[channel] = {...nextState[channel]};
|
||||||
@@ -37,7 +37,7 @@ function removeMemberFromChannels(state: RelationOneToOne<Channel, Record<string
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function channelListToSet(state: any, action: GenericAction) {
|
function channelListToSet(state: any, action: AnyAction) {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
|
|
||||||
action.data.forEach((channel: Channel) => {
|
action.data.forEach((channel: Channel) => {
|
||||||
@@ -49,7 +49,7 @@ function channelListToSet(state: any, action: GenericAction) {
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeChannelFromSet(state: any, action: GenericAction) {
|
function removeChannelFromSet(state: any, action: AnyAction) {
|
||||||
const id = action.data.team_id;
|
const id = action.data.team_id;
|
||||||
const nextSet = new Set(state[id]);
|
const nextSet = new Set(state[id]);
|
||||||
nextSet.delete(action.data.id);
|
nextSet.delete(action.data.id);
|
||||||
@@ -59,7 +59,7 @@ function removeChannelFromSet(state: any, action: GenericAction) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentChannelId(state = '', action: GenericAction) {
|
function currentChannelId(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.SELECT_CHANNEL:
|
case ChannelTypes.SELECT_CHANNEL:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -70,7 +70,7 @@ function currentChannelId(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function channels(state: IDMappedObjects<Channel> = {}, action: GenericAction) {
|
function channels(state: IDMappedObjects<Channel> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL: {
|
case ChannelTypes.RECEIVED_CHANNEL: {
|
||||||
const channel: Channel = toClientChannel(action.data);
|
const channel: Channel = toClientChannel(action.data);
|
||||||
@@ -250,7 +250,7 @@ function toClientChannel(serverChannel: ServerChannel): Channel {
|
|||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
function channelsInTeam(state: RelationOneToMany<Team, Channel> = {}, action: GenericAction) {
|
function channelsInTeam(state: RelationOneToMany<Team, Channel> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL: {
|
case ChannelTypes.RECEIVED_CHANNEL: {
|
||||||
const nextSet = new Set(state[action.data.team_id]);
|
const nextSet = new Set(state[action.data.team_id]);
|
||||||
@@ -276,7 +276,7 @@ function channelsInTeam(state: RelationOneToMany<Team, Channel> = {}, action: Ge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function myMembers(state: RelationOneToOne<Channel, ChannelMembership> = {}, action: GenericAction) {
|
export function myMembers(state: RelationOneToOne<Channel, ChannelMembership> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER: {
|
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER: {
|
||||||
const channelMember: ChannelMembership = action.data;
|
const channelMember: ChannelMembership = action.data;
|
||||||
@@ -536,7 +536,7 @@ function receiveChannelMember(state: RelationOneToOne<Channel, ChannelMembership
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function membersInChannel(state: RelationOneToOne<Channel, Record<string, ChannelMembership>> = {}, action: GenericAction) {
|
function membersInChannel(state: RelationOneToOne<Channel, Record<string, ChannelMembership>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER:
|
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER:
|
||||||
case ChannelTypes.RECEIVED_CHANNEL_MEMBER: {
|
case ChannelTypes.RECEIVED_CHANNEL_MEMBER: {
|
||||||
@@ -609,7 +609,7 @@ function membersInChannel(state: RelationOneToOne<Channel, Record<string, Channe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stats(state: RelationOneToOne<Channel, ChannelStats> = {}, action: GenericAction) {
|
function stats(state: RelationOneToOne<Channel, ChannelStats> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL_STATS: {
|
case ChannelTypes.RECEIVED_CHANNEL_STATS: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -710,7 +710,7 @@ function stats(state: RelationOneToOne<Channel, ChannelStats> = {}, action: Gene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function channelsMemberCount(state: Record<string, number> = {}, action: GenericAction) {
|
function channelsMemberCount(state: Record<string, number> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNELS_MEMBER_COUNT: {
|
case ChannelTypes.RECEIVED_CHANNELS_MEMBER_COUNT: {
|
||||||
const memberCount = action.data;
|
const memberCount = action.data;
|
||||||
@@ -726,7 +726,7 @@ function channelsMemberCount(state: Record<string, number> = {}, action: Generic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupsAssociatedToChannel(state: any = {}, action: GenericAction) {
|
function groupsAssociatedToChannel(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.RECEIVED_ALL_GROUPS_ASSOCIATED_TO_CHANNELS_IN_TEAM: {
|
case GroupTypes.RECEIVED_ALL_GROUPS_ASSOCIATED_TO_CHANNELS_IN_TEAM: {
|
||||||
const {groupsByChannelId} = action.data;
|
const {groupsByChannelId} = action.data;
|
||||||
@@ -798,7 +798,7 @@ function groupsAssociatedToChannel(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateChannelMemberSchemeRoles(state: any, action: GenericAction) {
|
function updateChannelMemberSchemeRoles(state: any, action: AnyAction) {
|
||||||
const {channelId, userId, isSchemeUser, isSchemeAdmin} = action.data;
|
const {channelId, userId, isSchemeUser, isSchemeAdmin} = action.data;
|
||||||
const channel = state[channelId];
|
const channel = state[channelId];
|
||||||
if (channel) {
|
if (channel) {
|
||||||
@@ -820,7 +820,7 @@ function updateChannelMemberSchemeRoles(state: any, action: GenericAction) {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function totalCount(state = 0, action: GenericAction) {
|
function totalCount(state = 0, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_TOTAL_CHANNEL_COUNT: {
|
case ChannelTypes.RECEIVED_TOTAL_CHANNEL_COUNT: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -830,7 +830,7 @@ function totalCount(state = 0, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function manuallyUnread(state: RelationOneToOne<Channel, boolean> = {}, action: GenericAction) {
|
export function manuallyUnread(state: RelationOneToOne<Channel, boolean> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.REMOVE_MANUALLY_UNREAD: {
|
case ChannelTypes.REMOVE_MANUALLY_UNREAD: {
|
||||||
if (state[action.data.channelId]) {
|
if (state[action.data.channelId]) {
|
||||||
@@ -854,7 +854,7 @@ export function manuallyUnread(state: RelationOneToOne<Channel, boolean> = {}, a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function channelModerations(state: any = {}, action: GenericAction) {
|
export function channelModerations(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL_MODERATIONS: {
|
case ChannelTypes.RECEIVED_CHANNEL_MODERATIONS: {
|
||||||
const {channelId, moderations} = action.data;
|
const {channelId, moderations} = action.data;
|
||||||
@@ -868,7 +868,7 @@ export function channelModerations(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function channelMemberCountsByGroup(state: any = {}, action: GenericAction) {
|
export function channelMemberCountsByGroup(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL_MEMBER_COUNTS_BY_GROUP: {
|
case ChannelTypes.RECEIVED_CHANNEL_MEMBER_COUNTS_BY_GROUP: {
|
||||||
const {channelId, memberCounts} = action.data;
|
const {channelId, memberCounts} = action.data;
|
||||||
@@ -902,7 +902,7 @@ export function channelMemberCountsByGroup(state: any = {}, action: GenericActio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roles(state: RelationOneToOne<Channel, Set<string>> = {}, action: GenericAction) {
|
function roles(state: RelationOneToOne<Channel, Set<string>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER: {
|
case ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER: {
|
||||||
const channelMember = action.data;
|
const channelMember = action.data;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
Channel,
|
Channel,
|
||||||
ChannelMessageCount,
|
ChannelMessageCount,
|
||||||
@@ -15,9 +17,8 @@ import {
|
|||||||
SchemeTypes,
|
SchemeTypes,
|
||||||
} from 'mattermost-redux/action_types';
|
} from 'mattermost-redux/action_types';
|
||||||
import {General} from 'mattermost-redux/constants';
|
import {General} from 'mattermost-redux/constants';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
export default function messageCounts(state: RelationOneToOne<Channel, ChannelMessageCount> = {}, action: GenericAction): RelationOneToOne<Channel, ChannelMessageCount> {
|
export default function messageCounts(state: RelationOneToOne<Channel, ChannelMessageCount> = {}, action: AnyAction): RelationOneToOne<Channel, ChannelMessageCount> {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ChannelTypes.RECEIVED_CHANNEL: {
|
case ChannelTypes.RECEIVED_CHANNEL: {
|
||||||
const channel: ServerChannel = action.data;
|
const channel: ServerChannel = action.data;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import {SelfHostedSignupProgress} from '@mattermost/types/cloud';
|
import {SelfHostedSignupProgress} from '@mattermost/types/cloud';
|
||||||
@@ -8,9 +9,8 @@ import type {Product, Subscription, CloudCustomer, Invoice, Limits, LicenseSelfS
|
|||||||
import type {ValueOf} from '@mattermost/types/utilities';
|
import type {ValueOf} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {CloudTypes} from 'mattermost-redux/action_types';
|
import {CloudTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
export function subscription(state: Subscription | null = null, action: GenericAction) {
|
export function subscription(state: Subscription | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_CLOUD_SUBSCRIPTION: {
|
case CloudTypes.RECEIVED_CLOUD_SUBSCRIPTION: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -20,7 +20,7 @@ export function subscription(state: Subscription | null = null, action: GenericA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function customer(state: CloudCustomer | null = null, action: GenericAction) {
|
function customer(state: CloudCustomer | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_CLOUD_CUSTOMER: {
|
case CloudTypes.RECEIVED_CLOUD_CUSTOMER: {
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -30,7 +30,7 @@ function customer(state: CloudCustomer | null = null, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function subscriptionStats(state: LicenseSelfServeStatusReducer | null = null, action: GenericAction): LicenseSelfServeStatusReducer | null {
|
export function subscriptionStats(state: LicenseSelfServeStatusReducer | null = null, action: AnyAction): LicenseSelfServeStatusReducer | null {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.LICENSE_SELF_SERVE_STATS_REQUEST: {
|
case CloudTypes.LICENSE_SELF_SERVE_STATS_REQUEST: {
|
||||||
return {
|
return {
|
||||||
@@ -55,7 +55,7 @@ export function subscriptionStats(state: LicenseSelfServeStatusReducer | null =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function products(state: Record<string, Product> | null = null, action: GenericAction) {
|
function products(state: Record<string, Product> | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_CLOUD_PRODUCTS: {
|
case CloudTypes.RECEIVED_CLOUD_PRODUCTS: {
|
||||||
const productList: Product[] = action.data;
|
const productList: Product[] = action.data;
|
||||||
@@ -73,7 +73,7 @@ function products(state: Record<string, Product> | null = null, action: GenericA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function invoices(state: Record<string, Invoice> | null = null, action: GenericAction) {
|
function invoices(state: Record<string, Invoice> | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_CLOUD_INVOICES: {
|
case CloudTypes.RECEIVED_CLOUD_INVOICES: {
|
||||||
const invoiceList: Invoice[] = action.data;
|
const invoiceList: Invoice[] = action.data;
|
||||||
@@ -99,7 +99,7 @@ const emptyLimits = {
|
|||||||
limits: {},
|
limits: {},
|
||||||
limitsLoaded: false,
|
limitsLoaded: false,
|
||||||
};
|
};
|
||||||
export function limits(state: LimitsReducer = emptyLimits, action: GenericAction) {
|
export function limits(state: LimitsReducer = emptyLimits, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_CLOUD_LIMITS: {
|
case CloudTypes.RECEIVED_CLOUD_LIMITS: {
|
||||||
return {
|
return {
|
||||||
@@ -123,7 +123,7 @@ export interface ErrorsReducer {
|
|||||||
trueUpReview?: true;
|
trueUpReview?: true;
|
||||||
}
|
}
|
||||||
const emptyErrors = {};
|
const emptyErrors = {};
|
||||||
export function errors(state: ErrorsReducer = emptyErrors, action: GenericAction) {
|
export function errors(state: ErrorsReducer = emptyErrors, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.CLOUD_SUBSCRIPTION_FAILED: {
|
case CloudTypes.CLOUD_SUBSCRIPTION_FAILED: {
|
||||||
return {...state, subscription: true};
|
return {...state, subscription: true};
|
||||||
@@ -205,7 +205,7 @@ interface SelfHostedSignupReducer {
|
|||||||
const initialSelfHostedSignup = {
|
const initialSelfHostedSignup = {
|
||||||
progress: SelfHostedSignupProgress.START,
|
progress: SelfHostedSignupProgress.START,
|
||||||
};
|
};
|
||||||
function selfHostedSignup(state: SelfHostedSignupReducer = initialSelfHostedSignup, action: GenericAction): SelfHostedSignupReducer {
|
function selfHostedSignup(state: SelfHostedSignupReducer = initialSelfHostedSignup, action: AnyAction): SelfHostedSignupReducer {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_SELF_HOSTED_SIGNUP_PROGRESS:
|
case CloudTypes.RECEIVED_SELF_HOSTED_SIGNUP_PROGRESS:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {EmojisState, CustomEmoji} from '@mattermost/types/emojis';
|
import type {CustomEmoji} from '@mattermost/types/emojis';
|
||||||
import type {Post} from '@mattermost/types/posts';
|
import type {Post} from '@mattermost/types/posts';
|
||||||
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {EmojiTypes, PostTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {EmojiTypes, PostTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
export function customEmoji(state: IDMappedObjects<CustomEmoji> = {}, action: GenericAction): IDMappedObjects<CustomEmoji> {
|
export function customEmoji(state: IDMappedObjects<CustomEmoji> = {}, action: AnyAction): IDMappedObjects<CustomEmoji> {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case EmojiTypes.RECEIVED_CUSTOM_EMOJI: {
|
case EmojiTypes.RECEIVED_CUSTOM_EMOJI: {
|
||||||
const emoji: CustomEmoji = action.data;
|
const emoji: CustomEmoji = action.data;
|
||||||
@@ -75,7 +75,7 @@ function storeEmojisForPost(state: IDMappedObjects<CustomEmoji>, post: Post): ID
|
|||||||
return post.metadata.emojis.reduce(storeEmoji, state);
|
return post.metadata.emojis.reduce(storeEmoji, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nonExistentEmoji(state: Set<string> = new Set(), action: GenericAction): Set<string> {
|
function nonExistentEmoji(state: Set<string> = new Set(), action: AnyAction): Set<string> {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case EmojiTypes.CUSTOM_EMOJI_DOES_NOT_EXIST: {
|
case EmojiTypes.CUSTOM_EMOJI_DOES_NOT_EXIST: {
|
||||||
if (!state.has(action.data)) {
|
if (!state.has(action.data)) {
|
||||||
@@ -115,11 +115,11 @@ function nonExistentEmoji(state: Set<string> = new Set(), action: GenericAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (combineReducers({
|
export default combineReducers({
|
||||||
|
|
||||||
// object where every key is the custom emoji id and has an object with the custom emoji details
|
// object where every key is the custom emoji id and has an object with the custom emoji details
|
||||||
customEmoji,
|
customEmoji,
|
||||||
|
|
||||||
// set containing custom emoji names that do not exist
|
// set containing custom emoji names that do not exist
|
||||||
nonExistentEmoji,
|
nonExistentEmoji,
|
||||||
}) as (b: EmojisState, a: GenericAction) => EmojisState);
|
});
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {FileInfo, FileSearchResultItem} from '@mattermost/types/files';
|
import type {FileInfo, FileSearchResultItem} from '@mattermost/types/files';
|
||||||
import type {Post} from '@mattermost/types/posts';
|
import type {Post} from '@mattermost/types/posts';
|
||||||
|
|
||||||
import {FileTypes, PostTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {FileTypes, PostTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
export function files(state: Record<string, FileInfo> = {}, action: GenericAction) {
|
export function files(state: Record<string, FileInfo> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FileTypes.RECEIVED_UPLOAD_FILES:
|
case FileTypes.RECEIVED_UPLOAD_FILES:
|
||||||
case FileTypes.RECEIVED_FILES_FOR_POST: {
|
case FileTypes.RECEIVED_FILES_FOR_POST: {
|
||||||
@@ -60,7 +60,7 @@ export function files(state: Record<string, FileInfo> = {}, action: GenericActio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filesFromSearch(state: Record<string, FileSearchResultItem> = {}, action: GenericAction) {
|
export function filesFromSearch(state: Record<string, FileSearchResultItem> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FileTypes.RECEIVED_FILES_FOR_SEARCH: {
|
case FileTypes.RECEIVED_FILES_FOR_SEARCH: {
|
||||||
return {...state,
|
return {...state,
|
||||||
@@ -112,7 +112,7 @@ function storeFilesForPost(state: Record<string, FileInfo>, post: Post) {
|
|||||||
}, state);
|
}, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fileIdsByPostId(state: Record<string, string[]> = {}, action: GenericAction) {
|
export function fileIdsByPostId(state: Record<string, string[]> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FileTypes.RECEIVED_FILES_FOR_POST: {
|
case FileTypes.RECEIVED_FILES_FOR_POST: {
|
||||||
const {data, postId} = action;
|
const {data, postId} = action;
|
||||||
@@ -166,7 +166,7 @@ function storeFilesIdsForPost(state: Record<string, string[]>, post: Post) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function filePublicLink(state: {link: string} = {link: ''}, action: GenericAction) {
|
function filePublicLink(state: {link: string} = {link: ''}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case FileTypes.RECEIVED_FILE_PUBLIC_LINK: {
|
case FileTypes.RECEIVED_FILE_PUBLIC_LINK: {
|
||||||
return action.data;
|
return action.data;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import {GeneralTypes} from 'mattermost-redux/action_types';
|
import {GeneralTypes} from 'mattermost-redux/action_types';
|
||||||
import reducer from 'mattermost-redux/reducers/entities/general';
|
import reducer from 'mattermost-redux/reducers/entities/general';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
type ReducerState = ReturnType<typeof reducer>
|
type ReducerState = ReturnType<typeof reducer>
|
||||||
|
|
||||||
@@ -11,10 +10,10 @@ describe('reducers.entities.general', () => {
|
|||||||
describe('firstAdminVisitMarketplaceStatus', () => {
|
describe('firstAdminVisitMarketplaceStatus', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = {};
|
const state = {};
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {};
|
const expectedState = {};
|
||||||
|
|
||||||
const actualState = reducer({firstAdminVisitMarketplaceStatus: state} as ReducerState, action as GenericAction);
|
const actualState = reducer({firstAdminVisitMarketplaceStatus: state} as ReducerState, action);
|
||||||
expect(actualState.firstAdminVisitMarketplaceStatus).toEqual(expectedState);
|
expect(actualState.firstAdminVisitMarketplaceStatus).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {ClientLicense, ClientConfig} from '@mattermost/types/config';
|
import type {ClientLicense, ClientConfig} from '@mattermost/types/config';
|
||||||
|
|
||||||
import {GeneralTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {GeneralTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function config(state: Partial<ClientConfig> = {}, action: GenericAction) {
|
function config(state: Partial<ClientConfig> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.CLIENT_CONFIG_RECEIVED:
|
case GeneralTypes.CLIENT_CONFIG_RECEIVED:
|
||||||
return Object.assign({}, state, action.data);
|
return Object.assign({}, state, action.data);
|
||||||
@@ -23,7 +23,7 @@ function config(state: Partial<ClientConfig> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dataRetentionPolicy(state: any = {}, action: GenericAction) {
|
function dataRetentionPolicy(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.RECEIVED_DATA_RETENTION_POLICY:
|
case GeneralTypes.RECEIVED_DATA_RETENTION_POLICY:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -34,7 +34,7 @@ function dataRetentionPolicy(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function license(state: ClientLicense = {}, action: GenericAction) {
|
function license(state: ClientLicense = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.CLIENT_LICENSE_RECEIVED:
|
case GeneralTypes.CLIENT_LICENSE_RECEIVED:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -48,7 +48,7 @@ function license(state: ClientLicense = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function serverVersion(state = '', action: GenericAction) {
|
function serverVersion(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.RECEIVED_SERVER_VERSION:
|
case GeneralTypes.RECEIVED_SERVER_VERSION:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -59,7 +59,7 @@ function serverVersion(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function warnMetricsStatus(state: any = {}, action: GenericAction) {
|
function warnMetricsStatus(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.WARN_METRICS_STATUS_RECEIVED:
|
case GeneralTypes.WARN_METRICS_STATUS_RECEIVED:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -80,7 +80,7 @@ function warnMetricsStatus(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function firstAdminVisitMarketplaceStatus(state = false, action: GenericAction) {
|
function firstAdminVisitMarketplaceStatus(state = false, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.FIRST_ADMIN_VISIT_MARKETPLACE_STATUS_RECEIVED:
|
case GeneralTypes.FIRST_ADMIN_VISIT_MARKETPLACE_STATUS_RECEIVED:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -90,7 +90,7 @@ function firstAdminVisitMarketplaceStatus(state = false, action: GenericAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function firstAdminCompleteSetup(state = false, action: GenericAction) {
|
function firstAdminCompleteSetup(state = false, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GeneralTypes.FIRST_ADMIN_COMPLETE_SETUP_RECEIVED:
|
case GeneralTypes.FIRST_ADMIN_COMPLETE_SETUP_RECEIVED:
|
||||||
return action.data;
|
return action.data;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {GroupChannel, GroupSyncablesState, GroupTeam, Group} from '@mattermost/types/groups';
|
import type {GroupChannel, GroupSyncablesState, GroupTeam, Group} from '@mattermost/types/groups';
|
||||||
|
|
||||||
import {GroupTypes} from 'mattermost-redux/action_types';
|
import {GroupTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function syncables(state: Record<string, GroupSyncablesState> = {}, action: GenericAction) {
|
function syncables(state: Record<string, GroupSyncablesState> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.RECEIVED_GROUP_TEAMS: {
|
case GroupTypes.RECEIVED_GROUP_TEAMS: {
|
||||||
return {
|
return {
|
||||||
@@ -141,7 +141,7 @@ function syncables(state: Record<string, GroupSyncablesState> = {}, action: Gene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function myGroups(state: string[] = [], action: GenericAction) {
|
function myGroups(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.ADD_MY_GROUP: {
|
case GroupTypes.ADD_MY_GROUP: {
|
||||||
const groupId = action.id;
|
const groupId = action.id;
|
||||||
@@ -185,7 +185,7 @@ function myGroups(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stats(state: any = {}, action: GenericAction) {
|
function stats(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.RECEIVED_GROUP_STATS: {
|
case GroupTypes.RECEIVED_GROUP_STATS: {
|
||||||
const stat = action.data;
|
const stat = action.data;
|
||||||
@@ -199,7 +199,7 @@ function stats(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function groups(state: Record<string, Group> = {}, action: GenericAction) {
|
function groups(state: Record<string, Group> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.CREATE_GROUP_SUCCESS:
|
case GroupTypes.CREATE_GROUP_SUCCESS:
|
||||||
case GroupTypes.PATCHED_GROUP:
|
case GroupTypes.PATCHED_GROUP:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Invoice, Product} from '@mattermost/types/cloud';
|
import type {Invoice, Product} from '@mattermost/types/cloud';
|
||||||
@@ -9,7 +10,6 @@ import type {TrueUpReviewProfileReducer, TrueUpReviewStatusReducer} from '@matte
|
|||||||
import type {ValueOf} from '@mattermost/types/utilities';
|
import type {ValueOf} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {HostedCustomerTypes} from 'mattermost-redux/action_types';
|
import {HostedCustomerTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
interface SelfHostedProducts {
|
interface SelfHostedProducts {
|
||||||
products: Record<string, Product>;
|
products: Record<string, Product>;
|
||||||
@@ -29,7 +29,7 @@ const initialInvoices = {
|
|||||||
invoicesLoaded: false,
|
invoicesLoaded: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function products(state: SelfHostedProducts = initialProducts, action: GenericAction) {
|
function products(state: SelfHostedProducts = initialProducts, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_PRODUCTS: {
|
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_PRODUCTS: {
|
||||||
const productList: Product[] = action.data;
|
const productList: Product[] = action.data;
|
||||||
@@ -51,7 +51,7 @@ function products(state: SelfHostedProducts = initialProducts, action: GenericAc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function invoices(state: SelfHostedInvoices = initialInvoices, action: GenericAction) {
|
function invoices(state: SelfHostedInvoices = initialInvoices, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_INVOICES: {
|
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_INVOICES: {
|
||||||
const invoiceList: Invoice[] = action.data;
|
const invoiceList: Invoice[] = action.data;
|
||||||
@@ -74,7 +74,7 @@ function invoices(state: SelfHostedInvoices = initialInvoices, action: GenericAc
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SignupProgress = ValueOf<typeof SelfHostedSignupProgress>;
|
type SignupProgress = ValueOf<typeof SelfHostedSignupProgress>;
|
||||||
function signupProgress(state = SelfHostedSignupProgress.START, action: GenericAction): SignupProgress {
|
function signupProgress(state = SelfHostedSignupProgress.START, action: AnyAction): SignupProgress {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_SIGNUP_PROGRESS: {
|
case HostedCustomerTypes.RECEIVED_SELF_HOSTED_SIGNUP_PROGRESS: {
|
||||||
if (!action.data) {
|
if (!action.data) {
|
||||||
@@ -93,7 +93,7 @@ export interface ErrorsReducer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const emptyErrors = {};
|
const emptyErrors = {};
|
||||||
export function errors(state: ErrorsReducer = emptyErrors, action: GenericAction) {
|
export function errors(state: ErrorsReducer = emptyErrors, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.SELF_HOSTED_PRODUCTS_FAILED: {
|
case HostedCustomerTypes.SELF_HOSTED_PRODUCTS_FAILED: {
|
||||||
return {...state, products: true};
|
return {...state, products: true};
|
||||||
@@ -122,7 +122,7 @@ export function errors(state: ErrorsReducer = emptyErrors, action: GenericAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function trueUpReviewProfile(state: TrueUpReviewProfileReducer | null = null, action: GenericAction) {
|
function trueUpReviewProfile(state: TrueUpReviewProfileReducer | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.RECEIVED_TRUE_UP_REVIEW_BUNDLE: {
|
case HostedCustomerTypes.RECEIVED_TRUE_UP_REVIEW_BUNDLE: {
|
||||||
return {
|
return {
|
||||||
@@ -142,7 +142,7 @@ function trueUpReviewProfile(state: TrueUpReviewProfileReducer | null = null, ac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function trueUpReviewStatus(state: TrueUpReviewStatusReducer | null = null, action: GenericAction) {
|
function trueUpReviewStatus(state: TrueUpReviewStatusReducer | null = null, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case HostedCustomerTypes.RECEIVED_TRUE_UP_REVIEW_STATUS: {
|
case HostedCustomerTypes.RECEIVED_TRUE_UP_REVIEW_STATUS: {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Command, IncomingWebhook, OutgoingWebhook, OAuthApp} from '@mattermost/types/integrations';
|
import type {Command, IncomingWebhook, OutgoingWebhook, OAuthApp} from '@mattermost/types/integrations';
|
||||||
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {IntegrationTypes, UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
import {IntegrationTypes, UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function incomingHooks(state: IDMappedObjects<IncomingWebhook> = {}, action: GenericAction) {
|
function incomingHooks(state: IDMappedObjects<IncomingWebhook> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_INCOMING_HOOK: {
|
case IntegrationTypes.RECEIVED_INCOMING_HOOK: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -52,7 +52,7 @@ function incomingHooks(state: IDMappedObjects<IncomingWebhook> = {}, action: Gen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function outgoingHooks(state: IDMappedObjects<OutgoingWebhook> = {}, action: GenericAction) {
|
function outgoingHooks(state: IDMappedObjects<OutgoingWebhook> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_OUTGOING_HOOK: {
|
case IntegrationTypes.RECEIVED_OUTGOING_HOOK: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -95,7 +95,7 @@ function outgoingHooks(state: IDMappedObjects<OutgoingWebhook> = {}, action: Gen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function commands(state: IDMappedObjects<Command> = {}, action: GenericAction) {
|
function commands(state: IDMappedObjects<Command> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_COMMANDS:
|
case IntegrationTypes.RECEIVED_COMMANDS:
|
||||||
case IntegrationTypes.RECEIVED_CUSTOM_TEAM_COMMANDS: {
|
case IntegrationTypes.RECEIVED_CUSTOM_TEAM_COMMANDS: {
|
||||||
@@ -141,7 +141,7 @@ function commands(state: IDMappedObjects<Command> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function systemCommands(state: IDMappedObjects<Command> = {}, action: GenericAction) {
|
function systemCommands(state: IDMappedObjects<Command> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_COMMANDS: {
|
case IntegrationTypes.RECEIVED_COMMANDS: {
|
||||||
const nextCommands: Record<string, Command> = {};
|
const nextCommands: Record<string, Command> = {};
|
||||||
@@ -169,7 +169,7 @@ function systemCommands(state: IDMappedObjects<Command> = {}, action: GenericAct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function oauthApps(state: IDMappedObjects<OAuthApp> = {}, action: GenericAction) {
|
function oauthApps(state: IDMappedObjects<OAuthApp> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_OAUTH_APPS: {
|
case IntegrationTypes.RECEIVED_OAUTH_APPS: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -196,7 +196,7 @@ function oauthApps(state: IDMappedObjects<OAuthApp> = {}, action: GenericAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function appsOAuthAppIDs(state: string[] = [], action: GenericAction) {
|
function appsOAuthAppIDs(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_APPS_OAUTH_APP_IDS: {
|
case IntegrationTypes.RECEIVED_APPS_OAUTH_APP_IDS: {
|
||||||
if (state.length === 0 && action.data.length === 0) {
|
if (state.length === 0 && action.data.length === 0) {
|
||||||
@@ -224,7 +224,7 @@ function appsOAuthAppIDs(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function appsBotIDs(state: string[] = [], action: GenericAction) {
|
function appsBotIDs(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_APPS_BOT_IDS: {
|
case IntegrationTypes.RECEIVED_APPS_BOT_IDS: {
|
||||||
if (!action.data) {
|
if (!action.data) {
|
||||||
@@ -256,7 +256,7 @@ function appsBotIDs(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dialogTriggerId(state = '', action: GenericAction) {
|
function dialogTriggerId(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_DIALOG_TRIGGER_ID:
|
case IntegrationTypes.RECEIVED_DIALOG_TRIGGER_ID:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -265,7 +265,7 @@ function dialogTriggerId(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dialog(state = '', action: GenericAction) {
|
function dialog(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case IntegrationTypes.RECEIVED_DIALOG:
|
case IntegrationTypes.RECEIVED_DIALOG:
|
||||||
return action.data;
|
return action.data;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {JobsState, JobType, Job, JobsByType} from '@mattermost/types/jobs';
|
import type {JobType, Job, JobsByType} from '@mattermost/types/jobs';
|
||||||
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {JobTypes} from 'mattermost-redux/action_types';
|
import {JobTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function jobs(state: IDMappedObjects<Job> = {}, action: GenericAction): IDMappedObjects<Job> {
|
function jobs(state: IDMappedObjects<Job> = {}, action: AnyAction): IDMappedObjects<Job> {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case JobTypes.RECEIVED_JOB: {
|
case JobTypes.RECEIVED_JOB: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -28,7 +28,7 @@ function jobs(state: IDMappedObjects<Job> = {}, action: GenericAction): IDMapped
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function jobsByTypeList(state: JobsByType = {}, action: GenericAction): JobsByType {
|
function jobsByTypeList(state: JobsByType = {}, action: AnyAction): JobsByType {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case JobTypes.RECEIVED_JOBS_BY_TYPE: {
|
case JobTypes.RECEIVED_JOBS_BY_TYPE: {
|
||||||
const nextState = {...state};
|
const nextState = {...state};
|
||||||
@@ -42,11 +42,11 @@ function jobsByTypeList(state: JobsByType = {}, action: GenericAction): JobsByTy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (combineReducers({
|
export default combineReducers({
|
||||||
|
|
||||||
// object where every key is the job id and has an object with the job details
|
// object where every key is the job id and has an object with the job details
|
||||||
jobs,
|
jobs,
|
||||||
|
|
||||||
// object where every key is a job type and contains a list of jobs.
|
// object where every key is a job type and contains a list of jobs.
|
||||||
jobsByTypeList,
|
jobsByTypeList,
|
||||||
}) as (b: JobsState, a: GenericAction) => JobsState);
|
});
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import {LimitsTypes} from 'mattermost-redux/action_types';
|
import {LimitsTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function usersLimits(state = {}, action: GenericAction) {
|
function usersLimits(state = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case LimitsTypes.RECIEVED_USERS_LIMITS: {
|
case LimitsTypes.RECIEVED_USERS_LIMITS: {
|
||||||
const usersLimits = action.data;
|
const usersLimits = action.data;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
OpenGraphMetadata,
|
OpenGraphMetadata,
|
||||||
Post,
|
Post,
|
||||||
@@ -22,7 +24,6 @@ import type {
|
|||||||
import {ChannelTypes, PostTypes, UserTypes, ThreadTypes, CloudTypes} from 'mattermost-redux/action_types';
|
import {ChannelTypes, PostTypes, UserTypes, ThreadTypes, CloudTypes} from 'mattermost-redux/action_types';
|
||||||
import {Posts} from 'mattermost-redux/constants';
|
import {Posts} from 'mattermost-redux/constants';
|
||||||
import {PostTypes as PostConstant} from 'mattermost-redux/constants/posts';
|
import {PostTypes as PostConstant} from 'mattermost-redux/constants/posts';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {comparePosts, isPermalink, shouldUpdatePost} from 'mattermost-redux/utils/post_utils';
|
import {comparePosts, isPermalink, shouldUpdatePost} from 'mattermost-redux/utils/post_utils';
|
||||||
|
|
||||||
export function removeUnneededMetadata(post: Post) {
|
export function removeUnneededMetadata(post: Post) {
|
||||||
@@ -98,7 +99,7 @@ export function removeUnneededMetadata(post: Post) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function nextPostsReplies(state: {[x in Post['id']]: number} = {}, action: GenericAction) {
|
export function nextPostsReplies(state: {[x in Post['id']]: number} = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_POST:
|
case PostTypes.RECEIVED_POST:
|
||||||
case PostTypes.RECEIVED_NEW_POST: {
|
case PostTypes.RECEIVED_NEW_POST: {
|
||||||
@@ -157,7 +158,7 @@ export function nextPostsReplies(state: {[x in Post['id']]: number} = {}, action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handlePosts(state: RelationOneToOne<Post, Post> = {}, action: GenericAction) {
|
export function handlePosts(state: RelationOneToOne<Post, Post> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_POST:
|
case PostTypes.RECEIVED_POST:
|
||||||
case PostTypes.RECEIVED_NEW_POST: {
|
case PostTypes.RECEIVED_NEW_POST: {
|
||||||
@@ -380,7 +381,7 @@ function handlePostReceived(nextState: any, post: Post, nestedPermalinkLevel?: n
|
|||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handlePendingPosts(state: string[] = [], action: GenericAction) {
|
export function handlePendingPosts(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_NEW_POST: {
|
case PostTypes.RECEIVED_NEW_POST: {
|
||||||
const post = action.data;
|
const post = action.data;
|
||||||
@@ -446,7 +447,7 @@ export function handlePendingPosts(state: string[] = [], action: GenericAction)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function postsInChannel(state: Record<string, PostOrderBlock[]> = {}, action: GenericAction, prevPosts: IDMappedObjects<Post>, nextPosts: Record<string, Post>) {
|
export function postsInChannel(state: Record<string, PostOrderBlock[]> = {}, action: AnyAction, prevPosts: IDMappedObjects<Post>, nextPosts: Record<string, Post>) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RESET_POSTS_IN_CHANNEL: {
|
case PostTypes.RESET_POSTS_IN_CHANNEL: {
|
||||||
return {};
|
return {};
|
||||||
@@ -936,7 +937,7 @@ export function mergePostOrder(left: string[], right: string[], posts: Record<st
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function postsInThread(state: RelationOneToMany<Post, Post> = {}, action: GenericAction, prevPosts: Record<string, Post>) {
|
export function postsInThread(state: RelationOneToMany<Post, Post> = {}, action: AnyAction, prevPosts: Record<string, Post>) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_NEW_POST:
|
case PostTypes.RECEIVED_NEW_POST:
|
||||||
case PostTypes.RECEIVED_POST: {
|
case PostTypes.RECEIVED_POST: {
|
||||||
@@ -1135,7 +1136,7 @@ export function postsInThread(state: RelationOneToMany<Post, Post> = {}, action:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectedPostId(state = '', action: GenericAction) {
|
function selectedPostId(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_POST_SELECTED:
|
case PostTypes.RECEIVED_POST_SELECTED:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -1146,7 +1147,7 @@ function selectedPostId(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function postEditHistory(state: Post[] = [], action: GenericAction) {
|
export function postEditHistory(state: Post[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_POST_HISTORY:
|
case PostTypes.RECEIVED_POST_HISTORY:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -1157,7 +1158,7 @@ export function postEditHistory(state: Post[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentFocusedPostId(state = '', action: GenericAction) {
|
function currentFocusedPostId(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_FOCUSED_POST:
|
case PostTypes.RECEIVED_FOCUSED_POST:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -1168,7 +1169,7 @@ function currentFocusedPostId(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reactions(state: RelationOneToOne<Post, Record<string, Reaction>> = {}, action: GenericAction) {
|
export function reactions(state: RelationOneToOne<Post, Record<string, Reaction>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_REACTIONS: {
|
case PostTypes.RECEIVED_REACTIONS: {
|
||||||
const reactionsList = action.data;
|
const reactionsList = action.data;
|
||||||
@@ -1241,7 +1242,7 @@ export function reactions(state: RelationOneToOne<Post, Record<string, Reaction>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function acknowledgements(state: RelationOneToOne<Post, Record<UserProfile['id'], number>> = {}, action: GenericAction) {
|
export function acknowledgements(state: RelationOneToOne<Post, Record<UserProfile['id'], number>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.CREATE_ACK_POST_SUCCESS: {
|
case PostTypes.CREATE_ACK_POST_SUCCESS: {
|
||||||
const ack = action.data as PostAcknowledgement;
|
const ack = action.data as PostAcknowledgement;
|
||||||
@@ -1353,7 +1354,7 @@ function storeAcknowledgementsForPost(state: any, post: Post) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openGraph(state: RelationOneToOne<Post, Record<string, OpenGraphMetadata>> = {}, action: GenericAction) {
|
export function openGraph(state: RelationOneToOne<Post, Record<string, OpenGraphMetadata>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_NEW_POST:
|
case PostTypes.RECEIVED_NEW_POST:
|
||||||
case PostTypes.RECEIVED_POST: {
|
case PostTypes.RECEIVED_POST: {
|
||||||
@@ -1417,7 +1418,7 @@ function messagesHistory(state: Partial<MessageHistory> = {
|
|||||||
post: -1,
|
post: -1,
|
||||||
comment: -1,
|
comment: -1,
|
||||||
},
|
},
|
||||||
}, action: GenericAction) {
|
}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.ADD_MESSAGE_INTO_HISTORY: {
|
case PostTypes.ADD_MESSAGE_INTO_HISTORY: {
|
||||||
const nextIndex: Record<string, number> = {};
|
const nextIndex: Record<string, number> = {};
|
||||||
@@ -1499,7 +1500,7 @@ export const zeroStateLimitedViews = {
|
|||||||
|
|
||||||
export function limitedViews(
|
export function limitedViews(
|
||||||
state: PostsState['limitedViews'] = zeroStateLimitedViews,
|
state: PostsState['limitedViews'] = zeroStateLimitedViews,
|
||||||
action: GenericAction,
|
action: AnyAction,
|
||||||
): PostsState['limitedViews'] {
|
): PostsState['limitedViews'] {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PostTypes.RECEIVED_POSTS:
|
case PostTypes.RECEIVED_POSTS:
|
||||||
@@ -1565,7 +1566,7 @@ export function limitedViews(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function reducer(state: Partial<PostsState> = {}, action: GenericAction) {
|
export default function reducer(state: Partial<PostsState> = {}, action: AnyAction) {
|
||||||
const nextPosts = handlePosts(state.posts, action);
|
const nextPosts = handlePosts(state.posts, action);
|
||||||
const nextPostsInChannel = postsInChannel(state.postsInChannel, action, state.posts!, nextPosts);
|
const nextPostsInChannel = postsInChannel(state.postsInChannel, action, state.posts!, nextPosts);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {PreferenceType} from '@mattermost/types/preferences';
|
import type {PreferenceType} from '@mattermost/types/preferences';
|
||||||
|
|
||||||
import {PreferenceTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {PreferenceTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function getKey(preference: PreferenceType) {
|
function getKey(preference: PreferenceType) {
|
||||||
return `${preference.category}--${preference.name}`;
|
return `${preference.category}--${preference.name}`;
|
||||||
@@ -24,7 +24,7 @@ function setAllPreferences(preferences: PreferenceType[]): any {
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function myPreferences(state: Record<string, PreferenceType> = {}, action: GenericAction) {
|
function myPreferences(state: Record<string, PreferenceType> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PreferenceTypes.RECEIVED_ALL_PREFERENCES:
|
case PreferenceTypes.RECEIVED_ALL_PREFERENCES:
|
||||||
return setAllPreferences(action.data);
|
return setAllPreferences(action.data);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Role} from '@mattermost/types/roles';
|
import type {Role} from '@mattermost/types/roles';
|
||||||
|
|
||||||
import {RoleTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {RoleTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function pending(state: Set<string> = new Set(), action: GenericAction) {
|
function pending(state: Set<string> = new Set(), action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case RoleTypes.SET_PENDING_ROLES:
|
case RoleTypes.SET_PENDING_ROLES:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -19,7 +19,7 @@ function pending(state: Set<string> = new Set(), action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function roles(state: Record<string, Role> = {}, action: GenericAction) {
|
function roles(state: Record<string, Role> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case RoleTypes.RECEIVED_ROLES: {
|
case RoleTypes.RECEIVED_ROLES: {
|
||||||
if (action.data) {
|
if (action.data) {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {SchemesState, Scheme} from '@mattermost/types/schemes';
|
import type {Scheme} from '@mattermost/types/schemes';
|
||||||
|
|
||||||
import {SchemeTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {SchemeTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function schemes(state: {
|
function schemes(state: {
|
||||||
[x: string]: Scheme;
|
[x: string]: Scheme;
|
||||||
} = {}, action: GenericAction): {
|
} = {}, action: AnyAction): {
|
||||||
[x: string]: Scheme;
|
[x: string]: Scheme;
|
||||||
} {
|
} {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@@ -45,6 +45,6 @@ function schemes(state: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (combineReducers({
|
export default combineReducers({
|
||||||
schemes,
|
schemes,
|
||||||
}) as (b: SchemesState, a: GenericAction) => SchemesState);
|
});
|
||||||
|
|||||||
@@ -7,18 +7,17 @@ import {
|
|||||||
UserTypes,
|
UserTypes,
|
||||||
} from 'mattermost-redux/action_types';
|
} from 'mattermost-redux/action_types';
|
||||||
import reducer from 'mattermost-redux/reducers/entities/search';
|
import reducer from 'mattermost-redux/reducers/entities/search';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
type SearchState = ReturnType<typeof reducer>;
|
type SearchState = ReturnType<typeof reducer>;
|
||||||
|
|
||||||
describe('reducers.entities.search', () => {
|
describe('reducers.entities.search', () => {
|
||||||
describe('results', () => {
|
describe('results', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const inputState = undefined; // eslint-disable-line no-undef
|
const inputState = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState: any = [];
|
const expectedState: any = [];
|
||||||
|
|
||||||
const actualState = reducer({results: inputState} as SearchState, action as GenericAction);
|
const actualState = reducer({results: inputState} as SearchState, action);
|
||||||
expect(actualState.results).toEqual(expectedState);
|
expect(actualState.results).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -116,11 +115,11 @@ describe('reducers.entities.search', () => {
|
|||||||
|
|
||||||
describe('fileResults', () => {
|
describe('fileResults', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const inputState = undefined; // eslint-disable-line no-undef
|
const inputState = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState: string[] = [];
|
const expectedState: string[] = [];
|
||||||
|
|
||||||
const actualState = reducer({fileResults: inputState} as SearchState, action as GenericAction);
|
const actualState = reducer({fileResults: inputState} as SearchState, action);
|
||||||
expect(actualState.fileResults).toEqual(expectedState);
|
expect(actualState.fileResults).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -187,11 +186,11 @@ describe('reducers.entities.search', () => {
|
|||||||
|
|
||||||
describe('matches', () => {
|
describe('matches', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const inputState = undefined; // eslint-disable-line no-undef
|
const inputState = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {};
|
const expectedState = {};
|
||||||
|
|
||||||
const actualState = reducer({matches: inputState} as SearchState, action as GenericAction);
|
const actualState = reducer({matches: inputState} as SearchState, action);
|
||||||
expect(actualState.matches).toEqual(expectedState);
|
expect(actualState.matches).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Post} from '@mattermost/types/posts';
|
import type {Post} from '@mattermost/types/posts';
|
||||||
@@ -9,9 +10,8 @@ import type {Search} from '@mattermost/types/search';
|
|||||||
|
|
||||||
import {PostTypes, PreferenceTypes, SearchTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {PostTypes, PreferenceTypes, SearchTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import {Preferences} from 'mattermost-redux/constants';
|
import {Preferences} from 'mattermost-redux/constants';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
function results(state: string[] = [], action: GenericAction) {
|
function results(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_POSTS: {
|
case SearchTypes.RECEIVED_SEARCH_POSTS: {
|
||||||
if (action.isGettingMore) {
|
if (action.isGettingMore) {
|
||||||
@@ -38,7 +38,7 @@ function results(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileResults(state: string[] = [], action: GenericAction) {
|
function fileResults(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_FILES: {
|
case SearchTypes.RECEIVED_SEARCH_FILES: {
|
||||||
if (action.isGettingMore) {
|
if (action.isGettingMore) {
|
||||||
@@ -55,7 +55,7 @@ function fileResults(state: string[] = [], action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function matches(state: Record<string, string[]> = {}, action: GenericAction) {
|
function matches(state: Record<string, string[]> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_POSTS:
|
case SearchTypes.RECEIVED_SEARCH_POSTS:
|
||||||
if (action.isGettingMore) {
|
if (action.isGettingMore) {
|
||||||
@@ -80,7 +80,7 @@ function matches(state: Record<string, string[]> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flagged(state: string[] = [], action: GenericAction) {
|
function flagged(state: string[] = [], action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_FLAGGED_POSTS: {
|
case SearchTypes.RECEIVED_SEARCH_FLAGGED_POSTS: {
|
||||||
return action.data.order;
|
return action.data.order;
|
||||||
@@ -161,7 +161,7 @@ function removePinnedPost(state: Record<string, string[]>, post: Post) {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pinned(state: Record<string, string[]> = {}, action: GenericAction) {
|
function pinned(state: Record<string, string[]> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_PINNED_POSTS: {
|
case SearchTypes.RECEIVED_SEARCH_PINNED_POSTS: {
|
||||||
const {channelId, pinned: posts} = action.data;
|
const {channelId, pinned: posts} = action.data;
|
||||||
@@ -214,7 +214,7 @@ function pinned(state: Record<string, string[]> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function recent(state: Record<string, Search[]> = {}, action: GenericAction) {
|
function recent(state: Record<string, Search[]> = {}, action: AnyAction) {
|
||||||
const {data, type} = action;
|
const {data, type} = action;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -259,7 +259,7 @@ function recent(state: Record<string, Search[]> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function current(state: any = {}, action: GenericAction) {
|
function current(state: any = {}, action: AnyAction) {
|
||||||
const {data, type} = action;
|
const {data, type} = action;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SearchTypes.RECEIVED_SEARCH_TERM: {
|
case SearchTypes.RECEIVED_SEARCH_TERM: {
|
||||||
@@ -282,7 +282,7 @@ function current(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSearchingTerm(state = false, action: GenericAction) {
|
function isSearchingTerm(state = false, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.SEARCH_POSTS_REQUEST:
|
case SearchTypes.SEARCH_POSTS_REQUEST:
|
||||||
return !action.isGettingMore;
|
return !action.isGettingMore;
|
||||||
@@ -293,7 +293,7 @@ function isSearchingTerm(state = false, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSearchGettingMore(state = false, action: GenericAction) {
|
function isSearchGettingMore(state = false, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.SEARCH_POSTS_REQUEST:
|
case SearchTypes.SEARCH_POSTS_REQUEST:
|
||||||
return action.isGettingMore;
|
return action.isGettingMore;
|
||||||
@@ -304,7 +304,7 @@ function isSearchGettingMore(state = false, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLimitedResults(state = -1, action: GenericAction): number {
|
function isLimitedResults(state = -1, action: AnyAction): number {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SearchTypes.SEARCH_POSTS_REQUEST: {
|
case SearchTypes.SEARCH_POSTS_REQUEST: {
|
||||||
if (!action.isGettingMore) {
|
if (!action.isGettingMore) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import {TeamTypes, AdminTypes} from 'mattermost-redux/action_types';
|
import {TeamTypes, AdminTypes} from 'mattermost-redux/action_types';
|
||||||
import teamsReducer from 'mattermost-redux/reducers/entities/teams';
|
import teamsReducer from 'mattermost-redux/reducers/entities/teams';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import deepFreeze from 'mattermost-redux/utils/deep_freeze';
|
import deepFreeze from 'mattermost-redux/utils/deep_freeze';
|
||||||
|
|
||||||
type ReducerState = ReturnType<typeof teamsReducer>;
|
type ReducerState = ReturnType<typeof teamsReducer>;
|
||||||
@@ -12,7 +11,7 @@ describe('Reducers.teams.myMembers', () => {
|
|||||||
it('initial state', async () => {
|
it('initial state', async () => {
|
||||||
let state = {} as ReducerState;
|
let state = {} as ReducerState;
|
||||||
|
|
||||||
state = teamsReducer(state, {} as GenericAction);
|
state = teamsReducer(state, {type: undefined});
|
||||||
expect(state.myMembers).toEqual({});
|
expect(state.myMembers).toEqual({});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ describe('Reducers.teams.myMembers', () => {
|
|||||||
expect(state.myMembers).toEqual(testAction.result);
|
expect(state.myMembers).toEqual(testAction.result);
|
||||||
|
|
||||||
testAction.data = myMember3;
|
testAction.data = myMember3;
|
||||||
state = teamsReducer(state, {} as GenericAction);
|
state = teamsReducer(state, {type: undefined});
|
||||||
expect(state.myMembers).toEqual(testAction.result);
|
expect(state.myMembers).toEqual(testAction.result);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ describe('Reducers.teams.myMembers', () => {
|
|||||||
state = teamsReducer(state, testAction);
|
state = teamsReducer(state, testAction);
|
||||||
expect(state.myMembers).toEqual(testAction.result);
|
expect(state.myMembers).toEqual(testAction.result);
|
||||||
|
|
||||||
state = teamsReducer(state, {} as GenericAction);
|
state = teamsReducer(state, {type: undefined});
|
||||||
expect(state.myMembers).toEqual(testAction.result);
|
expect(state.myMembers).toEqual(testAction.result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
import {combineReducers} from 'redux';
|
import {combineReducers} from 'redux';
|
||||||
|
|
||||||
import type {Team, TeamMembership, TeamUnread} from '@mattermost/types/teams';
|
import type {Team, TeamMembership, TeamUnread} from '@mattermost/types/teams';
|
||||||
@@ -8,10 +9,9 @@ import type {UserProfile} from '@mattermost/types/users';
|
|||||||
import type {RelationOneToOne, IDMappedObjects} from '@mattermost/types/utilities';
|
import type {RelationOneToOne, IDMappedObjects} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {AdminTypes, ChannelTypes, TeamTypes, UserTypes, SchemeTypes, GroupTypes} from 'mattermost-redux/action_types';
|
import {AdminTypes, ChannelTypes, TeamTypes, UserTypes, SchemeTypes, GroupTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import {teamListToMap} from 'mattermost-redux/utils/team_utils';
|
import {teamListToMap} from 'mattermost-redux/utils/team_utils';
|
||||||
|
|
||||||
function currentTeamId(state = '', action: GenericAction) {
|
function currentTeamId(state = '', action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TeamTypes.SELECT_TEAM:
|
case TeamTypes.SELECT_TEAM:
|
||||||
return action.data;
|
return action.data;
|
||||||
@@ -23,7 +23,7 @@ function currentTeamId(state = '', action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function teams(state: IDMappedObjects<Team> = {}, action: GenericAction) {
|
function teams(state: IDMappedObjects<Team> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TeamTypes.RECEIVED_TEAMS_LIST:
|
case TeamTypes.RECEIVED_TEAMS_LIST:
|
||||||
case SchemeTypes.RECEIVED_SCHEME_TEAMS:
|
case SchemeTypes.RECEIVED_SCHEME_TEAMS:
|
||||||
@@ -94,7 +94,7 @@ function teams(state: IDMappedObjects<Team> = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function myMembers(state: RelationOneToOne<Team, TeamMembership> = {}, action: GenericAction) {
|
function myMembers(state: RelationOneToOne<Team, TeamMembership> = {}, action: AnyAction) {
|
||||||
function updateState(receivedTeams: IDMappedObjects<Team> = {}, currentState: RelationOneToOne<Team, TeamMembership> = {}) {
|
function updateState(receivedTeams: IDMappedObjects<Team> = {}, currentState: RelationOneToOne<Team, TeamMembership> = {}) {
|
||||||
return Object.keys(receivedTeams).forEach((teamId) => {
|
return Object.keys(receivedTeams).forEach((teamId) => {
|
||||||
if (receivedTeams[teamId].delete_at > 0 && currentState[teamId]) {
|
if (receivedTeams[teamId].delete_at > 0 && currentState[teamId]) {
|
||||||
@@ -289,7 +289,7 @@ function myMembers(state: RelationOneToOne<Team, TeamMembership> = {}, action: G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function membersInTeam(state: RelationOneToOne<Team, RelationOneToOne<UserProfile, TeamMembership>> = {}, action: GenericAction) {
|
function membersInTeam(state: RelationOneToOne<Team, RelationOneToOne<UserProfile, TeamMembership>> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TeamTypes.RECEIVED_MEMBER_IN_TEAM: {
|
case TeamTypes.RECEIVED_MEMBER_IN_TEAM: {
|
||||||
const data = action.data;
|
const data = action.data;
|
||||||
@@ -369,7 +369,7 @@ function membersInTeam(state: RelationOneToOne<Team, RelationOneToOne<UserProfil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stats(state: any = {}, action: GenericAction) {
|
function stats(state: any = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TeamTypes.RECEIVED_TEAM_STATS: {
|
case TeamTypes.RECEIVED_TEAM_STATS: {
|
||||||
const stat = action.data;
|
const stat = action.data;
|
||||||
@@ -395,7 +395,7 @@ function stats(state: any = {}, action: GenericAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupsAssociatedToTeam(state: RelationOneToOne<Team, {ids: string[]; totalCount: number}> = {}, action: GenericAction) {
|
function groupsAssociatedToTeam(state: RelationOneToOne<Team, {ids: string[]; totalCount: number}> = {}, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case GroupTypes.RECEIVED_GROUP_ASSOCIATED_TO_TEAM: {
|
case GroupTypes.RECEIVED_GROUP_ASSOCIATED_TO_TEAM: {
|
||||||
const {teamID, groups} = action.data;
|
const {teamID, groups} = action.data;
|
||||||
@@ -445,7 +445,7 @@ function groupsAssociatedToTeam(state: RelationOneToOne<Team, {ids: string[]; to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTeamMemberSchemeRoles(state: RelationOneToOne<Team, RelationOneToOne<UserProfile, TeamMembership>>, action: GenericAction) {
|
function updateTeamMemberSchemeRoles(state: RelationOneToOne<Team, RelationOneToOne<UserProfile, TeamMembership>>, action: AnyAction) {
|
||||||
const {teamId, userId, isSchemeUser, isSchemeAdmin} = action.data;
|
const {teamId, userId, isSchemeUser, isSchemeAdmin} = action.data;
|
||||||
const team = state[teamId];
|
const team = state[teamId];
|
||||||
if (team) {
|
if (team) {
|
||||||
@@ -467,7 +467,7 @@ function updateTeamMemberSchemeRoles(state: RelationOneToOne<Team, RelationOneTo
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMyTeamMemberSchemeRoles(state: RelationOneToOne<Team, TeamMembership>, action: GenericAction) {
|
function updateMyTeamMemberSchemeRoles(state: RelationOneToOne<Team, TeamMembership>, action: AnyAction) {
|
||||||
const {teamId, isSchemeUser, isSchemeAdmin} = action.data;
|
const {teamId, isSchemeUser, isSchemeAdmin} = action.data;
|
||||||
const member = state[teamId];
|
const member = state[teamId];
|
||||||
if (member) {
|
if (member) {
|
||||||
@@ -483,7 +483,7 @@ function updateMyTeamMemberSchemeRoles(state: RelationOneToOne<Team, TeamMembers
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function totalCount(state = 0, action: GenericAction) {
|
function totalCount(state = 0, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TeamTypes.RECEIVED_TOTAL_TEAM_COUNT: {
|
case TeamTypes.RECEIVED_TOTAL_TEAM_COUNT: {
|
||||||
return action.data;
|
return action.data;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {Channel} from '@mattermost/types/channels';
|
import type {Channel} from '@mattermost/types/channels';
|
||||||
import type {Team, TeamUnread} from '@mattermost/types/teams';
|
import type {Team, TeamUnread} from '@mattermost/types/teams';
|
||||||
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
||||||
|
|
||||||
import {ChannelTypes, TeamTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {ChannelTypes, TeamTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import {General} from 'mattermost-redux/constants';
|
import {General} from 'mattermost-redux/constants';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {ExtraData} from './types';
|
import type {ExtraData} from './types';
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ function isDmGmChannel(channelType: Channel['type']) {
|
|||||||
return channelType === General.DM_CHANNEL || channelType === General.GM_CHANNEL;
|
return channelType === General.DM_CHANNEL || channelType === General.GM_CHANNEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAllTeamThreadsRead(state: ThreadsState['counts'], action: GenericAction): ThreadsState['counts'] {
|
function handleAllTeamThreadsRead(state: ThreadsState['counts'], action: AnyAction): ThreadsState['counts'] {
|
||||||
const counts = state[action.data.team_id] ?? {};
|
const counts = state[action.data.team_id] ?? {};
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@@ -28,7 +29,7 @@ function handleAllTeamThreadsRead(state: ThreadsState['counts'], action: Generic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEqual(state: ThreadsState['counts'], action: GenericAction, unreads: boolean) {
|
function isEqual(state: ThreadsState['counts'], action: AnyAction, unreads: boolean) {
|
||||||
const counts = state[action.data.team_id] ?? {};
|
const counts = state[action.data.team_id] ?? {};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -56,7 +57,7 @@ function isEqual(state: ThreadsState['counts'], action: GenericAction, unreads:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleReadChangedThread(state: ThreadsState['counts'], action: GenericAction, teamId: string, isUrgent: boolean): ThreadsState['counts'] {
|
function handleReadChangedThread(state: ThreadsState['counts'], action: AnyAction, teamId: string, isUrgent: boolean): ThreadsState['counts'] {
|
||||||
const {
|
const {
|
||||||
prevUnreadMentions = 0,
|
prevUnreadMentions = 0,
|
||||||
newUnreadMentions = 0,
|
newUnreadMentions = 0,
|
||||||
@@ -91,7 +92,7 @@ function handleReadChangedThread(state: ThreadsState['counts'], action: GenericA
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLeaveTeam(state: ThreadsState['counts'], action: GenericAction): ThreadsState['counts'] {
|
function handleLeaveTeam(state: ThreadsState['counts'], action: AnyAction): ThreadsState['counts'] {
|
||||||
const team: Team = action.data;
|
const team: Team = action.data;
|
||||||
|
|
||||||
if (!state[team.id]) {
|
if (!state[team.id]) {
|
||||||
@@ -104,7 +105,7 @@ function handleLeaveTeam(state: ThreadsState['counts'], action: GenericAction):
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLeaveChannel(state: ThreadsState['counts'] = {}, action: GenericAction, extra: ExtraData) {
|
function handleLeaveChannel(state: ThreadsState['counts'] = {}, action: AnyAction, extra: ExtraData) {
|
||||||
if (!extra.threadsToDelete || extra.threadsToDelete.length === 0) {
|
if (!extra.threadsToDelete || extra.threadsToDelete.length === 0) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@@ -135,7 +136,7 @@ function handleLeaveChannel(state: ThreadsState['counts'] = {}, action: GenericA
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDecrementThreadCounts(state: ThreadsState['counts'], action: GenericAction) {
|
function handleDecrementThreadCounts(state: ThreadsState['counts'], action: AnyAction) {
|
||||||
const {teamId, replies, mentions} = action;
|
const {teamId, replies, mentions} = action;
|
||||||
const counts = state[teamId];
|
const counts = state[teamId];
|
||||||
if (!counts) {
|
if (!counts) {
|
||||||
@@ -152,7 +153,7 @@ function handleDecrementThreadCounts(state: ThreadsState['counts'], action: Gene
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function countsIncludingDirectReducer(state: ThreadsState['counts'] = {}, action: GenericAction, extra: ExtraData) {
|
export function countsIncludingDirectReducer(state: ThreadsState['counts'] = {}, action: AnyAction, extra: ExtraData) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ThreadTypes.ALL_TEAM_THREADS_READ:
|
case ThreadTypes.ALL_TEAM_THREADS_READ:
|
||||||
return handleAllTeamThreadsRead(state, action);
|
return handleAllTeamThreadsRead(state, action);
|
||||||
@@ -219,7 +220,7 @@ export function countsIncludingDirectReducer(state: ThreadsState['counts'] = {},
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function countsReducer(state: ThreadsState['counts'] = {}, action: GenericAction, extra: ExtraData) {
|
export function countsReducer(state: ThreadsState['counts'] = {}, action: AnyAction, extra: ExtraData) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ThreadTypes.ALL_TEAM_THREADS_READ:
|
case ThreadTypes.ALL_TEAM_THREADS_READ:
|
||||||
return handleAllTeamThreadsRead(state, action);
|
return handleAllTeamThreadsRead(state, action);
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {Post} from '@mattermost/types/posts';
|
import type {Post} from '@mattermost/types/posts';
|
||||||
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
||||||
import type {UserProfile} from '@mattermost/types/users';
|
import type {UserProfile} from '@mattermost/types/users';
|
||||||
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
import type {IDMappedObjects} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {ChannelTypes, PostTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {ChannelTypes, PostTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import {countsReducer, countsIncludingDirectReducer} from './counts';
|
import {countsReducer, countsIncludingDirectReducer} from './counts';
|
||||||
import {threadsInTeamReducer, unreadThreadsInTeamReducer} from './threadsInTeam';
|
import {threadsInTeamReducer, unreadThreadsInTeamReducer} from './threadsInTeam';
|
||||||
import type {ExtraData} from './types';
|
import type {ExtraData} from './types';
|
||||||
|
|
||||||
export const threadsReducer = (state: ThreadsState['threads'] = {}, action: GenericAction, extra: ExtraData) => {
|
export const threadsReducer = (state: ThreadsState['threads'] = {}, action: AnyAction, extra: ExtraData) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ThreadTypes.RECEIVED_UNREAD_THREADS:
|
case ThreadTypes.RECEIVED_UNREAD_THREADS:
|
||||||
case ThreadTypes.RECEIVED_THREADS: {
|
case ThreadTypes.RECEIVED_THREADS: {
|
||||||
@@ -164,7 +165,7 @@ const initialState = {
|
|||||||
|
|
||||||
// custom combineReducers function
|
// custom combineReducers function
|
||||||
// enables passing data between reducers
|
// enables passing data between reducers
|
||||||
function reducer(state: ThreadsState = initialState, action: GenericAction): ThreadsState {
|
function reducer(state: ThreadsState = initialState, action: AnyAction): ThreadsState {
|
||||||
const extra: ExtraData = {
|
const extra: ExtraData = {
|
||||||
threads: state.threads,
|
threads: state.threads,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {Team} from '@mattermost/types/teams';
|
import type {Team} from '@mattermost/types/teams';
|
||||||
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
import type {ThreadsState, UserThread} from '@mattermost/types/threads';
|
||||||
import type {IDMappedObjects, RelationOneToMany} from '@mattermost/types/utilities';
|
import type {IDMappedObjects, RelationOneToMany} from '@mattermost/types/utilities';
|
||||||
|
|
||||||
import {ChannelTypes, PostTypes, TeamTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
import {ChannelTypes, PostTypes, TeamTypes, ThreadTypes, UserTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import type {ExtraData} from './types';
|
import type {ExtraData} from './types';
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ function shouldAddThreadId(ids: Array<UserThread['id']>, thread: UserThread, thr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePostRemoved(state: State, action: GenericAction): State {
|
function handlePostRemoved(state: State, action: AnyAction): State {
|
||||||
const post = action.data;
|
const post = action.data;
|
||||||
if (post.root_id) {
|
if (post.root_id) {
|
||||||
return state;
|
return state;
|
||||||
@@ -89,7 +90,7 @@ function handleSingleTeamReceivedThread(state: State, thread: UserThread, teamId
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleReceivedThread(state: State, action: GenericAction, extra: ExtraData) {
|
export function handleReceivedThread(state: State, action: AnyAction, extra: ExtraData) {
|
||||||
const {thread, team_id: teamId} = action.data;
|
const {thread, team_id: teamId} = action.data;
|
||||||
|
|
||||||
if (!teamId) {
|
if (!teamId) {
|
||||||
@@ -102,7 +103,7 @@ export function handleReceivedThread(state: State, action: GenericAction, extra:
|
|||||||
// add the thread only if it's 'newer' than other threads
|
// add the thread only if it's 'newer' than other threads
|
||||||
// older threads will be added by scrolling so no need to manually add.
|
// older threads will be added by scrolling so no need to manually add.
|
||||||
// furthermore manually adding older thread will BREAK pagination
|
// furthermore manually adding older thread will BREAK pagination
|
||||||
export function handleFollowChanged(state: State, action: GenericAction, extra: ExtraData) {
|
export function handleFollowChanged(state: State, action: AnyAction, extra: ExtraData) {
|
||||||
const {id, team_id: teamId, following} = action.data;
|
const {id, team_id: teamId, following} = action.data;
|
||||||
const nextSet = new Set(state[teamId] || []);
|
const nextSet = new Set(state[teamId] || []);
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ export function handleFollowChanged(state: State, action: GenericAction, extra:
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleReceiveThreads(state: State, action: GenericAction) {
|
function handleReceiveThreads(state: State, action: AnyAction) {
|
||||||
const nextSet = new Set(state[action.data.team_id] || []);
|
const nextSet = new Set(state[action.data.team_id] || []);
|
||||||
|
|
||||||
action.data.threads.forEach((thread: UserThread) => {
|
action.data.threads.forEach((thread: UserThread) => {
|
||||||
@@ -153,7 +154,7 @@ function handleReceiveThreads(state: State, action: GenericAction) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLeaveChannel(state: State, action: GenericAction, extra: ExtraData) {
|
function handleLeaveChannel(state: State, action: AnyAction, extra: ExtraData) {
|
||||||
if (!extra.threadsToDelete || extra.threadsToDelete.length === 0) {
|
if (!extra.threadsToDelete || extra.threadsToDelete.length === 0) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@@ -182,7 +183,7 @@ function handleLeaveChannel(state: State, action: GenericAction, extra: ExtraDat
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleLeaveTeam(state: State, action: GenericAction) {
|
function handleLeaveTeam(state: State, action: AnyAction) {
|
||||||
const team: Team = action.data;
|
const team: Team = action.data;
|
||||||
|
|
||||||
if (!state[team.id]) {
|
if (!state[team.id]) {
|
||||||
@@ -195,7 +196,7 @@ function handleLeaveTeam(state: State, action: GenericAction) {
|
|||||||
return nextState;
|
return nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSingleTeamThreadRead(state: ThreadsState['unreadThreadsInTeam'], action: GenericAction, teamId: string, extra: ExtraData) {
|
function handleSingleTeamThreadRead(state: ThreadsState['unreadThreadsInTeam'], action: AnyAction, teamId: string, extra: ExtraData) {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
newUnreadMentions,
|
newUnreadMentions,
|
||||||
@@ -241,7 +242,7 @@ function handleSingleTeamThreadRead(state: ThreadsState['unreadThreadsInTeam'],
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const threadsInTeamReducer = (state: ThreadsState['threadsInTeam'] = {}, action: GenericAction, extra: ExtraData) => {
|
export const threadsInTeamReducer = (state: ThreadsState['threadsInTeam'] = {}, action: AnyAction, extra: ExtraData) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ThreadTypes.RECEIVED_THREAD:
|
case ThreadTypes.RECEIVED_THREAD:
|
||||||
return handleReceivedThread(state, action, extra);
|
return handleReceivedThread(state, action, extra);
|
||||||
@@ -261,7 +262,7 @@ export const threadsInTeamReducer = (state: ThreadsState['threadsInTeam'] = {},
|
|||||||
return state;
|
return state;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const unreadThreadsInTeamReducer = (state: ThreadsState['unreadThreadsInTeam'] = {}, action: GenericAction, extra: ExtraData) => {
|
export const unreadThreadsInTeamReducer = (state: ThreadsState['unreadThreadsInTeam'] = {}, action: AnyAction, extra: ExtraData) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ThreadTypes.READ_CHANGED_THREAD: {
|
case ThreadTypes.READ_CHANGED_THREAD: {
|
||||||
const {teamId} = action.data;
|
const {teamId} = action.data;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import {WebsocketEvents} from 'mattermost-redux/constants';
|
import {WebsocketEvents} from 'mattermost-redux/constants';
|
||||||
import typingReducer from 'mattermost-redux/reducers/entities/typing';
|
import typingReducer from 'mattermost-redux/reducers/entities/typing';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
import TestHelper from '../../../test/test_helper';
|
import TestHelper from '../../../test/test_helper';
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ describe('Reducers.Typing', () => {
|
|||||||
|
|
||||||
state = typingReducer(
|
state = typingReducer(
|
||||||
state,
|
state,
|
||||||
{} as GenericAction,
|
{type: undefined},
|
||||||
);
|
);
|
||||||
expect(state).toEqual({});
|
expect(state).toEqual({});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {Typing} from '@mattermost/types/typing';
|
import type {Typing} from '@mattermost/types/typing';
|
||||||
|
|
||||||
import {WebsocketEvents} from 'mattermost-redux/constants';
|
import {WebsocketEvents} from 'mattermost-redux/constants';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
export default function typing(state: Typing = {}, action: GenericAction): Typing {
|
export default function typing(state: Typing = {}, action: AnyAction): Typing {
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
type,
|
type,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import type {AnyAction} from 'redux';
|
||||||
|
|
||||||
import type {CloudUsage} from '@mattermost/types/cloud';
|
import type {CloudUsage} from '@mattermost/types/cloud';
|
||||||
|
|
||||||
import {CloudTypes} from 'mattermost-redux/action_types';
|
import {CloudTypes} from 'mattermost-redux/action_types';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
|
|
||||||
const emptyUsage = {
|
const emptyUsage = {
|
||||||
files: {
|
files: {
|
||||||
@@ -27,7 +28,7 @@ const emptyUsage = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// represents the usage associated with this workspace
|
// represents the usage associated with this workspace
|
||||||
export default function usage(state: CloudUsage = emptyUsage, action: GenericAction) {
|
export default function usage(state: CloudUsage = emptyUsage, action: AnyAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case CloudTypes.RECEIVED_MESSAGES_USAGE: {
|
case CloudTypes.RECEIVED_MESSAGES_USAGE: {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import type {IDMappedObjects} from '@mattermost/types/utilities';
|
|||||||
|
|
||||||
import {UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
import {UserTypes, ChannelTypes} from 'mattermost-redux/action_types';
|
||||||
import reducer from 'mattermost-redux/reducers/entities/users';
|
import reducer from 'mattermost-redux/reducers/entities/users';
|
||||||
import type {GenericAction} from 'mattermost-redux/types/actions';
|
|
||||||
import deepFreezeAndThrowOnMutation from 'mattermost-redux/utils/deep_freeze';
|
import deepFreezeAndThrowOnMutation from 'mattermost-redux/utils/deep_freeze';
|
||||||
|
|
||||||
import {TestHelper} from 'utils/test_helper';
|
import {TestHelper} from 'utils/test_helper';
|
||||||
@@ -17,12 +16,12 @@ describe('Reducers.users', () => {
|
|||||||
describe('profilesInChannel', () => {
|
describe('profilesInChannel', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = undefined;
|
const state = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {
|
const expectedState = {
|
||||||
profilesInChannel: {},
|
profilesInChannel: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const newState = reducer(state, action as GenericAction);
|
const newState = reducer(state, action);
|
||||||
expect(newState.profilesInChannel).toEqual(expectedState.profilesInChannel);
|
expect(newState.profilesInChannel).toEqual(expectedState.profilesInChannel);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -296,12 +295,12 @@ describe('Reducers.users', () => {
|
|||||||
describe('profilesNotInChannel', () => {
|
describe('profilesNotInChannel', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = undefined;
|
const state = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {
|
const expectedState = {
|
||||||
profilesNotInChannel: {},
|
profilesNotInChannel: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const newState = reducer(state, action as GenericAction);
|
const newState = reducer(state, action);
|
||||||
expect(newState.profilesNotInChannel).toEqual(expectedState.profilesNotInChannel);
|
expect(newState.profilesNotInChannel).toEqual(expectedState.profilesNotInChannel);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -588,12 +587,12 @@ describe('Reducers.users', () => {
|
|||||||
describe('profilesNotInGroup', () => {
|
describe('profilesNotInGroup', () => {
|
||||||
it('initial state', () => {
|
it('initial state', () => {
|
||||||
const state = undefined;
|
const state = undefined;
|
||||||
const action = {};
|
const action = {type: undefined};
|
||||||
const expectedState = {
|
const expectedState = {
|
||||||
profilesNotInGroup: {},
|
profilesNotInGroup: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const newState = reducer(state, action as GenericAction);
|
const newState = reducer(state, action);
|
||||||
expect(newState.profilesNotInGroup).toEqual(expectedState.profilesNotInGroup);
|
expect(newState.profilesNotInGroup).toEqual(expectedState.profilesNotInGroup);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Ссылка в новой задаче
Block a user