Improve Redux types part 7/Remove unused actions (#26006)

* Remove unused setFirstChannelName action

* Remove makeOnMoveHistoryIndex

* Remove selectPostFromRightHandSideSearchByPostId

* Remove selectPostAndParentChannel

* Remove searchMoreChannels

* Remove fetchRemoteListing

* Remove sendGenericPostMessage

* Remove unused version of periodic status update code

* Remove unused code around non-global items in storage

Either pre-Redux or early in our usage of Redux, I think this code was
meant to let us store things in localStorage on a per-user basis. If we
ever used it, it hasn't been for a while now.

* Remove unused loadProfilesAndStatusesInChannel action

* Remove collapseCategory and expandCategory

* Removed unused actions from mattermost-redux/actions/channels

* Remove unused getDataRetentionPolicy action and state

* Remove unused getWarnMetricsStatus action

* Remove unused getFirstAdminVisitMarketplaceStatus action

* Remove unused getReactionsForPost action

* Remove now-unused state.entities.posts.selectedPostId

* asdf marketplace stuff in general

* Remove unused makeDirectChannelVisibleIfNecessary and makeGroupMessageVisibleIfNecessary

* Remove old searchFiles action

* Remove unused search actions

* Remove non-graceful addUsersToTeam action

* Remove unused version of joinTeam action

* Remove unused updateTeamMemberRoles action

* Remove another unused verison of the periodic status update code

* Remove unused getUserAccessTokens action

* Fix linting

* Remove unit tests involving recent search results

* Fix another test
Этот коммит содержится в:
Harrison Healey
2024-02-02 15:59:00 -05:00
коммит произвёл GitHub
родитель 45633198ca
Коммит 25073a99e4
61 изменённых файлов: 35 добавлений и 1803 удалений

Просмотреть файл

@@ -26,12 +26,8 @@ const getFirstChannelNamePref = createSelector(
},
);
export function getFirstChannelNameViews(state: GlobalState) {
return state.views.channelSidebar.firstChannelName;
}
export function getFirstChannelName(state: GlobalState) {
return getFirstChannelNameViews(state) || getFirstChannelNamePref(state)?.value || '';
return getFirstChannelNamePref(state)?.value || '';
}
export function getShowLaunchingWorkspace(state: GlobalState) {

Просмотреть файл

@@ -3,8 +3,6 @@
import * as Selectors from 'selectors/storage';
import {getPrefix} from 'utils/storage_utils';
import type {GlobalState} from 'types/store';
describe('Selectors.Storage', () => {
@@ -27,23 +25,9 @@ describe('Selectors.Storage', () => {
},
} as unknown as GlobalState;
it('getPrefix', () => {
expect(getPrefix({} as GlobalState)).toEqual('unknown_');
expect(getPrefix({entities: {}} as GlobalState)).toEqual('unknown_');
expect(getPrefix({entities: {users: {currentUserId: 'not-exists'}}} as GlobalState)).toEqual('unknown_');
expect(getPrefix({entities: {users: {currentUserId: 'not-exists', profiles: {}}}} as GlobalState)).toEqual('unknown_');
expect(getPrefix({entities: {users: {currentUserId: 'exists', profiles: {exists: {id: 'user_id'}}}}} as unknown as GlobalState)).toEqual('user_id_');
});
it('makeGetGlobalItem', () => {
expect(Selectors.makeGetGlobalItem('not-existing-global-item', undefined)(testState)).toEqual(undefined);
expect(Selectors.makeGetGlobalItem('not-existing-global-item', 'default')(testState)).toEqual('default');
expect(Selectors.makeGetGlobalItem('global-item', undefined)(testState)).toEqual('global-item-value');
});
it('makeGetItem', () => {
expect(Selectors.makeGetItem('not-existing-item', undefined)(testState)).toEqual(undefined);
expect(Selectors.makeGetItem('not-existing-item', 'default')(testState)).toEqual('default');
expect(Selectors.makeGetItem('item', undefined)(testState)).toEqual('item-value');
});
});

Просмотреть файл

@@ -1,8 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {getPrefix} from 'utils/storage_utils';
import type {GlobalState} from 'types/store';
export const getGlobalItem = <T = any>(state: GlobalState, name: string, defaultValue: T) => {
@@ -11,16 +9,6 @@ export const getGlobalItem = <T = any>(state: GlobalState, name: string, default
return getItemFromStorage(storage, name, defaultValue);
};
export const getItem = <T = any>(state: GlobalState, name: string, defaultValue: T) => {
return getGlobalItem(state, getPrefix(state) + name, defaultValue);
};
export const makeGetItem = <T = any>(name: string, defaultValue: T) => {
return (state: GlobalState) => {
return getItem(state, name, defaultValue);
};
};
export const makeGetGlobalItem = <T = any>(name: string, defaultValue: T) => {
return (state: GlobalState) => {
return getGlobalItem(state, name, defaultValue);