Unverified Commit 2980bb26 authored by Saturnino Abril's avatar Saturnino Abril Committed by GitHub
Browse files

[MM-10430] Fix behavior of ExperimentalTownSquareIsReadOnly and add...


[MM-10430] Fix behavior of ExperimentalTownSquareIsReadOnly and add ExperimentalHideTownSquareinLHS feature (#1194)

* fix behaviour of ExperimentalTownSquareIsReadOnly and add ExperimentalHideTownSquareinLHS feature

* pull out "hiddenDefaultChannelId" store and move to mattermost-redux to make it accessible to mobile RN as well

* updated
Signed-off-by: default avatarSaturnino Abril <saturnino.abril@gmail.com>

* updated channel's name check
Signed-off-by: default avatarSaturnino Abril <saturnino.abril@gmail.com>

* updated redux with related merged commit 1cc6009
Signed-off-by: default avatarSaturnino Abril <saturnino.abril@gmail.com>
parent c9d8840d
......@@ -7,7 +7,11 @@ import {bindActionCreators} from 'redux';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {leaveChannel} from 'mattermost-redux/actions/channels';
import {getChannelsNameMapInCurrentTeam, makeGetChannel, isChannelReadOnly} from 'mattermost-redux/selectors/entities/channels';
import {
getChannelsNameMapInCurrentTeam,
makeGetChannel,
shouldHideDefaultChannel,
} from 'mattermost-redux/selectors/entities/channels';
import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common';
import {getUserIdsInChannels, getUser} from 'mattermost-redux/selectors/entities/users';
import {getInt, getTeammateNameDisplaySetting} from 'mattermost-redux/selectors/entities/preferences';
......@@ -78,8 +82,15 @@ function makeMapStateToProps() {
channelDisplayName = displayUsername(teammate, teammateNameDisplay);
}
const shouldHideChannel = isChannelReadOnly(state, channel) && !ownProps.active &&
!isFavoriteChannel(state.entities.preferences.myPreferences, channel.id);
let shouldHideChannel = false;
if (
channel.name === Constants.DEFAULT_CHANNEL &&
!ownProps.active &&
shouldHideDefaultChannel(state, channel) &&
!isFavoriteChannel(state.entities.preferences.myPreferences, channel.id)
) {
shouldHideChannel = true;
}
return {
config,
......
......@@ -10868,18 +10868,18 @@
"dev": true
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#238f9472caea3f11be066374f326f398978504c5",
"from": "mattermost-redux@github:mattermost/mattermost-redux#238f9472caea3f11be066374f326f398978504c5",
"version": "github:mattermost/mattermost-redux#1cc600992b9560a4d41cc622352cf440ae905ab1",
"from": "mattermost-redux@github:mattermost/mattermost-redux#1cc600992b9560a4d41cc622352cf440ae905ab1",
"requires": {
"deep-equal": "1.0.1",
"eslint-plugin-header": "1.2.0",
"form-data": "2.3.1",
"harmony-reflect": "1.5.1",
"form-data": "2.3.2",
"harmony-reflect": "1.6.0",
"isomorphic-fetch": "2.2.1",
"mime-db": "1.30.0",
"redux": "3.7.2",
"redux-action-buffer": "1.1.0",
"redux-batched-actions": "0.2.0",
"mime-db": "1.33.0",
"redux": "4.0.0",
"redux-action-buffer": "1.2.0",
"redux-batched-actions": "0.3.0",
"redux-offline": "git+https://github.com/enahum/redux-offline.git#4bd85e7e3b279a2b11fb4d587808d583d2b5e7b5",
"redux-persist": "4.9.1",
"redux-thunk": "2.2.0",
......
......@@ -22,6 +22,8 @@ exports[`component/sidebar/sidebar_channel/SidebarChannel should match snapshot,
</li>
`;
exports[`component/sidebar/sidebar_channel/SidebarChannel should match snapshot, on channel hide 1`] = `""`;
exports[`component/sidebar/sidebar_channel/SidebarChannel should match snapshot, on channel show 1`] = `
<li
className=""
......
......@@ -82,6 +82,14 @@ describe('component/sidebar/sidebar_channel/SidebarChannel', () => {
expect(props.actions.openLhs).not.toBeCalled();
});
test('should match snapshot, on channel hide', () => {
const props = {...defaultProps, shouldHideChannel: true};
const wrapper = shallow(
<SidebarChannel {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, on fake channel show', () => {
const channel = {
display_name: 'Channel display name',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment