const someItemInserted = React.Children.count(prevProps.children) > 0 &&
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
+ const pendingChanged = (prevProps.numPending > 0) !== (this.props.numPending > 0);
- if (someItemInserted && (this.getScrollTop() > 0 || this.mouseMovedRecently)) {
+ if (pendingChanged || someItemInserted && (this.getScrollTop() > 0 || this.mouseMovedRecently)) {
return this.getScrollHeight() - this.getScrollTop();
} else {
return null;
handleLoadPending = e => {
e.preventDefault();
this.props.onLoadPending();
+ // Prevent the weird scroll-jumping behavior, as we explicitly don't want to
+ // scroll to top, and we know the scroll height is going to change
+ this.scrollToTopOnMouseIdle = false;
+ this.lastScrollWasSynthetic = false;
+ this.clearMouseIdleTimer();
+ this.mouseIdleTimer = setTimeout(this.handleMouseIdle, MOUSE_IDLE_DELAY);
+ this.mouseMovedRecently = true;
}
render () {
const index = columns.findIndex(c => c.get('uuid') === uuid);
return {
- hasUnread: state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'unread']) > 0,
+ hasUnread: state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'unread']) > 0 || state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'pendingItems']).size > 0,
onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'community', 'other', 'onlyMedia']),
};
};
showFilterBar: state.getIn(['settings', 'notifications', 'quickFilter', 'show']),
notifications: getNotifications(state),
isLoading: state.getIn(['notifications', 'isLoading'], true),
- isUnread: state.getIn(['notifications', 'unread']) > 0,
+ isUnread: state.getIn(['notifications', 'unread']) > 0 || state.getIn(['notifications', 'pendingItems']).size > 0,
hasMore: state.getIn(['notifications', 'hasMore']),
numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size,
});
const normalizeNotification = (state, notification, usePendingItems) => {
if (usePendingItems) {
- return state.update('pendingItems', list => list.unshift(notificationToMap(notification)));
+ return state.update('pendingItems', list => list.unshift(notificationToMap(notification))).update('unread', unread => unread + 1);
}
const top = state.get('top');
const updateTop = (state, top) => {
if (top) {
- state = state.set('unread', 0);
+ state = state.set('unread', state.get('pendingItems').size);
}
return state.set('top', top);
return state;
}
- return state.update(timeline, initialTimeline, map => map.update('pendingItems', list => list.unshift(status.get('id'))));
+ return state.update(timeline, initialTimeline, map => map.update('pendingItems', list => list.unshift(status.get('id'))).update('unread', unread => unread + 1));
}
const top = state.getIn([timeline, 'top']);
const updateTop = (state, timeline, top) => {
return state.update(timeline, initialTimeline, map => map.withMutations(mMap => {
- if (top) mMap.set('unread', 0);
+ if (top) mMap.set('unread', mMap.get('pendingItems').size);
mMap.set('top', top);
}));
};