Unverified Commit ab21a8e8 authored by Mattermost Build's avatar Mattermost Build Committed by GitHub
Browse files

Automated cherry pick of #5917 (#5965)



* MM-26410 Switch to new isFavoriteChannel selector

* Update mattermost-redux to master

* Switch mattermost-redux to release-5.26 branch
Co-authored-by: default avatarHarrison Healey <harrisonmhealey@gmail.com>
parent 4b59e95c
......@@ -4,11 +4,10 @@
import {Client4} from 'mattermost-redux/client';
import {unfavoriteChannel} from 'mattermost-redux/actions/channels';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {getCurrentChannel, getRedirectChannelNameForTeam} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentChannel, getRedirectChannelNameForTeam, isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getCurrentRelativeTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {IntegrationTypes} from 'mattermost-redux/action_types';
import {isFavoriteChannel} from 'mattermost-redux/utils/channel_utils';
import {openModal} from 'actions/views/modals';
import * as GlobalActions from 'actions/global_actions.jsx';
......@@ -78,7 +77,7 @@ export function executeCommand(message, args) {
browserHistory.push(`${teamUrl}/channels/${redirectChannel}`);
dispatch(savePreferences(currentUserId, [{category, name, user_id: currentUserId, value: 'false'}]));
if (isFavoriteChannel(channel)) {
if (isFavoriteChannel(state, channel)) {
dispatch(unfavoriteChannel(channel.id));
}
......
......@@ -32,6 +32,9 @@ const initialState = {
channels: {
currentChannelId,
},
preferences: {
myPreferences: {},
},
teams: {
currentTeamId,
},
......
......@@ -22,14 +22,14 @@ import {
getRedirectChannelNameForTeam,
getMyChannels,
getMyChannelMemberships,
isFavoriteChannel,
isManuallyUnread,
} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentRelativeTeamUrl, getCurrentTeam, getCurrentTeamId, getTeamsList} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId, getUserByUsername} from 'mattermost-redux/selectors/entities/users';
import {getMostRecentPostIdInChannel, getPost} from 'mattermost-redux/selectors/entities/posts';
import {getMyPreferences} from 'mattermost-redux/selectors/entities/preferences';
import {getChannelByName, isFavoriteChannel} from 'mattermost-redux/utils/channel_utils';
import {getChannelByName} from 'mattermost-redux/utils/channel_utils';
import EventEmitter from 'mattermost-redux/utils/event_emitter';
import {openDirectChannelToUserId} from 'actions/channel_actions.jsx';
......@@ -117,12 +117,11 @@ export function joinChannelById(channelId) {
export function leaveChannel(channelId) {
return async (dispatch, getState) => {
let state = getState();
const myPreferences = getMyPreferences(state);
const currentUserId = getCurrentUserId(state);
const currentTeam = getCurrentTeam(state);
const channel = getChannel(state, channelId);
if (isFavoriteChannel(myPreferences, channelId)) {
if (isFavoriteChannel(state, channelId)) {
dispatch(unfavoriteChannel(channelId));
}
......
......@@ -10,16 +10,17 @@ import {savePreferences} from 'mattermost-redux/actions/preferences';
import {
getCurrentChannelId,
getChannelsNameMapInCurrentTeam,
getRedirectChannelNameForTeam,
isFavoriteChannel,
makeGetChannel,
shouldHideDefaultChannel,
getRedirectChannelNameForTeam,
} from 'mattermost-redux/selectors/entities/channels';
import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/common';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getUserIdsInChannels, getUser} from 'mattermost-redux/selectors/entities/users';
import {getInt, getTeammateNameDisplaySetting} from 'mattermost-redux/selectors/entities/preferences';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {isChannelMuted, isFavoriteChannel} from 'mattermost-redux/utils/channel_utils';
import {isChannelMuted} from 'mattermost-redux/utils/channel_utils';
import {displayUsername} from 'mattermost-redux/utils/user_utils';
......@@ -104,7 +105,7 @@ function makeMapStateToProps() {
channel.name === Constants.DEFAULT_CHANNEL &&
!ownProps.active &&
shouldHideDefaultChannel(state, channel) &&
!isFavoriteChannel(state.entities.preferences.myPreferences, channel.id)
!isFavoriteChannel(state, channel.id)
) {
shouldHideChannel = true;
}
......
......@@ -7,14 +7,14 @@ import {Dispatch, bindActionCreators, ActionCreatorsMapObject} from 'redux';
import {favoriteChannel, unfavoriteChannel, markChannelAsRead} from 'mattermost-redux/actions/channels';
import {addChannelToCategory} from 'mattermost-redux/actions/channel_categories';
import Permissions from 'mattermost-redux/constants/permissions';
import {isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels';
import {getMyChannelMemberships, getCurrentUserId} from 'mattermost-redux/selectors/entities/common';
import {makeGetCategoriesForTeam, getCategoryInTeamWithChannel} from 'mattermost-redux/selectors/entities/channel_categories';
import {getMyPreferences} from 'mattermost-redux/selectors/entities/preferences';
import {haveIChannelPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import {ActionFunc} from 'mattermost-redux/types/actions';
import {Channel} from 'mattermost-redux/types/channels';
import {isChannelMuted, isFavoriteChannel} from 'mattermost-redux/utils/channel_utils';
import {isChannelMuted} from 'mattermost-redux/utils/channel_utils';
import {unmuteChannel, muteChannel} from 'actions/channel_actions';
import {openModal} from 'actions/views/modals';
......@@ -33,7 +33,6 @@ function makeMapStateToProps() {
const getCategoriesForTeam = makeGetCategoriesForTeam();
return (state: GlobalState, ownProps: OwnProps) => {
const preferences = getMyPreferences(state);
const member = getMyChannelMemberships(state)[ownProps.channel.id];
const currentTeam = getCurrentTeam(state);
......@@ -54,7 +53,7 @@ function makeMapStateToProps() {
currentUserId: getCurrentUserId(state),
categories,
currentCategory,
isFavorite: isFavoriteChannel(preferences, ownProps.channel.id),
isFavorite: isFavoriteChannel(state, ownProps.channel.id),
isMuted: isChannelMuted(member),
channelLink: `${getSiteURL()}/${ownProps.channelLink}`,
managePublicChannelMembers,
......
......@@ -18109,8 +18109,8 @@
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#88da46d43b1ad3a97ad8ee69c0550ee5d89706f0",
"from": "github:mattermost/mattermost-redux#88da46d43b1ad3a97ad8ee69c0550ee5d89706f0",
"version": "github:mattermost/mattermost-redux#3f802bea154f3d5254481483e2f8b520a29e56f8",
"from": "github:mattermost/mattermost-redux#3f802bea154f3d5254481483e2f8b520a29e56f8",
"requires": {
"core-js": "3.6.4",
"form-data": "3.0.0",
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