rename more_channels to browse_channels

This commit is contained in:
Sinan Sonmez (Chaush)
2023-06-28 20:26:55 +00:00
parent 0aa9705592
commit bcb05eb5e6
7 changed files with 41 additions and 42 deletions
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`components/MoreChannels should match snapshot and state 1`] = `
exports[`components/BrowseChannels should match snapshot and state 1`] = `
<GenericModal
aria-labelledby="moreChannelsModalLabel"
aria-labelledby="browseChannelsModalLabel"
aria-modal={true}
autoCloseOnCancelButton={true}
autoCloseOnConfirmButton={false}
@@ -32,7 +32,7 @@ exports[`components/MoreChannels should match snapshot and state 1`] = `
</button>
</Memo(Connect(TeamPermissionGate))>
}
id="moreChannelsModal"
id="browseChannelsModal"
keyboardEscape={true}
modalHeaderText={
<Memo(MemoizedFormattedMessage)
@@ -1,6 +1,6 @@
@charset 'UTF-8';
#moreChannelsModal {
#browseChannelsModal {
.modal-content {
min-height: 600px;
max-height: calc(50vh - 240px);
@@ -7,7 +7,7 @@ import {shallow} from 'enzyme';
import {ActionResult} from 'mattermost-redux/types/actions';
import {Channel} from '@mattermost/types/channels';
import MoreChannels, {Props} from 'components/more_channels/more_channels';
import BrowseChannels, {Props} from 'components/browse_channels/browse_channels';
import SearchableChannelList from 'components/searchable_channel_list';
import {getHistory} from 'utils/browser_history';
@@ -15,7 +15,7 @@ import {TestHelper} from 'utils/test_helper';
jest.useFakeTimers('legacy');
describe('components/MoreChannels', () => {
describe('components/BrowseChannels', () => {
const searchResults = {
data: [{
id: 'channel-id-1',
@@ -106,8 +106,8 @@ describe('components/MoreChannels', () => {
};
test('should match snapshot and state', () => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
expect(wrapper).toMatchSnapshot();
@@ -123,8 +123,8 @@ describe('components/MoreChannels', () => {
});
test('should call closeModal on handleExit', () => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().handleExit();
@@ -132,8 +132,8 @@ describe('components/MoreChannels', () => {
});
test('should match state on onChange', () => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.setState({searchedChannels: [TestHelper.getChannelMock({id: 'other_channel_id'})]});
@@ -147,8 +147,8 @@ describe('components/MoreChannels', () => {
});
test('should call props.getChannels on nextPage', () => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().nextPage(1);
@@ -159,7 +159,7 @@ describe('components/MoreChannels', () => {
test('should have loading prop true when searching state is true', () => {
const wrapper = shallow(
<MoreChannels {...baseProps}/>,
<BrowseChannels {...baseProps} />,
);
wrapper.setState({search: true, searching: true});
@@ -182,8 +182,8 @@ describe('components/MoreChannels', () => {
},
};
const wrapper = shallow<MoreChannels>(
<MoreChannels {...props}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...props} />,
);
const callback = jest.fn();
@@ -210,8 +210,8 @@ describe('components/MoreChannels', () => {
},
};
const wrapper = shallow<MoreChannels>(
<MoreChannels {...props}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...props} />,
);
const callback = jest.fn();
@@ -226,8 +226,8 @@ describe('components/MoreChannels', () => {
});
test('should not perform a search if term is empty', () => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().onChange = jest.fn();
@@ -241,8 +241,8 @@ describe('components/MoreChannels', () => {
});
test('should handle a failed search', (done) => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().onChange = jest.fn();
@@ -269,8 +269,8 @@ describe('components/MoreChannels', () => {
});
test('should perform search and set the correct state', (done) => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().onChange = jest.fn();
@@ -295,8 +295,8 @@ describe('components/MoreChannels', () => {
});
test('should perform search on archived channels and set the correct state', (done) => {
const wrapper = shallow<MoreChannels>(
<MoreChannels {...baseProps}/>,
const wrapper = shallow<BrowseChannels>(
<BrowseChannels {...baseProps} />,
);
wrapper.instance().onChange = jest.fn();
@@ -24,7 +24,7 @@ import classNames from 'classnames';
import {localizeMessage} from 'utils/utils';
import LoadingScreen from 'components/loading_screen';
import './more_channels.scss';
import './browse_channels.scss';
const CHANNELS_CHUNK_SIZE = 50;
const CHANNELS_PER_PAGE = 50;
@@ -46,7 +46,6 @@ type Actions = {
getChannelsMemberCount: (channelIds: string[]) => Promise<ActionResult>;
}
// todo sinan rename based on feedback on previous email
export type Props = {
channels: Channel[];
archivedChannels: Channel[];
@@ -74,7 +73,7 @@ type State = {
searchTerm: string;
}
export default class MoreChannels extends React.PureComponent<Props, State> {
export default class BrowseChannels extends React.PureComponent<Props, State> {
public searchTimeoutId: number;
activeChannels: Channel[] = [];
@@ -338,8 +337,8 @@ export default class MoreChannels extends React.PureComponent<Props, State> {
return (
<GenericModal
onExited={this.handleExit}
id='moreChannelsModal'
aria-labelledby='moreChannelsModalLabel'
id='browseChannelsModal'
aria-labelledby='browseChannelsModalLabel'
compassDesign={true}
modalHeaderText={title}
headerButton={createNewChannelButton('outlineButton')}
@@ -23,7 +23,7 @@ import {getIsRhsOpen, getRhsState} from 'selectors/rhs';
import {ModalData} from 'types/actions';
import {GlobalState} from 'types/store';
import MoreChannels from './more_channels';
import BrowseChannels from './browse_channels';
import {makeGetGlobalItem} from 'selectors/storage';
import Constants, {StoragePrefixes} from 'utils/constants';
import {setGlobalItem} from 'actions/storage';
@@ -88,4 +88,4 @@ function mapDispatchToProps(dispatch: Dispatch) {
};
}
export default connect(mapStateToProps, mapDispatchToProps)(MoreChannels);
export default connect(mapStateToProps, mapDispatchToProps)(BrowseChannels);
@@ -9,7 +9,7 @@ import {useSelector, useDispatch} from 'react-redux';
import MenuWrapper from 'components/widgets/menu/menu_wrapper';
import Menu from 'components/widgets/menu/menu';
import MoreChannels from 'components/more_channels';
import BrowseChannels from 'components/browse_channels';
import NewChannelModal from 'components/new_channel_modal/new_channel_modal';
import {isAddChannelCtaDropdownOpen} from 'selectors/views/add_channel_dropdown';
@@ -59,7 +59,7 @@ const AddChannelsCtaButton = (): JSX.Element | null => {
const showMoreChannelsModal = () => {
dispatch(openModal({
modalId: ModalIdentifiers.MORE_CHANNELS,
dialogType: MoreChannels,
dialogType: BrowseChannels,
dialogProps: {morePublicChannelsModalType: 'public'},
}));
trackEvent('ui', 'browse_channels_button_is_clicked');
@@ -8,7 +8,7 @@ import {trackEvent} from 'actions/telemetry_actions';
import EditCategoryModal from 'components/edit_category_modal';
import MoreDirectChannels from 'components/more_direct_channels';
import DataPrefetch from 'components/data_prefetch';
import MoreChannels from 'components/more_channels';
import BrowseChannels from 'components/browse_channels';
import NewChannelModal from 'components/new_channel_modal/new_channel_modal';
import InvitationModal from 'components/invitation_modal';
import UserSettingsModal from 'components/user_settings/modal';
@@ -155,7 +155,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
showMoreChannelsModal = () => {
this.props.actions.openModal({
modalId: ModalIdentifiers.MORE_CHANNELS,
dialogType: MoreChannels,
dialogType: BrowseChannels,
dialogProps: {morePublicChannelsModalType: 'public'},
});
trackEvent('ui', 'ui_channels_more_public_v2');
@@ -230,7 +230,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
render() {
if (!this.props.teamId) {
return (<div/>);
return (<div />);
}
const ariaLabel = Utils.localizeMessage('accessibility.sections.lhsNavigator', 'channel navigator region');
@@ -243,7 +243,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
dragging: this.state.isDragging,
})}
>
{this.props.isMobileView ? <MobileSidebarHeader/> : (
{this.props.isMobileView ? <MobileSidebarHeader /> : (
<SidebarHeader
showNewChannelModal={this.showNewChannelModal}
showMoreChannelsModal={this.showMoreChannelsModal}
@@ -279,14 +279,14 @@ export default class Sidebar extends React.PureComponent<Props, State> {
/>
</div>
<div className='sidebar--left__icons'>
<Pluggable pluggableName='LeftSidebarHeader'/>
<Pluggable pluggableName='LeftSidebarHeader' />
</div>
<SidebarList
handleOpenMoreDirectChannelsModal={this.handleOpenMoreDirectChannelsModal}
onDragStart={this.onDragStart}
onDragEnd={this.onDragEnd}
/>
<DataPrefetch/>
<DataPrefetch />
{this.renderModals()}
</div>
);