Use new isFavoriteChannel redux util (#1113)
* Use new isFavoriteChannel redux util * Remove unmarkFavorite actions
This commit is contained in:
parent
df5f7a0059
commit
cf29d8dec5
1 changed files with 6 additions and 12 deletions
|
|
@ -10,8 +10,7 @@ import {
|
|||
fetchMyChannelsAndMembers,
|
||||
markChannelAsRead,
|
||||
selectChannel,
|
||||
leaveChannel as serviceLeaveChannel,
|
||||
unfavoriteChannel
|
||||
leaveChannel as serviceLeaveChannel
|
||||
} from 'mattermost-redux/actions/channels';
|
||||
import {getPosts, getPostsBefore, getPostsSince, getPostThread} from 'mattermost-redux/actions/posts';
|
||||
import {getFilesForPost} from 'mattermost-redux/actions/files';
|
||||
|
|
@ -20,6 +19,7 @@ import {getTeamMembersByIds} from 'mattermost-redux/actions/teams';
|
|||
import {getProfilesInChannel} from 'mattermost-redux/actions/users';
|
||||
import {General, Preferences} from 'mattermost-redux/constants';
|
||||
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
|
||||
|
||||
import {
|
||||
getChannelByName,
|
||||
getDirectChannelName,
|
||||
|
|
@ -379,13 +379,10 @@ export function toggleGMChannel(channelId, visible) {
|
|||
export function closeDMChannel(channel) {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
||||
if (channel.isFavorite) {
|
||||
unfavoriteChannel(channel.id)(dispatch, getState);
|
||||
}
|
||||
const currentChannelId = getCurrentChannelId(state);
|
||||
|
||||
toggleDMChannel(channel.teammate_id, 'false')(dispatch, getState);
|
||||
if (channel.isCurrent) {
|
||||
if (channel.id === currentChannelId) {
|
||||
selectInitialChannel(state.entities.teams.currentTeamId)(dispatch, getState);
|
||||
}
|
||||
};
|
||||
|
|
@ -394,13 +391,10 @@ export function closeDMChannel(channel) {
|
|||
export function closeGMChannel(channel) {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
||||
if (channel.isFavorite) {
|
||||
unfavoriteChannel(channel.id)(dispatch, getState);
|
||||
}
|
||||
const currentChannelId = getCurrentChannelId(state);
|
||||
|
||||
toggleGMChannel(channel.id, 'false')(dispatch, getState);
|
||||
if (channel.isCurrent) {
|
||||
if (channel.id === currentChannelId) {
|
||||
selectInitialChannel(state.entities.teams.currentTeamId)(dispatch, getState);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue