PLT-7220: Jumping to a GM from a flagged messages doesn't add the GM to your LHS (#7319)

* Ensured that DM/GM channel is added to LHS when jump link is clicked in RHS

* Moved sidebar channel loading logic into global_actions so that it happens after the users' channels have been loaded

* Fixing checkstyle issues
This commit is contained in:
Jonathan
2017-08-30 16:26:36 -04:00
committed by Joram Wilander
parent 9e3b74b4ef
commit bb2ca558bb

View File

@@ -11,7 +11,7 @@ import TeamStore from 'stores/team_store.jsx';
import SearchStore from 'stores/search_store.jsx';
import {handleNewPost} from 'actions/post_actions.jsx';
import {loadProfilesForSidebar} from 'actions/user_actions.jsx';
import {loadProfilesForSidebar, loadNewDMIfNeeded, loadNewGMIfNeeded} from 'actions/user_actions.jsx';
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
import {stopPeriodicStatusUpdates} from 'actions/status_actions.jsx';
import * as WebsocketActions from 'actions/websocket_actions.jsx';
@@ -133,6 +133,13 @@ export function emitPostFocusEvent(postId, onSuccess) {
(data) => {
if (data) {
const channelId = data.posts[data.order[0]].channel_id;
const channel = ChannelStore.getChannelById(channelId);
if (channel && channel.type === Constants.DM_CHANNEL) {
loadNewDMIfNeeded(channel.id);
} else if (channel && channel.type === Constants.GM_CHANNEL) {
loadNewGMIfNeeded(channel.id);
}
doFocusPost(channelId, postId, data).then(() => {
if (onSuccess) {
onSuccess();