Skip to content
Snippets Groups Projects
Unverified Commit dac3e362 authored by ThibG's avatar ThibG Committed by GitHub
Browse files

Fix unread notification marker not updating when mounting column (#14954)

parent 7d985f2a
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,7 @@ const deleteByStatus = (state, statusId) => {
const updateMounted = (state) => {
state = state.update('mounted', count => count + 1);
if (!shouldCountUnreadNotifications(state)) {
if (!shouldCountUnreadNotifications(state, state.get('mounted') === 1)) {
state = state.set('readMarkerId', state.get('lastReadId'));
state = clearUnread(state);
}
......@@ -167,14 +167,14 @@ const updateVisibility = (state, visibility) => {
return state;
};
const shouldCountUnreadNotifications = (state) => {
const shouldCountUnreadNotifications = (state, ignoreScroll = false) => {
const isTabVisible = state.get('isTabVisible');
const isOnTop = state.get('top');
const isMounted = state.get('mounted') > 0;
const lastReadId = state.get('lastReadId');
const lastItemReached = !state.get('hasMore') || lastReadId === '0' || (!state.get('items').isEmpty() && compareId(state.get('items').last().get('id'), lastReadId) <= 0);
return !(isTabVisible && isOnTop && isMounted && lastItemReached);
return !(isTabVisible && (ignoreScroll || isOnTop) && isMounted && lastItemReached);
};
const recountUnread = (state, last_read_id) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment