Load channel members with channels to make sure we have latest unread counts (#4389)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9bae1f7e93
Коммит
92642bab68
@@ -186,3 +186,8 @@ export function unmarkFavorite(channelId) {
|
|||||||
|
|
||||||
AsyncClient.deletePreferences([pref]);
|
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 {handleNewPost, loadPosts, loadPostsBefore, loadPostsAfter} from 'actions/post_actions.jsx';
|
||||||
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
|
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
|
||||||
|
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
const ActionTypes = Constants.ActionTypes;
|
const ActionTypes = Constants.ActionTypes;
|
||||||
@@ -42,7 +43,7 @@ export function emitChannelClickEvent(channel) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
function switchToChannel(chan) {
|
function switchToChannel(chan) {
|
||||||
AsyncClient.getChannelStats(chan.id);
|
AsyncClient.getChannelStats(chan.id, true);
|
||||||
AsyncClient.updateLastViewedAt(chan.id);
|
AsyncClient.updateLastViewedAt(chan.id);
|
||||||
loadPosts(chan.id);
|
loadPosts(chan.id);
|
||||||
trackPage();
|
trackPage();
|
||||||
@@ -140,7 +141,7 @@ export function doFocusPost(channelId, postId, data) {
|
|||||||
channelId,
|
channelId,
|
||||||
post_list: data
|
post_list: data
|
||||||
});
|
});
|
||||||
AsyncClient.getChannels(true);
|
loadChannelsForCurrentUser();
|
||||||
AsyncClient.getMoreChannels(true);
|
AsyncClient.getMoreChannels(true);
|
||||||
AsyncClient.getChannelStats(channelId);
|
AsyncClient.getChannelStats(channelId);
|
||||||
loadPostsBefore(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
|
loadPostsBefore(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
|
||||||
@@ -148,7 +149,7 @@ export function doFocusPost(channelId, postId, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function emitPostFocusEvent(postId, onSuccess) {
|
export function emitPostFocusEvent(postId, onSuccess) {
|
||||||
AsyncClient.getChannels(true);
|
loadChannelsForCurrentUser();
|
||||||
Client.getPermalinkTmp(
|
Client.getPermalinkTmp(
|
||||||
postId,
|
postId,
|
||||||
(data) => {
|
(data) => {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
|
|||||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||||
import {handleNewPost, loadPosts} from 'actions/post_actions.jsx';
|
import {handleNewPost, loadPosts} from 'actions/post_actions.jsx';
|
||||||
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_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 * as StatusActions from 'actions/status_actions.jsx';
|
||||||
|
|
||||||
import {Constants, SocketEvents, UserStatuses} from 'utils/constants.jsx';
|
import {Constants, SocketEvents, UserStatuses} from 'utils/constants.jsx';
|
||||||
@@ -75,8 +76,7 @@ function handleFirstConnect() {
|
|||||||
|
|
||||||
function handleReconnect() {
|
function handleReconnect() {
|
||||||
if (Client.teamId) {
|
if (Client.teamId) {
|
||||||
AsyncClient.getChannels();
|
loadChannelsForCurrentUser();
|
||||||
AsyncClient.getMyChannelMembers();
|
|
||||||
loadPosts(ChannelStore.getCurrentId());
|
loadPosts(ChannelStore.getCurrentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ function handleUserAddedEvent(msg) {
|
|||||||
|
|
||||||
function handleUserRemovedEvent(msg) {
|
function handleUserRemovedEvent(msg) {
|
||||||
if (UserStore.getCurrentId() === msg.broadcast.user_id) {
|
if (UserStore.getCurrentId() === msg.broadcast.user_id) {
|
||||||
AsyncClient.getChannels();
|
loadChannelsForCurrentUser();
|
||||||
|
|
||||||
if (msg.data.remover_id !== msg.broadcast.user_id &&
|
if (msg.data.remover_id !== msg.broadcast.user_id &&
|
||||||
msg.data.channel_id === ChannelStore.getCurrentId() &&
|
msg.data.channel_id === ChannelStore.getCurrentId() &&
|
||||||
@@ -273,7 +273,7 @@ function handleChannelDeletedEvent(msg) {
|
|||||||
const teamUrl = TeamStore.getCurrentTeamRelativeUrl();
|
const teamUrl = TeamStore.getCurrentTeamRelativeUrl();
|
||||||
browserHistory.push(teamUrl + '/channels/' + Constants.DEFAULT_CHANNEL);
|
browserHistory.push(teamUrl + '/channels/' + Constants.DEFAULT_CHANNEL);
|
||||||
}
|
}
|
||||||
AsyncClient.getChannels();
|
loadChannelsForCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePreferenceChangedEvent(msg) {
|
function handlePreferenceChangedEvent(msg) {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import {browserHistory} from 'react-router/es6';
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
export default class DeleteChannelModal extends React.Component {
|
export default class DeleteChannelModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -29,7 +31,7 @@ export default class DeleteChannelModal extends React.Component {
|
|||||||
Client.deleteChannel(
|
Client.deleteChannel(
|
||||||
this.props.channel.id,
|
this.props.channel.id,
|
||||||
() => {
|
() => {
|
||||||
AsyncClient.getChannels(true);
|
loadChannelsForCurrentUser();
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
AsyncClient.dispatchError(err, 'handleDelete');
|
AsyncClient.dispatchError(err, 'handleDelete');
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ export default class Navbar extends React.Component {
|
|||||||
|
|
||||||
Client.leaveChannel(channelId,
|
Client.leaveChannel(channelId,
|
||||||
() => {
|
() => {
|
||||||
AsyncClient.getChannels(true);
|
ChannelActions.loadChannelsForCurrentUser();
|
||||||
|
|
||||||
if (this.state.isFavorite) {
|
if (this.state.isFavorite) {
|
||||||
ChannelActions.unmarkFavorite(channelId);
|
ChannelActions.unmarkFavorite(channelId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export function checkVersion() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getChannels(doVersionCheck) {
|
export function getChannels() {
|
||||||
if (isCallInProgress('getChannels')) {
|
if (isCallInProgress('getChannels')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -74,10 +74,6 @@ export function getChannels(doVersionCheck) {
|
|||||||
(data) => {
|
(data) => {
|
||||||
callTracker.getChannels = 0;
|
callTracker.getChannels = 0;
|
||||||
|
|
||||||
if (doVersionCheck) {
|
|
||||||
checkVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
AppDispatcher.handleServerAction({
|
AppDispatcher.handleServerAction({
|
||||||
type: ActionTypes.RECEIVED_CHANNELS,
|
type: ActionTypes.RECEIVED_CHANNELS,
|
||||||
channels: data
|
channels: data
|
||||||
@@ -114,7 +110,7 @@ export function getChannel(id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMyChannelMembers(doVersionCheck) {
|
export function getMyChannelMembers() {
|
||||||
if (isCallInProgress('getMyChannelMembers')) {
|
if (isCallInProgress('getMyChannelMembers')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,10 +121,6 @@ export function getMyChannelMembers(doVersionCheck) {
|
|||||||
(data) => {
|
(data) => {
|
||||||
callTracker.getMyChannelMembers = 0;
|
callTracker.getMyChannelMembers = 0;
|
||||||
|
|
||||||
if (doVersionCheck) {
|
|
||||||
checkVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
AppDispatcher.handleServerAction({
|
AppDispatcher.handleServerAction({
|
||||||
type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
|
type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
|
||||||
members: data
|
members: data
|
||||||
@@ -242,7 +234,7 @@ export function getMoreChannels(force) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getChannelStats(channelId = ChannelStore.getCurrentId()) {
|
export function getChannelStats(channelId = ChannelStore.getCurrentId(), doVersionCheck = false) {
|
||||||
if (isCallInProgress('getChannelStats' + channelId) || channelId == null) {
|
if (isCallInProgress('getChannelStats' + channelId) || channelId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,6 +246,10 @@ export function getChannelStats(channelId = ChannelStore.getCurrentId()) {
|
|||||||
(data) => {
|
(data) => {
|
||||||
callTracker['getChannelStats' + channelId] = 0;
|
callTracker['getChannelStats' + channelId] = 0;
|
||||||
|
|
||||||
|
if (doVersionCheck) {
|
||||||
|
checkVersion();
|
||||||
|
}
|
||||||
|
|
||||||
AppDispatcher.handleServerAction({
|
AppDispatcher.handleServerAction({
|
||||||
type: ActionTypes.RECEIVED_CHANNEL_STATS,
|
type: ActionTypes.RECEIVED_CHANNEL_STATS,
|
||||||
stats: data
|
stats: data
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user