Этот коммит содержится в:
Christopher Speller
2016-02-13 11:03:10 -05:00
родитель 45dfd516aa c71c5cef63
Коммит 958b588448
6 изменённых файлов: 52 добавлений и 17 удалений

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

@@ -95,6 +95,8 @@ class ChannelLoader extends React.Component {
$(window).on('focus', function windowFocus() {
AsyncClient.updateLastViewedAt();
ChannelStore.resetCounts(ChannelStore.getCurrentId());
ChannelStore.emitChange();
window.isActive = true;
});
@@ -185,4 +187,4 @@ ChannelLoader.propTypes = {
intl: intlShape.isRequired
};
export default injectIntl(ChannelLoader);
export default injectIntl(ChannelLoader);

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

@@ -308,7 +308,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
ChannelStore.storeChannels(action.channels);
ChannelStore.storeChannelMembers(action.members);
currentId = ChannelStore.getCurrentId();
if (currentId && !document.hidden) {
if (currentId && window.isActive) {
ChannelStore.resetCounts(currentId);
}
ChannelStore.setUnreadCounts();
@@ -321,7 +321,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
ChannelStore.pStoreChannelMember(action.member);
}
currentId = ChannelStore.getCurrentId();
if (currentId && !document.hidden) {
if (currentId && window.isActive) {
ChannelStore.resetCounts(currentId);
}
ChannelStore.setUnreadCount(action.channel.id);

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

@@ -202,10 +202,10 @@ function handleNewPostEvent(msg, translations) {
// Update channel state
if (ChannelStore.getCurrentId() === msg.channel_id) {
if (document.hidden) {
AsyncClient.getChannel(msg.channel_id);
} else {
if (window.isActive) {
AsyncClient.updateLastViewedAt();
} else {
AsyncClient.getChannel(msg.channel_id);
}
} else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) {
AsyncClient.getChannel(msg.channel_id);

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

@@ -549,7 +549,7 @@ export function getPosts(id) {
type: ActionTypes.RECEIVED_POSTS,
id: channelId,
before: true,
numRequested: Constants.POST_CHUNK_SIZE,
numRequested: 0,
post_list: data
});