[MM-62113] Force reload of team unreads when following/unfollowing a thread (#29994)
* [MM-62113] Force reload of team unreads when following/unfollowing a thread * E2E test * add test key --------- Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a013797ed0
Коммит
c079020e9e
@@ -96,4 +96,67 @@ describe('Collapsed Reply Threads', () => {
|
|||||||
cy.uiCloseRHS();
|
cy.uiCloseRHS();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('MM-T5671 should handle mention counts correctly when marking a thread as unread and unfollowing it', () => {
|
||||||
|
// # Post a root post as current user
|
||||||
|
cy.postMessageAs({
|
||||||
|
sender: otherUser,
|
||||||
|
message: `@${testUser.username} Root post for mention test`,
|
||||||
|
channelId: testChannel.id,
|
||||||
|
}).then(({id: rootId}) => {
|
||||||
|
// # Post a reply mentioning the user
|
||||||
|
cy.postMessageAs({
|
||||||
|
sender: otherUser,
|
||||||
|
message: `Hey @${testUser.username}, check this out!`,
|
||||||
|
channelId: testChannel.id,
|
||||||
|
rootId,
|
||||||
|
}).then(({id: replyId}) => {
|
||||||
|
// # Post another reply mentioning the user
|
||||||
|
cy.postMessageAs({
|
||||||
|
sender: otherUser,
|
||||||
|
message: `Hey @${testUser.username}, check this out too!`,
|
||||||
|
channelId: testChannel.id,
|
||||||
|
rootId,
|
||||||
|
});
|
||||||
|
|
||||||
|
// # Click root post to open RHS
|
||||||
|
cy.get(`#post_${rootId}`).click();
|
||||||
|
|
||||||
|
// # Wait for RHS to open
|
||||||
|
cy.wait(TIMEOUTS.ONE_SEC);
|
||||||
|
|
||||||
|
// # Mark the thread as unread
|
||||||
|
cy.uiClickPostDropdownMenu(replyId, 'Mark as Unread', 'RHS_COMMENT');
|
||||||
|
|
||||||
|
// # Wait for unread to be marked correctly
|
||||||
|
cy.wait(TIMEOUTS.ONE_SEC);
|
||||||
|
|
||||||
|
// # Close RHS
|
||||||
|
cy.uiCloseRHS();
|
||||||
|
|
||||||
|
// # Switch to a different team
|
||||||
|
cy.apiCreateTeam('team', 'Team').then(({team: otherTeam}) => {
|
||||||
|
// # Click on the other team button to switch teams
|
||||||
|
cy.get(`#${otherTeam.name}TeamButton`).click();
|
||||||
|
|
||||||
|
// * Verify mention count on the original team
|
||||||
|
cy.get(`#${testTeam.name}TeamButton`).find('.badge').should('be.visible');
|
||||||
|
|
||||||
|
// # Click on the original team button to switch back
|
||||||
|
cy.get(`#${testTeam.name}TeamButton`).click();
|
||||||
|
|
||||||
|
// # Unfollow the thread
|
||||||
|
cy.uiGetPostThreadFooter(rootId).findByText('Following').click();
|
||||||
|
|
||||||
|
// # Switch to a different team and back
|
||||||
|
cy.get(`#${otherTeam.name}TeamButton`).click();
|
||||||
|
cy.get(`#${testTeam.name}TeamButton`).click();
|
||||||
|
cy.get(`#${otherTeam.name}TeamButton`).click();
|
||||||
|
|
||||||
|
// * Verify there is no mention count on the original team
|
||||||
|
cy.get(`#${testTeam.name}TeamButton`).find('.badge').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import type {DispatchFunc, GetStateFunc, ActionFunc, ActionFuncAsync} from 'matt
|
|||||||
import {logError} from './errors';
|
import {logError} from './errors';
|
||||||
import {forceLogoutIfNecessary} from './helpers';
|
import {forceLogoutIfNecessary} from './helpers';
|
||||||
import {getPostThread} from './posts';
|
import {getPostThread} from './posts';
|
||||||
|
import {getMyTeamUnreads} from './teams';
|
||||||
|
|
||||||
type ExtendedPost = Post & { system_post_ids?: string[] };
|
type ExtendedPost = Post & { system_post_ids?: string[] };
|
||||||
|
|
||||||
@@ -391,6 +392,12 @@ export function setThreadFollow(userId: string, teamId: string, threadId: string
|
|||||||
dispatch(logError(error));
|
dispatch(logError(error));
|
||||||
return {error};
|
return {error};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As a short term fix for https://mattermost.atlassian.net/browse/MM-62113, we will fetch
|
||||||
|
// the users team unreads after following or unfollowing a thread. This will ensure that the unreads are
|
||||||
|
// updated correctly in the case where the user is following or unfollowing a thread that has unread messages.
|
||||||
|
dispatch(getMyTeamUnreads(isCollapsedThreadsEnabled(getState())));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user