Remove most unused props (#34979)

* Remove some unused props

* Removed unused state and actions involving profilesWithoutTeam

* Remove unused page prop from DataGrid

* Remove some unused props from system console components

* Remove some unused props related to self serve and trials

* Remove unused props from post related components

* Remove unused props from user settings components

* Remove some more unused props
This commit is contained in:
Harrison Healey
2026-01-20 17:52:14 -05:00
committed by GitHub
parent 86024cb4cc
commit fa399a5b05
132 changed files with 84 additions and 766 deletions
@@ -132,31 +132,4 @@ describe('actions/status_actions', () => {
expect(getStatusesByIds).not.toHaveBeenCalled();
});
});
describe('loadStatusesForProfilesMap', () => {
test('load statuses for users map', () => {
const state = cloneDeep(initialState);
const testStore = mockStore(state);
testStore.dispatch(Actions.loadStatusesForProfilesMap({
user_id2: {id: 'user_id2', username: 'user2'} as UserProfile,
user_id3: {id: 'user_id3', username: 'user3'} as UserProfile,
user_id4: {id: 'user_id4', username: 'user4'} as UserProfile,
}));
expect(getStatusesByIds).toHaveBeenCalledWith((expect as GreatExpectations).arrayContainingExactly(['user_id2', 'user_id3', 'user_id4']));
});
test('load statuses for empty users map', () => {
const state = cloneDeep(initialState);
const testStore = mockStore(state);
testStore.dispatch(Actions.loadStatusesForProfilesMap({}));
expect(getStatusesByIds).not.toHaveBeenCalled();
});
test('load statuses for null users map', () => {
const state = cloneDeep(initialState);
const testStore = mockStore(state);
testStore.dispatch(Actions.loadStatusesForProfilesMap(null));
expect(getStatusesByIds).not.toHaveBeenCalled();
});
});
});
@@ -80,25 +80,6 @@ export function loadStatusesForProfilesList(users: UserProfile[] | null): Action
};
}
export function loadStatusesForProfilesMap(users: Record<string, UserProfile> | UserProfile[] | null): ActionFunc {
return (dispatch) => {
if (users == null) {
return {data: false};
}
const statusesToLoad = [];
for (const userId in users) {
if (Object.hasOwn(users, userId)) {
statusesToLoad.push(userId);
}
}
dispatch(loadStatusesByIds(statusesToLoad));
return {data: true};
};
}
export function loadStatusesByIds(userIds: string[]): ActionFunc {
return (dispatch, getState) => {
const state = getState();
+1 -11
View File
@@ -26,7 +26,7 @@ import type {ActionResult} from 'mattermost-redux/types/actions';
import {calculateUnreadCount} from 'mattermost-redux/utils/channel_utils';
import {loadCustomEmojisForCustomStatusesByUserIds} from 'actions/emoji_actions';
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions';
import {loadStatusesForProfilesList} from 'actions/status_actions';
import {getDisplayedChannels} from 'selectors/views/channel_sidebar';
import store from 'stores/redux_store';
@@ -153,16 +153,6 @@ export function loadTeamMembersForProfilesList(profiles: UserProfile[], teamId:
};
}
export function loadProfilesWithoutTeam(page: number, perPage: number, options?: Record<string, any>): ActionFuncAsync {
return async (doDispatch) => {
const {data} = await doDispatch(UserActions.getProfilesWithoutTeam(page, perPage, options));
doDispatch(loadStatusesForProfilesMap(data!));
return {data};
};
}
export function loadTeamMembersAndChannelMembersForProfilesList(profiles: UserProfile[], teamId: string, channelId: string): ActionFuncAsync {
return async (doDispatch, doGetState) => {
const state = doGetState();
@@ -70,7 +70,6 @@ exports[`components/admin_console/access_control/PolicyList should match snapsho
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No policies found"
@@ -161,7 +160,6 @@ exports[`components/admin_console/access_control/PolicyList should match snapsho
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No policies found"
@@ -252,7 +250,6 @@ exports[`components/admin_console/access_control/PolicyList should match snapsho
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No policies found"
@@ -91,7 +91,6 @@ describe('components/admin_console/access_control/PolicyList', () => {
wrapper.update();
expect(mockSearchPolicies).not.toHaveBeenCalled();
expect(wrapper.find('DataGrid').prop('page')).toBe(0);
});
test('should get columns correctly', () => {
@@ -350,7 +350,6 @@ export default function PolicyList(props: Props): JSX.Element {
term={search}
placeholderEmpty={placeholderEmpty}
rowsContainerStyles={rowsContainerStyles}
page={page}
nextPage={nextPage}
previousPage={previousPage}
/>
@@ -545,7 +545,6 @@ class ChannelList extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -3,7 +3,6 @@
import type {ComponentType} from 'react';
import React from 'react';
import type {IntlShape} from 'react-intl';
import {useIntl} from 'react-intl';
import {removeAuditCertificate, uploadAuditCertificate} from 'actions/admin_actions';
@@ -16,9 +15,6 @@ import RemoveFileSetting from '../remove_file_setting';
type Props = {
id?: string;
config: any;
license: any;
intl: IntlShape;
value: any;
onChange: (id: string, value: string) => void;
disabled: boolean;
@@ -214,7 +214,6 @@ export default function TeamReviewers({teamReviewersSetting, onChange, disabled}
<DataGrid
rows={rows}
columns={columns}
page={page}
startCount={startCount}
endCount={endCount}
loading={false}
@@ -46,7 +46,6 @@ type Props = {
minimumColumnWidth?: number;
page: number;
startCount: number;
endCount: number;
total?: number;
@@ -77,7 +77,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={4}
loading={false}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -209,7 +208,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={1}
loading={true}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -445,7 +443,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={4}
loading={false}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -587,7 +584,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={1}
loading={true}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -828,7 +824,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={4}
loading={false}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -970,7 +965,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={1}
loading={true}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -1206,7 +1200,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={4}
loading={false}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -1348,7 +1341,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
endCount={0}
loading={true}
nextPage={[Function]}
page={0}
previousPage={[Function]}
rows={Array []}
startCount={1}
@@ -99,7 +99,6 @@ exports[`components/admin_console/data_retention_settings/channel_list should ma
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -246,7 +245,6 @@ exports[`components/admin_console/data_retention_settings/channel_list should ma
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -33,7 +33,6 @@ describe('components/admin_console/data_retention_settings/channel_list', () =>
searchTerm=''
filters={{}}
onRemoveCallback={jest.fn()}
onAddCallback={jest.fn()}
channelsToRemove={{}}
channelsToAdd={{}}
channels={testChannels}
@@ -67,7 +66,6 @@ describe('components/admin_console/data_retention_settings/channel_list', () =>
searchTerm=''
filters={{}}
onRemoveCallback={jest.fn()}
onAddCallback={jest.fn()}
channelsToRemove={{}}
channelsToAdd={{}}
channels={testChannels}
@@ -29,7 +29,6 @@ type Props = {
policyId?: string;
onRemoveCallback: (channel: ChannelWithTeamData) => void;
onAddCallback: (channels: ChannelWithTeamData[]) => void;
channelsToRemove: Record<string, ChannelWithTeamData>;
channelsToAdd: Record<string, ChannelWithTeamData>;
@@ -347,7 +346,6 @@ export default class ChannelList extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -193,7 +193,6 @@ exports[`components/admin_console/data_retention_settings/custom_policy_form sho
expanded={true}
>
<Connect(TeamList)
onAddCallback={[Function]}
onRemoveCallback={[Function]}
teamsToAdd={Object {}}
teamsToRemove={Object {}}
@@ -233,7 +232,6 @@ exports[`components/admin_console/data_retention_settings/custom_policy_form sho
<Connect(ChannelList)
channelsToAdd={Object {}}
channelsToRemove={Object {}}
onAddCallback={[Function]}
onRemoveCallback={[Function]}
/>
</CardBody>
@@ -455,7 +453,6 @@ exports[`components/admin_console/data_retention_settings/custom_policy_form sho
expanded={true}
>
<Connect(TeamList)
onAddCallback={[Function]}
onRemoveCallback={[Function]}
policyId="fsdgdsgdsgh"
teamsToAdd={Object {}}
@@ -496,7 +493,6 @@ exports[`components/admin_console/data_retention_settings/custom_policy_form sho
<Connect(ChannelList)
channelsToAdd={Object {}}
channelsToRemove={Object {}}
onAddCallback={[Function]}
onRemoveCallback={[Function]}
policyId="fsdgdsgdsgh"
/>
@@ -464,7 +464,6 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
>
<TeamList
onRemoveCallback={this.addToRemovedTeams}
onAddCallback={this.addToNewTeams}
teamsToRemove={this.state.removedTeams}
teamsToAdd={this.state.newTeams}
policyId={this.props.policyId}
@@ -515,7 +514,6 @@ export default class CustomPolicyForm extends React.PureComponent<Props, State>
>
<ChannelList
onRemoveCallback={this.addToRemovedChannels}
onAddCallback={this.addToNewChannels}
channelsToRemove={this.state.removedChannels}
channelsToAdd={this.state.newChannels}
policyId={this.props.policyId}
@@ -535,7 +535,6 @@ class DataRetentionSettings extends React.PureComponent<Props, State> {
columns={this.getGlobalPolicyColumns()}
rows={this.getGlobalPolicyRows()}
loading={false}
page={0}
nextPage={() => {}}
previousPage={() => {}}
startCount={1}
@@ -573,7 +572,6 @@ class DataRetentionSettings extends React.PureComponent<Props, State> {
columns={this.getCustomPolicyColumns()}
rows={this.getCustomPolicyRows(startCount, endCount)}
loading={this.state.customPoliciesLoading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -29,7 +29,6 @@ exports[`components/admin_console/data_retention_settings/team_list should match
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -110,7 +109,6 @@ exports[`components/admin_console/data_retention_settings/team_list should match
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -27,7 +27,6 @@ describe('components/admin_console/data_retention_settings/team_list', () => {
<TeamList
searchTerm=''
onRemoveCallback={jest.fn()}
onAddCallback={jest.fn()}
teamsToRemove={{}}
teamsToAdd={{}}
teams={testTeams}
@@ -57,7 +56,6 @@ describe('components/admin_console/data_retention_settings/team_list', () => {
<TeamList
searchTerm=''
onRemoveCallback={jest.fn()}
onAddCallback={jest.fn()}
teamsToRemove={{}}
teamsToAdd={{}}
teams={testTeams}
@@ -26,7 +26,6 @@ type Props = {
policyId?: string;
onRemoveCallback: (user: Team) => void;
onAddCallback: (users: Team[]) => void;
teamsToRemove: Record<string, Team>;
teamsToAdd: Record<string, Team>;
@@ -249,7 +248,6 @@ export default class TeamList extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -15,7 +15,6 @@ import {descriptorOrStringToString, renderLabel, renderSettingHelpText} from '..
type Props = {
setting: LDAPDefinitionSettingButton;
saveNeeded: boolean;
onChange(id: string, value: any): void;
disabled: boolean;
ldapSettingsState: LdapSettings;
onFilterTestResults?: (results: TestLdapFiltersResponse) => void;
@@ -221,7 +221,6 @@ const LDAPWizard = (props: Props) => {
return (
<LDAPButtonSetting
key={schema.id + '_button_' + setting.key}
onChange={handleChange}
saveNeeded={false}
schema={schema}
disabled={isDisabled(setting)}
@@ -85,9 +85,7 @@ const EnterpriseEditionRightPanel = ({
const contactSalesBtn = (
<div className='purchase-card'>
<ContactUsButton
eventID='post_trial_contact_sales'
/>
<ContactUsButton/>
</div>
);
@@ -28,7 +28,6 @@ const RenewLicenseCard: React.FC<RenewLicenseCardProps> = ({license, totalUsers,
const contactSalesBtn = (
<div className='purchase-card'>
<ContactUsButton
eventID='post_trial_contact_sales'
customClass='btn-primary'
/>
</div>
@@ -69,7 +69,6 @@ const StarterRightPanel = () => {
</div>
<div className='purchase_buttons'>
<ContactUsButton
eventID='post_trial_contact_sales'
customClass='btn-tertiary btn-full'
/>
</div>
@@ -20,7 +20,6 @@ exports[`admin_console/team_channel_settings/group/GroupList should match snapsh
loading={true}
nextPage={[Function]}
onSearch={[MockFunction]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -539,7 +538,6 @@ exports[`admin_console/team_channel_settings/group/GroupList should match snapsh
loading={true}
nextPage={[Function]}
onSearch={[MockFunction]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -182,7 +182,6 @@ export default class MemberListGroup extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -588,7 +588,6 @@ export default class PermissionTeamSchemeSettings extends React.PureComponent<Pr
modalID={ModalIdentifiers.ADD_TEAMS_TO_SCHEME}
onModalDismissed={this.closeAddTeam}
onTeamsSelected={this.addTeams}
currentSchemeId={this.props.schemeId}
alreadySelected={teams.map((team) => team.id)}
/>
}
@@ -17,8 +17,6 @@ import TeamSelector from '../team_selector';
import {isErrorState, isPendingState, useTeamOptions} from '../utils';
type Props = {
creating?: boolean;
password?: string;
onConfirm: (accept: PartialExcept<RemoteClusterAcceptInvite, 'display_name' | 'default_team_id' | 'invite' | 'password'>) => Promise<RemoteCluster>;
onCancel?: () => void;
onExited: () => void;
@@ -53,7 +53,7 @@ type Params = {
connection_id: 'create' | RemoteCluster['remote_id'];
};
type Props = Params & {
type Props = {
disabled: boolean;
}
@@ -22,7 +22,6 @@ type Props = {
onFiltersChange: (filters: LogFilter) => void;
onSearchChange: (term: string) => void;
search: string;
filters: LogFilter;
};
type State = {
@@ -366,7 +365,6 @@ export default class LogList extends React.PureComponent<Props, State> {
term={search}
placeholderEmpty={placeholderEmpty}
rowsContainerStyles={rowsContainerStyles}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
filterProps={filterProps}
@@ -172,12 +172,6 @@ export default class Logs extends React.PureComponent<Props, State> {
onSearchChange={this.onSearchChange}
search={this.state.search}
onFiltersChange={this.onFiltersChange}
filters={{
dateFrom: this.state.dateFrom,
dateTo: this.state.dateTo,
logLevels: this.state.logLevels,
serverNames: this.state.serverNames,
}}
/>
);
@@ -156,7 +156,6 @@ export function UserPropertiesTable({
value={getValue()}
label={formatMessage({id: 'admin.system_properties.user_properties.table.property_name.input.name', defaultMessage: 'Attribute Name'})}
deleted={toDelete}
borderless={!warning}
testid='property-field-input'
autoFocus={isCreatePending(row.original) && !supportsOptions(row.original)}
setValue={(value: string) => {
@@ -351,7 +350,6 @@ type EditCellProps = {
footer?: ReactNode;
strong?: boolean;
maxLength?: number;
borderless?: boolean;
};
const EditCell = (props: EditCellProps) => {
const [value, setValue] = useState(props.value);
@@ -63,7 +63,6 @@ exports[`admin_console/system_roles should match snapshot 1`] = `
endCount={1}
loading={false}
nextPage={[Function]}
page={1}
previousPage={[Function]}
rows={
Array [
@@ -167,7 +167,6 @@ exports[`admin_console/system_role_users should match snapshot 1`] = `
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -535,7 +534,6 @@ exports[`admin_console/system_role_users should match snapshot with readOnly tru
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
previousPage={[Function]}
rows={
Array [
@@ -236,7 +236,7 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
};
render() {
const {page, loading} = this.state;
const {loading} = this.state;
const {term, role, usersToAdd, usersToRemove, readOnly} = this.props;
const {startCount, endCount, total} = this.getPaginationProps();
return (
@@ -272,7 +272,6 @@ export default class SystemRoleUsers extends React.PureComponent<Props, State> {
columns={this.getColumns()}
nextPage={this.nextPage}
previousPage={this.previousPage}
page={page}
startCount={startCount}
endCount={endCount}
loading={loading}
@@ -103,7 +103,6 @@ const SystemRoles = ({roles}: Props) => {
<DataGrid
rows={rows}
columns={columns}
page={1}
startCount={0}
endCount={rows.length}
loading={false}
@@ -106,7 +106,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id11"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 11 description",
@@ -120,7 +119,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id12"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 12 description",
@@ -134,7 +132,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id13"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 13 description",
@@ -148,7 +145,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id14"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 14 description",
@@ -162,7 +158,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id15"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 15 description",
@@ -176,7 +171,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id16"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 16 description",
@@ -190,7 +184,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id17"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 17 description",
@@ -204,7 +197,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id18"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 18 description",
@@ -218,7 +210,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id19"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 19 description",
@@ -232,7 +223,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id20"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 20 description",
@@ -349,7 +339,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id1"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 1 description",
@@ -363,7 +352,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id2"
onRowClick={[MockFunction]}
team={
Object {
"description": "The 2 description",
@@ -377,7 +365,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id3"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 3 description",
@@ -391,7 +378,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id4"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 4 description",
@@ -405,7 +391,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id5"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 5 description",
@@ -419,7 +404,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id6"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 6 description",
@@ -433,7 +417,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id7"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 7 description",
@@ -447,7 +430,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id8"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 8 description",
@@ -461,7 +443,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id9"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 9 description",
@@ -475,7 +456,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id10"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 10 description",
@@ -592,7 +572,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id1"
onRowClick={[MockFunction]}
team={
Object {
"description": "Team 1 description",
@@ -606,7 +585,6 @@ exports[`admin_console/system_user_detail/team_list/AbstractList should match sn
doMakeUserTeamMember={[MockFunction]}
doRemoveUserFromTeam={[MockFunction]}
key="id2"
onRowClick={[MockFunction]}
team={
Object {
"description": "The 2 description",
@@ -14,7 +14,6 @@ describe('admin_console/system_user_detail/team_list/AbstractList', () => {
<TeamRow
key={item.id}
team={item}
onRowClick={jest.fn()}
doRemoveUserFromTeam={jest.fn()}
doMakeUserTeamAdmin={jest.fn()}
doMakeUserTeamMember={jest.fn()}
@@ -17,7 +17,6 @@ import './team_row.scss';
type Props = {
team: TeamWithMembership;
onRowClick?: () => void;
doRemoveUserFromTeam: (teamId: string) => Promise<void>;
doMakeUserTeamAdmin: (teamId: string) => Promise<void>;
doMakeUserTeamMember: (teamId: string) => Promise<void>;
@@ -140,7 +140,6 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should match sn
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No channels found"
@@ -354,7 +353,6 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should match sn
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No channels found"
@@ -1018,7 +1016,6 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should match sn
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No channels found"
@@ -1236,7 +1233,6 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should render c
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No channels found"
@@ -1450,7 +1446,6 @@ exports[`admin_console/team_channel_settings/channel/ChannelList should render c
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No channels found"
@@ -400,7 +400,6 @@ export default class ChannelList extends React.PureComponent<ChannelListProps, C
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -89,7 +89,6 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemove shou
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -105,111 +104,6 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemove shou
</div>
`;
exports[`components/admin_console/team_channel_settings/group/UsersToRemove should match snapshot searching with filters 1`] = `
<div
className="UsersToRemove"
>
<DataGrid
columns={
Array [
Object {
"field": "name",
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Name"
id="admin.team_channel_settings.user_list.nameHeader"
/>,
"width": 5,
},
Object {
"field": "role",
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Role"
id="admin.team_channel_settings.user_list.roleHeader"
/>,
"width": 2,
},
Object {
"field": "groups",
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Groups"
id="admin.team_channel_settings.user_list.groupsHeader"
/>,
"width": 3,
},
]
}
endCount={2}
filterProps={
Object {
"keys": Array [
"role",
],
"onFilter": [Function],
"options": Object {
"role": Object {
"keys": Array [
"system_guest",
"team_user",
"team_admin",
"system_admin",
],
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Role"
id="admin.user_grid.role"
/>,
"values": Object {
"system_admin": Object {
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="System Admin"
id="admin.user_grid.system_admin"
/>,
"value": false,
},
"system_guest": Object {
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Guest"
id="admin.user_grid.guest"
/>,
"value": false,
},
"team_admin": Object {
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Team Admin"
id="admin.user_grid.team_admin"
/>,
"value": false,
},
"team_user": Object {
"name": <Memo(MemoizedFormattedMessage)
defaultMessage="Member"
id="admin.user_item.member"
/>,
"value": false,
},
},
},
},
}
}
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
id="admin.member_list_group.notFound"
/>
}
previousPage={[Function]}
rows={Array []}
startCount={1}
term="foo"
total={2}
/>
</div>
`;
exports[`components/admin_console/team_channel_settings/group/UsersToRemove should match snapshot with 2 users 1`] = `
<div
className="UsersToRemove"
@@ -299,7 +193,6 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemove shou
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -396,7 +289,6 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemove shou
loading={true}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -70,17 +70,6 @@ describe('components/admin_console/team_channel_settings/group/UsersToRemove', (
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot searching with filters', () => {
const wrapper = shallow(
<UsersToRemove
{...baseProps}
searchTerm={'foo'}
filters={{roles: ['system_user']}}
/>,
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot loading', () => {
const wrapper = shallow(
<UsersToRemove
@@ -40,7 +40,6 @@ export interface Props {
scope: 'team' | 'channel';
scopeId: string;
enableGuestAccounts: boolean;
filters: Filters;
actions: {
loadTeamMembersForProfilesList: (profiles: UserProfile[], teamId: string) => Promise<ActionResult>;
loadChannelMembersForProfilesList: (profiles: UserProfile[], channelId: string) => Promise<ActionResult>;
@@ -345,7 +344,6 @@ export default class UsersToRemove extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -386,7 +386,6 @@ export default class TeamList extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -45,7 +45,6 @@ exports[`components/admin_console/user_grid/UserGrid should match snapshot with
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -419,7 +418,6 @@ exports[`components/admin_console/user_grid/UserGrid should match snapshot with
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -946,7 +944,6 @@ exports[`components/admin_console/user_grid/UserGrid should match snapshot with
loading={false}
nextPage={[Function]}
onSearch={[Function]}
page={0}
placeholderEmpty={
<Memo(MemoizedFormattedMessage)
defaultMessage="No users found"
@@ -292,7 +292,6 @@ export default class UserGrid extends React.PureComponent<Props, State> {
columns={columns}
rows={rows}
loading={this.state.loading || this.props.loading}
page={this.state.page}
nextPage={this.nextPage}
previousPage={this.previousPage}
startCount={startCount}
@@ -819,7 +819,6 @@ const AdvancedTextEditor = ({
useChannelMentions={useChannelMentions}
rootId={rootId}
onWidthChange={handleWidthChange}
isInEditMode={isInEditMode}
/>
{attachmentPreview}
{!isDisabled && (showFormattingBar || showPreview) && (
@@ -3,7 +3,7 @@
import React from 'react';
import type {ClientLicense, ClientConfig, WarnMetricStatus} from '@mattermost/types/config';
import type {ClientLicense, ClientConfig} from '@mattermost/types/config';
import withGetCloudSubscription from 'components/common/hocs/cloud/with_get_cloud_subscription';
@@ -30,7 +30,6 @@ type Props = {
latestError?: {
error: any;
};
warnMetricsStatus?: Record<string, WarnMetricStatus>;
actions: {
dismissError: (index: number) => void;
getCloudSubscription: () => void;
@@ -127,7 +126,6 @@ class AnnouncementBarController extends React.PureComponent<Props> {
config={this.props.config}
license={this.props.license}
canViewSystemErrors={this.props.canViewSystemErrors}
warnMetricsStatus={this.props.warnMetricsStatus}
/>
</>
);
@@ -22,14 +22,8 @@ exports[`components/ConfigurationBar should match snapshot, expired 1`] = `
}
/>
</React.Fragment>
<Memo(Connect(RenewalLink))
<RenewalLink
className="btn btn-tertiary btn-xs btn-inverted annnouncementBar__renewLicense"
telemetryInfo={
Object {
"error": "renew_license_banner_fail",
"success": "renew_license_banner_success",
}
}
/>
</div>
}
@@ -79,14 +73,8 @@ exports[`components/ConfigurationBar should match snapshot, expired, in grace pe
}
/>
</React.Fragment>
<Memo(Connect(RenewalLink))
<RenewalLink
className="btn btn-tertiary btn-xs btn-inverted annnouncementBar__renewLicense"
telemetryInfo={
Object {
"error": "renew_license_banner_fail",
"success": "renew_license_banner_success",
}
}
/>
</div>
}
@@ -7,7 +7,7 @@ import {FormattedMessage, injectIntl} from 'react-intl';
import type {IntlShape} from 'react-intl';
import {Link} from 'react-router-dom';
import type {ClientConfig, WarnMetricStatus} from '@mattermost/types/config';
import type {ClientConfig} from '@mattermost/types/config';
import type {PreferenceType} from '@mattermost/types/preferences';
import type {ActionResult} from 'mattermost-redux/types/actions';
@@ -34,13 +34,8 @@ type Props = {
dismissedExpiringTrialLicense?: boolean;
dismissedExpiringLicense?: boolean;
dismissedExpiredLicense?: boolean;
dismissedNumberOfActiveUsersWarnMetricStatus?: boolean;
dismissedNumberOfActiveUsersWarnMetricStatusAck?: boolean;
dismissedNumberOfPostsWarnMetricStatus?: boolean;
dismissedNumberOfPostsWarnMetricStatusAck?: boolean;
siteURL: string;
currentUserId: string;
warnMetricsStatus?: Record<string, WarnMetricStatus>;
actions: {
dismissNotice: (notice: string) => void;
savePreferences: (userId: string, preferences: PreferenceType[]) => Promise<ActionResult>;
@@ -67,8 +62,6 @@ const ConfigurationAnnouncementBar = (props: Props) => {
props.actions.dismissNotice(AnnouncementBarMessages.TRIAL_LICENSE_EXPIRING);
};
const renewLinkTelemetry = {success: 'renew_license_banner_success', error: 'renew_license_banner_fail'};
// System administrators
if (props.canViewSystemErrors) {
if ((isLicensePastGracePeriod(props.license) || isLicenseExpired(props.license)) && !props.dismissedExpiredLicense) {
@@ -93,7 +86,6 @@ const ConfigurationAnnouncementBar = (props: Props) => {
{message}
<RenewalLink
className='btn btn-tertiary btn-xs btn-inverted annnouncementBar__renewLicense'
telemetryInfo={renewLinkTelemetry}
/>
</div>
}
@@ -199,7 +191,6 @@ const ConfigurationAnnouncementBar = (props: Props) => {
{message}
<RenewalLink
className='btn btn-tertiary btn-xs btn-inverted annnouncementBar__renewLicense'
telemetryInfo={renewLinkTelemetry}
/>
</div>
}
@@ -8,7 +8,6 @@ import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink';
export interface Props {
buttonTextElement?: JSX.Element;
eventID?: string;
customClass?: string;
}
@@ -1,23 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import {openModal} from 'actions/views/modals';
import RenewalLink from './renewal_link';
function mapDispatchToProps(dispatch: Dispatch) {
return {
actions: bindActionCreators(
{
openModal,
},
dispatch,
),
};
}
export default connect(null, mapDispatchToProps)(RenewalLink);
export default RenewalLink;
@@ -58,15 +58,9 @@ describe('components/RenewalLink', () => {
jest.clearAllMocks();
});
const props = {
actions: {
openModal: jest.fn,
},
};
test('should show Contact sales button', async () => {
const store = mockStore(initialState);
const wrapper = mountWithIntl(<Provider store={store}><RenewalLink {...props}/></Provider>);
const wrapper = mountWithIntl(<Provider store={store}><RenewalLink/></Provider>);
// wait for the promise to resolve and component to update
await actImmediate(wrapper);
@@ -6,17 +6,10 @@ import {FormattedMessage} from 'react-intl';
import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink';
import type {ModalData} from 'types/actions';
import './renew_link.scss';
export interface RenewalLinkProps {
telemetryInfo?: { success: string; error: string };
actions: {
openModal: <P>(modalData: ModalData<P>) => void;
};
isDisabled?: boolean;
customBtnText?: JSX.Element;
className?: string;
}
@@ -667,7 +667,6 @@ export class AppsForm extends React.PureComponent<Props, State> {
<>
{header && (
<AppsFormHeader
id='appsModalHeader'
value={header}
/>
)}
@@ -6,7 +6,6 @@ import React from 'react';
import Markdown from 'components/markdown';
type Props = {
id?: string;
value: string;
};
@@ -1,11 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {shallow} from 'enzyme';
import React from 'react';
import AuditTable from 'components/audit_table/audit_table';
import {shallowWithIntl} from 'tests/helpers/intl-test-helper';
import {TestHelper} from 'utils/test_helper';
describe('components/audit_table/AuditTable', () => {
@@ -23,7 +23,7 @@ describe('components/audit_table/AuditTable', () => {
};
test('should match snapshot with no audits', () => {
const wrapper = shallowWithIntl(
const wrapper = shallow(
<AuditTable {...baseProps}/>,
);
@@ -53,7 +53,7 @@ describe('components/audit_table/AuditTable', () => {
];
const props = {...baseProps, audits};
const wrapper = shallowWithIntl(
const wrapper = shallow(
<AuditTable {...props}/>,
);
@@ -2,27 +2,23 @@
// See LICENSE.txt for license information.
import React from 'react';
import {FormattedMessage, injectIntl} from 'react-intl';
import type {IntlShape} from 'react-intl';
import {FormattedMessage} from 'react-intl';
import type {Audit} from '@mattermost/types/audits';
import type {UserProfile} from '@mattermost/types/users';
import FormatAudit from './format_audit';
type Props = {
intl: IntlShape;
audits: Audit[];
showUserId?: boolean;
showIp?: boolean;
showSession?: boolean;
currentUser: UserProfile;
actions: {
getMissingProfilesByIds: (userIds: string[]) => void;
};
};
export class AuditTable extends React.PureComponent<Props> {
export default class AuditTable extends React.PureComponent<Props> {
componentDidMount() {
const ids = this.props.audits.map((audit) => audit.user_id);
this.props.actions.getMissingProfilesByIds(ids);
@@ -103,5 +99,3 @@ export class AuditTable extends React.PureComponent<Props> {
);
}
}
export default injectIntl(AuditTable);
@@ -6,18 +6,9 @@ import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import {getMissingProfilesByIds} from 'mattermost-redux/actions/users';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import type {GlobalState} from 'types/store';
import AuditTable from './audit_table';
function mapStateToProps(state: GlobalState) {
return {
currentUser: getCurrentUser(state),
};
}
function mapDispatchToProps(dispatch: Dispatch) {
return {
actions: bindActionCreators({
@@ -26,4 +17,4 @@ function mapDispatchToProps(dispatch: Dispatch) {
};
}
export default connect(mapStateToProps, mapDispatchToProps)(AuditTable);
export default connect(null, mapDispatchToProps)(AuditTable);
@@ -28,7 +28,6 @@ export interface Props {
ownLimits?: Limits;
backdrop?: boolean;
backdropClassName?: string;
className?: string;
}
export default function CloudUsageModal(props: Props) {
@@ -19,8 +19,6 @@ const urlFormatForDMGMPermalink = '/:teamName/messages/:username/:postid';
const urlFormatForChannelPermalink = '/:teamName/channels/:channelname/:postid';
type Props = {
channelName?: string;
teamName?: string;
post: Post;
commentCount: number;
isRHS: boolean;
@@ -21,7 +21,6 @@ import {
type ConversionOptions,
type ValidationError,
} from 'utils/dialog_conversion';
import type EmojiMap from 'utils/emoji_map';
import type {DoAppCallResult} from 'types/apps';
@@ -46,7 +45,6 @@ interface Props extends WrappedComponentProps {
// Enhanced functionality
sourceUrl?: string; // Optional URL for form refresh functionality
emojiMap?: EmojiMap;
conversionOptions?: Partial<ConversionOptions>;
// Required actions
@@ -21,7 +21,6 @@ type Props = {
onExited: () => void;
userId: string;
currentDate: Date;
locale: string;
timezone?: string;
actions: {
@@ -10,8 +10,6 @@ import {setStatus} from 'mattermost-redux/actions/users';
import {getCurrentTimezone} from 'mattermost-redux/selectors/entities/timezone';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getCurrentLocale} from 'selectors/i18n';
import {makeAsyncComponent} from 'components/async_load';
import type {GlobalState} from 'types/store';
@@ -20,12 +18,10 @@ const DndCustomTimePicker = makeAsyncComponent('DndCustomTimePicker', React.lazy
function mapStateToProps(state: GlobalState) {
const userId = getCurrentUserId(state);
const locale = getCurrentLocale(state);
const timezone = getCurrentTimezone(state);
return {
userId,
locale,
timezone,
};
}
@@ -155,7 +155,6 @@ type Props = {
canDelete: boolean;
userId: string;
threadId: UserThread['id'];
isCollapsedThreadsEnabled: boolean;
isFollowingThread?: boolean;
isMentionedInRootPost?: boolean;
threadReplyCount?: number;
@@ -123,7 +123,6 @@ function makeMapStateToProps() {
threadId,
isFollowingThread,
isMentionedInRootPost,
isCollapsedThreadsEnabled: collapsedThreads,
threadReplyCount,
isMobileView: getIsMobileView(state),
timezone: getCurrentTimezone(state),
@@ -60,8 +60,6 @@ type Props = {
isRemote?: boolean;
scrollIntoView?: boolean;
containerClassName?: string;
dataTestId?: string;
dataPostId?: string;
}
const mockLastBlurAt = {current: 0};
@@ -50,11 +50,6 @@ export type Props = {
pluginFilePreviewComponents: FilePreviewComponent[];
onExited: () => void;
/**
* The id of the post the files are attached to
*/
postId?: string;
/**
* The post the files are attached to
* Either postId or post can be passed to FilePreviewModal
@@ -12,8 +12,6 @@ import './no_permissions_view.scss';
type Props = {
footerClass: string;
onDone: () => void;
title?: string;
description?: string;
}
export default function NoPermissionsView(props: Props) {
@@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useCallback, useMemo, useState} from 'react';
import React, {useCallback, useMemo} from 'react';
import {useIntl} from 'react-intl';
import {useSelector, useDispatch} from 'react-redux';
@@ -34,17 +34,12 @@ const LearnMoreTrialModal = (
onExited,
}: Props): JSX.Element | null => {
const {formatMessage} = useIntl();
const [embargoed, setEmbargoed] = useState(false);
const dispatch = useDispatch();
// Cloud conditions
const license = useSelector(getLicense);
const isCloud = license?.Cloud === 'true';
const handleEmbargoError = useCallback(() => {
setEmbargoed(true);
}, []);
// close this modal once start trial btn is clicked and trial has started successfully
const dismissAction = useCallback(() => {
dispatch(closeModal(ModalIdentifiers.LEARN_MORE_TRIAL_MODAL));
@@ -52,7 +47,6 @@ const LearnMoreTrialModal = (
const startTrialBtn = (
<StartTrialBtn
handleEmbargoError={handleEmbargoError}
onClick={dismissAction}
/>
);
@@ -143,7 +137,6 @@ const LearnMoreTrialModal = (
dataSlides={getSlides}
id={'learnMoreTrialModalCarousel'}
infiniteSlide={false}
disableNextButton={embargoed}
btnsStyle={BtnStyle.CHEVRON}
actionButton={startTrialBtn}
/>
@@ -10,7 +10,6 @@ import './start_trial_btn.scss';
export type StartTrialBtnProps = {
onClick?: () => void;
handleEmbargoError?: () => void;
btnClass?: string;
renderAsButton?: boolean;
disabled?: boolean;
@@ -35,17 +35,7 @@ type Props = {
};
}
type State = {
enforceMultifactorAuthentication: boolean;
}
export default class MFAController extends React.PureComponent<Props & RouteComponentProps, State> {
public constructor(props: Props & RouteComponentProps) {
super(props);
this.state = {enforceMultifactorAuthentication: props.enableMultifactorAuthentication};
}
export default class MFAController extends React.PureComponent<Props & RouteComponentProps> {
public componentDidMount(): void {
document.body.classList.add('sticky');
document.getElementById('root')!.classList.add('container-fluid');
@@ -65,10 +55,6 @@ export default class MFAController extends React.PureComponent<Props & RouteComp
emitUserLoggedOutEvent('/login');
};
public updateParent = (state: State): void => {
this.setState(state);
};
public render(): JSX.Element {
let backButton;
if (this.props.mfa && this.props.enforceMultifactorAuthentication) {
@@ -114,8 +100,6 @@ export default class MFAController extends React.PureComponent<Props & RouteComp
path={`${this.props.match.url}/setup`}
render={(props) => (
<Setup
state={this.state}
updateParent={this.updateParent}
{...props}
/>
)}
@@ -8,22 +8,7 @@ import type {UserProfile} from '@mattermost/types/users';
import LocalizedPlaceholderInput from 'components/localized_placeholder_input';
type MFAControllerState = {
enforceMultifactorAuthentication: boolean;
};
type Props = {
/*
* Object containing enforceMultifactorAuthentication
*/
state: MFAControllerState;
/*
* Function that updates parent component with state props
*/
updateParent: (state: MFAControllerState) => void;
currentUser: UserProfile;
siteName?: string;
enforceMultifactorAuthentication: boolean;
@@ -161,8 +161,7 @@ exports[`components/multiselect/multiselect MultiSelectList should match snapsho
},
]
}
page={0}
perPage={5}
perPage={50}
query=""
/>
<div
@@ -338,8 +337,7 @@ exports[`components/multiselect/multiselect should match snapshot 1`] = `
},
]
}
page={0}
perPage={5}
perPage={50}
query=""
/>
<div
@@ -505,8 +503,7 @@ exports[`components/multiselect/multiselect should match snapshot for page 2 1`]
},
]
}
page={1}
perPage={5}
perPage={50}
query=""
/>
<div
@@ -444,9 +444,6 @@ export class MultiSelect<T extends Value> extends React.PureComponent<Props<T>,
options={optionsToDisplay}
optionRenderer={this.props.optionRenderer}
ariaLabelRenderer={this.props.ariaLabelRenderer}
page={this.state.page}
perPage={this.props.perPage}
onPageChange={this.props.handlePageChange}
onAdd={this.onAdd}
onSelect={this.onSelect}
loading={this.props.loading}
@@ -463,9 +460,6 @@ export class MultiSelect<T extends Value> extends React.PureComponent<Props<T>,
options={optionsToDisplay}
optionRenderer={this.props.optionRenderer}
ariaLabelRenderer={this.props.ariaLabelRenderer}
page={this.state.page}
perPage={this.props.perPage}
onPageChange={this.props.handlePageChange}
onAdd={this.onAdd}
onSelect={this.onSelect}
loading={this.props.loading}
@@ -31,13 +31,10 @@ describe('components/multiselect/multiselect', () => {
ariaLabelRenderer: element as any,
loading: false,
onAdd: jest.fn(),
onPageChange: jest.fn(),
onSelect: jest.fn(),
optionRenderer: element,
selectedItemRef,
options: users,
perPage: 5,
page: 1,
};
test('MultiSelectList should have selected item scrollIntoView to align at bottom of list', () => {
@@ -16,7 +16,6 @@ export type Props<T extends Value> = {
ariaLabelRenderer: GetOptionValue<T>;
loading?: boolean;
onAdd: (value: T) => void;
onPageChange?: (newPage: number, currentPage: number) => void;
onSelect: (value: T | null) => void;
optionRenderer: (
option: T,
@@ -27,8 +26,6 @@ export type Props<T extends Value> = {
query?: string;
selectedItemRef?: React.RefObject<HTMLDivElement>;
options: T[];
page: number;
perPage: number;
customNoOptionsMessage?: React.ReactNode;
}
@@ -8,7 +8,6 @@ import {CompletedAnimation} from './onboarding_tasklist_animations';
export interface TaskProps {
label: React.ReactElement;
icon?: React.ReactNode;
onClick?: () => void;
completedStatus: boolean;
}
@@ -33,7 +33,6 @@ type Props = {
enableEmojiPicker?: boolean;
isReadOnly?: boolean;
channelIsArchived?: boolean;
channelIsShared?: boolean;
handleCommentClick?: (e: React.MouseEvent) => void;
handleJumpClick?: (e: React.MouseEvent) => void;
handleDropdownOpened?: (e: boolean) => void;
@@ -8,8 +8,6 @@ import {getFeatureFlagValue} from 'mattermost-redux/selectors/entities/general';
import {getTheme, getBool} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
import {getIsRhsExpanded, getIsRhsOpen} from 'selectors/rhs';
import type {GlobalState} from 'types/store';
import PostMessageView from './post_message_view';
@@ -17,8 +15,6 @@ import PostMessageView from './post_message_view';
function mapStateToProps(state: GlobalState) {
return {
enableFormatting: getBool(state, Preferences.CATEGORY_ADVANCED_SETTINGS, 'formatting', true),
isRHSExpanded: getIsRhsExpanded(state),
isRHSOpen: getIsRhsOpen(state),
pluginPostTypes: state.plugins.postTypes,
theme: getTheme(state),
currentRelativeTeamUrl: getCurrentRelativeTeamUrl(state),
@@ -35,8 +35,6 @@ type Props = {
options?: TextFormattingOptions; /* Options specific to text formatting */
compactDisplay?: boolean; /* Set to render post body compactly */
isRHS?: boolean; /* Flags if the post_message_view is for the RHS (Reply). */
isRHSOpen?: boolean; /* Whether or not the RHS is visible */
isRHSExpanded?: boolean; /* Whether or not the RHS is expanded */
theme: Theme; /* Logged in user's theme */
pluginPostTypes?: {
[postType: string]: PostPluginComponent;
@@ -11,17 +11,12 @@ import {getEmojiName} from 'mattermost-redux/utils/emoji_utils';
import ChannelPermissionGate from 'components/permissions_gates/channel_permission_gate';
import WithTooltip from 'components/with_tooltip';
import {Locations} from 'utils/constants';
import EmojiItem from './recent_reactions_emoji_item';
type LocationTypes = 'CENTER' | 'RHS_ROOT' | 'RHS_COMMENT';
type Props = {
channelId?: string;
postId: string;
teamId: string;
location?: LocationTypes;
locale: string;
emojis: Emoji[];
size: number;
@@ -31,13 +26,8 @@ type Props = {
};
}
type State = {
location: LocationTypes;
}
export default class PostRecentReactions extends React.PureComponent<Props, State> {
export default class PostRecentReactions extends React.PureComponent<Props> {
public static defaultProps: Partial<Props> = {
location: Locations.CENTER as 'CENTER',
size: 3,
};
@@ -7,11 +7,7 @@ import './single_column_layout.scss';
type Props = {
children: React.ReactNode | React.ReactNodeArray;
beforePath?: boolean;
afterPath?: boolean;
style?: React.CSSProperties;
lineDistance?: number;
lineLeft?: number;
};
export default function SingleColumnLayout(props: Props) {
@@ -32,7 +32,6 @@ describe('UserPropertyRenderer', () => {
},
profilesInChannel: {},
profilesNotInChannel: {},
profilesWithoutTeam: new Set(),
profilesInTeam: {},
profilesNotInTeam: {},
statuses: {},
@@ -13,11 +13,6 @@ import {getCurrentUserId, getCurrentUserMentionKeys} from 'mattermost-redux/sele
import {
setRhsExpanded,
showMentions,
showSearchResults,
showFlaggedPosts,
showPinnedPosts,
showChannelFiles,
closeRightHandSide,
toggleRhsExpanded,
goBack,
@@ -72,11 +67,6 @@ function makeMapStateToProps() {
const actions = {
setRhsExpanded,
showSearchResults,
showMentions,
showFlaggedPosts,
showPinnedPosts,
showChannelFiles,
closeRightHandSide,
toggleRhsExpanded,
setThreadFollow,
@@ -33,10 +33,6 @@ type Props = WrappedComponentProps & {
currentTeam?: Team;
currentUserId: string;
setRhsExpanded: (b: boolean) => void;
showMentions: () => void;
showSearchResults: () => void;
showFlaggedPosts: () => void;
showPinnedPosts: () => void;
goBack: () => void;
closeRightHandSide: (e?: React.MouseEvent) => void;
toggleRhsExpanded: (e: React.MouseEvent) => void;
@@ -22,10 +22,10 @@ import {checkIsFirstAdmin, getCurrentUser, isCurrentUserSystemAdmin} from 'matte
import {redirectUserToDefaultTeam, emitUserLoggedOutEvent} from 'actions/global_actions';
import {reloadPage} from 'utils/browser_utils';
import {ActionTypes, StoragePrefixes} from 'utils/constants';
import {StoragePrefixes} from 'utils/constants';
import {doesCookieContainsMMUserId} from 'utils/utils';
import type {ActionFuncAsync, ThunkActionFunc} from 'types/store';
import type {ThunkActionFunc} from 'types/store';
import type {Translations} from 'types/store/i18n';
export type TranslationPluginFunction = (locale: string) => Translations
@@ -84,22 +84,6 @@ export function loadConfigAndMe(): ThunkActionFunc<Promise<{isLoaded: boolean; i
};
}
export function registerCustomPostRenderer(type: string, component: any, id: string): ActionFuncAsync {
return async (dispatch) => {
// piggyback on plugins state to register a custom post renderer
dispatch({
type: ActionTypes.RECEIVED_PLUGIN_POST_COMPONENT,
data: {
postTypeId: id,
pluginId: id,
type,
component,
},
});
return {data: true};
};
}
export function redirectToOnboardingOrDefaultTeam(history: History, searchParams?: URLSearchParams): ThunkActionFunc<void> {
return async (dispatch, getState) => {
const state = getState();
@@ -8,8 +8,6 @@ import {withRouter} from 'react-router-dom';
import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import {getFirstAdminSetupComplete} from 'mattermost-redux/actions/general';
import {getProfiles} from 'mattermost-redux/actions/users';
import {isCurrentLicenseCloud} from 'mattermost-redux/selectors/entities/cloud';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getTeam} from 'mattermost-redux/selectors/entities/teams';
@@ -32,7 +30,6 @@ import type {GlobalState} from 'types/store/index';
import {
loadConfigAndMe,
registerCustomPostRenderer,
handleLoginLogoutSignal,
redirectToOnboardingOrDefaultTeam,
} from './actions';
@@ -79,11 +76,8 @@ function mapDispatchToProps(dispatch: Dispatch) {
return {
actions: bindActionCreators({
loadConfigAndMe,
getFirstAdminSetupComplete,
getProfiles,
loadRecentlyUsedCustomEmojis,
migrateRecentEmojis,
registerCustomPostRenderer,
initializeProducts,
handleLoginLogoutSignal,
redirectToOnboardingOrDefaultTeam,
@@ -36,10 +36,7 @@ jest.mock('actions/global_actions', () => ({
}));
jest.mock('mattermost-redux/actions/general', () => ({
getFirstAdminSetupComplete: jest.fn(() => Promise.resolve({
type: 'FIRST_ADMIN_COMPLETE_SETUP_RECEIVED',
data: true,
})),
...jest.requireActual('mattermost-redux/actions/general'),
setUrl: () => {},
}));
@@ -73,11 +70,8 @@ describe('components/Root', () => {
isMeRequested: false,
});
}),
getFirstAdminSetupComplete: jest.fn(),
getProfiles: jest.fn(),
loadRecentlyUsedCustomEmojis: jest.fn(),
migrateRecentEmojis: jest.fn(),
registerCustomPostRenderer: jest.fn(),
initializeProducts: jest.fn(),
...bindActionCreators({
handleLoginLogoutSignal,
@@ -29,7 +29,6 @@ type Props = {
onFileChange?: (e: ChangeEvent<HTMLInputElement>) => void;
updateSection?: (e: MouseEvent<HTMLButtonElement>) => void;
imageContext?: string;
maxFileSize?: number;
helpText?: ReactNode;
}
@@ -11,18 +11,15 @@ import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {toggleEmbedVisibility} from 'actions/post_actions';
import {openModal} from 'actions/views/modals';
import {getIsRhsOpen} from 'selectors/rhs';
import SingleImageView from 'components/single_image_view/single_image_view';
import type {GlobalState} from 'types/store';
function mapStateToProps(state: GlobalState) {
const isRhsOpen = getIsRhsOpen(state);
const config = getConfig(state);
return {
isRhsOpen,
enablePublicLink: config.EnablePublicLink === 'true',
};
}
@@ -25,7 +25,6 @@ const DISPROPORTIONATE_HEIGHT_RATIO = 20;
export interface Props extends PropsFromRedux {
postId: string;
fileInfo: FileInfo;
isRhsOpen: boolean;
enablePublicLink: boolean;
compactDisplay?: boolean;
isEmbedVisible?: boolean;
@@ -15,7 +15,6 @@ import {ModalIdentifiers} from 'utils/constants';
type Props = {
onTryAgain?: () => void;
title?: JSX.Element;
subtitle?: JSX.Element;
buttonText?: JSX.Element;
}
@@ -24,7 +24,7 @@ import CountrySelector from 'components/payment_form/country_selector';
import Input, {SIZE} from 'components/widgets/inputs/input/input';
import type {CustomMessageInputType} from 'components/widgets/inputs/input/input';
import {AboutLinks, LicenseLinks, ModalIdentifiers} from 'utils/constants';
import {AboutLinks, ModalIdentifiers} from 'utils/constants';
import type {GlobalState} from 'types/store';
@@ -159,28 +159,11 @@ function StartTrialFormModal(props: Props): JSX.Element | null {
if (error) {
setLoadStatus(TrialLoadStatus.Failed);
let title;
let subtitle;
let buttonText;
let onTryAgain = handleErrorModalTryAgain;
if ((data as any).status === 422) {
title = (<></>);
subtitle = (
<FormattedMessage
id='admin.license.trial-request.embargoed'
defaultMessage='We were unable to process the request due to limitations for embargoed countries. <link>Learn more in our documentation</link>, or reach out to legal@mattermost.com for questions around export limitations.'
values={{
link: (text) => (
<ExternalLink
location='trial_banner'
href={LicenseLinks.EMBARGOED_COUNTRIES}
>
{text}
</ExternalLink>
),
}}
/>
);
buttonText = (
<FormattedMessage
id='admin.license.trial-request.embargoed.button'
@@ -195,7 +178,6 @@ function StartTrialFormModal(props: Props): JSX.Element | null {
dialogProps: {
onTryAgain,
title,
subtitle,
buttonText,
},
}));
@@ -12,7 +12,6 @@ import type {Props} from './team_selector_modal';
describe('components/TeamSelectorModal', () => {
const defaultProps: Props = {
currentSchemeId: 'xxx',
alreadySelected: ['id1'],
intl: {} as IntlShape,
searchTerm: '',
@@ -23,7 +23,6 @@ const TEAMS_PER_PAGE = 50;
type TeamValue = (Team & Value);
export type Props = {
currentSchemeId?: string;
alreadySelected?: string[];
intl: IntlShape;
excludeGroupConstrained?: boolean;
@@ -37,7 +36,6 @@ export type Props = {
setModalSearchTerm: (searchTerm: string) => void;
searchTeams: (searchTerm: string) => void;
};
data?: any;
excludePolicyConstrained?: boolean;
};
@@ -53,7 +51,6 @@ type State = {
export class TeamSelectorModal extends React.PureComponent<Props, State> {
private searchTimeoutId?: number;
private selectedItemRef?: React.RefObject<HTMLDivElement> | undefined;
private currentSchemeId?: string;
constructor(props: Props) {
super(props);
@@ -253,7 +250,6 @@ export class TeamSelectorModal extends React.PureComponent<Props, State> {
let teams = [] as Team[];
if (this.props.teams) {
teams = this.props.teams.filter((team) => team.delete_at === 0);
teams = teams.filter((team) => team.scheme_id !== this.currentSchemeId);
teams = this.props.excludeGroupConstrained ? teams.filter((team) => !team.group_constrained) : teams;
if (this.props.alreadySelected) {
teams = teams.filter((team) => this.props.alreadySelected?.indexOf(team.id) === -1);
@@ -71,7 +71,6 @@ export type Props = {
priorityProfiles?: UserProfile[];
hasLabels?: boolean;
hasError?: boolean;
isInEditMode?: boolean;
};
const VISIBLE = {visibility: 'visible'};
@@ -12,13 +12,11 @@ import {Locations} from 'utils/constants';
type Props = {
a11yIndex: number;
currentUserId: string;
isLastPost: boolean;
onCardClick: (post: Post) => void;
post: Post;
previousPostId: string;
timestampProps?: Partial<TimestampProps>;
id?: Post['id'];
}
function Reply({

Some files were not shown because too many files have changed in this diff Show More