MM-22975 Fix archive handle when server does not allow view archive channel (#4019)

* MM-22975 Fix archive handle when server does not allow vieweing an archive channel

* Update mm-redux ref
This commit is contained in:
Elias Nahum 2020-03-09 17:06:02 -03:00
parent 22a51acb50
commit ebb20591c0
No known key found for this signature in database
GPG key ID: E038DB71E0B61702
4 changed files with 26 additions and 16 deletions

View file

@ -26,6 +26,7 @@ import Config from 'assets/config';
import FilteredList from './filtered_list';
const DEFAULT_SEARCH_ORDER = ['unreads', 'dms', 'channels', 'members', 'nonmembers', 'archived'];
const emptyArray = [];
const pastDirectMessages = createSelector(
getDirectShowPreferences,
@ -98,15 +99,17 @@ const getGroupChannelMemberDetails = createSelector(
function mapStateToProps(state) {
const {currentUserId} = state.entities.users;
const config = getConfig(state);
const profiles = getUsers(state);
let teamProfiles = {};
const restrictDms = getConfig(state).RestrictDirectMessage !== General.RESTRICT_DIRECT_MESSAGE_ANY;
const restrictDms = config.RestrictDirectMessage !== General.RESTRICT_DIRECT_MESSAGE_ANY;
if (restrictDms) {
teamProfiles = getTeamProfiles(state);
}
const searchOrder = Config.DrawerSearchOrder ? Config.DrawerSearchOrder : DEFAULT_SEARCH_ORDER;
const viewArchivedChannels = config.ExperimentalViewArchivedChannels === 'true';
return {
channels: getChannelsWithUnreadSection(state),
@ -114,7 +117,7 @@ function mapStateToProps(state) {
currentTeam: getCurrentTeam(state),
currentUserId,
otherChannels: getOtherChannels(state, false),
archivedChannels: getArchivedChannels(state),
archivedChannels: viewArchivedChannels ? getArchivedChannels(state) : emptyArray,
groupChannelMemberDetails: getGroupChannelMemberDetails(state),
profiles,
teamProfiles,

View file

@ -322,6 +322,13 @@ function lastChannelViewTime(state = {}, action) {
function keepChannelIdAsUnread(state = null, action) {
switch (action.type) {
case ChannelTypes.SELECT_CHANNEL: {
if (!action.extra && action.data) {
return {
id: action.data,
hadMentions: false,
};
}
const {channel, member} = action.extra;
if (!member || !channel) {

24
package-lock.json generated
View file

@ -2938,9 +2938,9 @@
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA=="
},
"@hapi/hoek": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz",
"integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw=="
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
"integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow=="
},
"@hapi/joi": {
"version": "15.1.1",
@ -3659,9 +3659,9 @@
}
},
"acorn": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
"dev": true
},
"acorn-globals": {
@ -6234,7 +6234,7 @@
},
"eslint-config-mattermost": {
"version": "github:mattermost/eslint-config-mattermost#8f9eb1414bf9ebfb509359bddddfad9788ca3c3c",
"from": "github:mattermost/eslint-config-mattermost",
"from": "github:mattermost/eslint-config-mattermost#8f9eb1414bf9ebfb509359bddddfad9788ca3c3c",
"dev": true
},
"eslint-plugin-eslint-plugin": {
@ -9568,9 +9568,9 @@
"integrity": "sha1-kYiJ6hP40KQufFVyUO7nE63JXDU="
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
},
"klaw": {
"version": "1.3.1",
@ -9974,8 +9974,8 @@
}
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#71bf6587faabeb3143b0657ea3154958b4a1cafb",
"from": "github:mattermost/mattermost-redux#71bf6587faabeb3143b0657ea3154958b4a1cafb",
"version": "github:mattermost/mattermost-redux#1c2b8ed676d2a3f88da38a5932c97d0e799bc13c",
"from": "github:mattermost/mattermost-redux#1c2b8ed676d2a3f88da38a5932c97d0e799bc13c",
"requires": {
"core-js": "3.1.4",
"form-data": "2.5.1",

View file

@ -24,7 +24,7 @@
"intl": "1.2.5",
"jail-monkey": "2.3.1",
"jsc-android": "241213.2.0",
"mattermost-redux": "github:mattermost/mattermost-redux#71bf6587faabeb3143b0657ea3154958b4a1cafb",
"mattermost-redux": "github:mattermost/mattermost-redux#1c2b8ed676d2a3f88da38a5932c97d0e799bc13c",
"mime-db": "1.43.0",
"moment-timezone": "0.5.27",
"prop-types": "15.7.2",
@ -98,7 +98,7 @@
"enzyme-adapter-react-16": "1.15.2",
"enzyme-to-json": "3.4.3",
"eslint": "6.8.0",
"eslint-config-mattermost": "github:mattermost/eslint-config-mattermost",
"eslint-config-mattermost": "github:mattermost/eslint-config-mattermost#8f9eb1414bf9ebfb509359bddddfad9788ca3c3c",
"eslint-plugin-header": "3.0.0",
"eslint-plugin-jest": "23.6.0",
"eslint-plugin-react": "7.17.0",