Load channel members with channels to make sure we have latest unread counts (#4389)

Этот коммит содержится в:
Joram Wilander
2016-11-01 11:13:33 -04:00
коммит произвёл GitHub
родитель 9bae1f7e93
Коммит 92642bab68
6 изменённых файлов: 25 добавлений и 20 удалений

Просмотреть файл

@@ -186,3 +186,8 @@ export function unmarkFavorite(channelId) {
AsyncClient.deletePreferences([pref]);
}
export function loadChannelsForCurrentUser() {
AsyncClient.getChannels();
AsyncClient.getMyChannelMembers();
}

Просмотреть файл

@@ -14,6 +14,7 @@ import SearchStore from 'stores/search_store.jsx';
import {handleNewPost, loadPosts, loadPostsBefore, loadPostsAfter} from 'actions/post_actions.jsx';
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
@@ -42,7 +43,7 @@ export function emitChannelClickEvent(channel) {
);
}
function switchToChannel(chan) {
AsyncClient.getChannelStats(chan.id);
AsyncClient.getChannelStats(chan.id, true);
AsyncClient.updateLastViewedAt(chan.id);
loadPosts(chan.id);
trackPage();
@@ -140,7 +141,7 @@ export function doFocusPost(channelId, postId, data) {
channelId,
post_list: data
});
AsyncClient.getChannels(true);
loadChannelsForCurrentUser();
AsyncClient.getMoreChannels(true);
AsyncClient.getChannelStats(channelId);
loadPostsBefore(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
@@ -148,7 +149,7 @@ export function doFocusPost(channelId, postId, data) {
}
export function emitPostFocusEvent(postId, onSuccess) {
AsyncClient.getChannels(true);
loadChannelsForCurrentUser();
Client.getPermalinkTmp(
postId,
(data) => {

Просмотреть файл

@@ -20,6 +20,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import {handleNewPost, loadPosts} from 'actions/post_actions.jsx';
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
import * as StatusActions from 'actions/status_actions.jsx';
import {Constants, SocketEvents, UserStatuses} from 'utils/constants.jsx';
@@ -75,8 +76,7 @@ function handleFirstConnect() {
function handleReconnect() {
if (Client.teamId) {
AsyncClient.getChannels();
AsyncClient.getMyChannelMembers();
loadChannelsForCurrentUser();
loadPosts(ChannelStore.getCurrentId());
}
@@ -234,7 +234,7 @@ function handleUserAddedEvent(msg) {
function handleUserRemovedEvent(msg) {
if (UserStore.getCurrentId() === msg.broadcast.user_id) {
AsyncClient.getChannels();
loadChannelsForCurrentUser();
if (msg.data.remover_id !== msg.broadcast.user_id &&
msg.data.channel_id === ChannelStore.getCurrentId() &&
@@ -273,7 +273,7 @@ function handleChannelDeletedEvent(msg) {
const teamUrl = TeamStore.getCurrentTeamRelativeUrl();
browserHistory.push(teamUrl + '/channels/' + Constants.DEFAULT_CHANNEL);
}
AsyncClient.getChannels();
loadChannelsForCurrentUser();
}
function handlePreferenceChangedEvent(msg) {