mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-52995: Fix opening DM/GM thread from thread footer (#23579)
This commit is contained in:
parent
cdc73cd8e3
commit
36027ac1c4
@ -0,0 +1,70 @@
|
|||||||
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
// ***************************************************************
|
||||||
|
// - [#] indicates a test step (e.g. # Go to a page)
|
||||||
|
// - [*] indicates an assertion (e.g. * Check the title)
|
||||||
|
// - Use element ID when selecting an element. Create one if none.
|
||||||
|
// ***************************************************************
|
||||||
|
|
||||||
|
// Stage: @prod
|
||||||
|
// Group: @channels @collapsed_reply_threads
|
||||||
|
|
||||||
|
describe('Collapsed Reply Threads', () => {
|
||||||
|
let testTeam;
|
||||||
|
let testUser;
|
||||||
|
let otherUser;
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
cy.apiUpdateConfig({
|
||||||
|
ServiceSettings: {
|
||||||
|
ThreadAutoFollow: true,
|
||||||
|
CollapsedThreads: 'default_off',
|
||||||
|
EnableTutorial: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// # Create new channel and other user, and add other user to channel
|
||||||
|
cy.apiInitSetup({loginAfter: true, promoteNewUserAsAdmin: true}).then(({team, user}) => {
|
||||||
|
testTeam = team;
|
||||||
|
testUser = user;
|
||||||
|
|
||||||
|
cy.apiSaveCRTPreference(testUser.id, 'on');
|
||||||
|
cy.apiCreateUser({prefix: 'other'}).then(({user: user1}) => {
|
||||||
|
otherUser = user1;
|
||||||
|
|
||||||
|
cy.apiAddUserToTeam(testTeam.id, otherUser.id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
// # Visit the channel
|
||||||
|
cy.visit(`/${testTeam.name}/messages/@${otherUser.username}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open thread when thread footer reply button is clicked in a DM/GM channel', () => {
|
||||||
|
// # Post a message
|
||||||
|
const msg = 'Root post';
|
||||||
|
cy.postMessage(msg);
|
||||||
|
|
||||||
|
cy.getLastPostId().then((rootId) => {
|
||||||
|
// # Thread with replies
|
||||||
|
cy.clickPostCommentIcon(rootId);
|
||||||
|
cy.uiGetReplyTextBox().type('reply{enter}');
|
||||||
|
cy.uiGetReplyTextBox().type('reply2{enter}');
|
||||||
|
cy.uiCloseRHS();
|
||||||
|
|
||||||
|
// * Check that the RHS is closed
|
||||||
|
cy.get('#rhsContainer').should('not.exist');
|
||||||
|
|
||||||
|
// # Get thread footer of last post and find reply button
|
||||||
|
cy.uiGetPostThreadFooter(rootId).find('button.ReplyButton').click();
|
||||||
|
|
||||||
|
// * Thread should be visible in RHS
|
||||||
|
cy.get(`#rhsPost_${rootId}`).within(() => {
|
||||||
|
cy.get(`#rhsPostMessageText_${rootId}`).should('be.visible').and('have.text', msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -390,12 +390,12 @@ const PostComponent = (props: Props): JSX.Element => {
|
|||||||
}, [post, props.actions, props.actions.selectPostFromRightHandSideSearch]);
|
}, [post, props.actions, props.actions.selectPostFromRightHandSideSearch]);
|
||||||
|
|
||||||
const handleThreadClick = useCallback((e: React.MouseEvent) => {
|
const handleThreadClick = useCallback((e: React.MouseEvent) => {
|
||||||
if (props.currentTeam.id === props.team?.id) {
|
if (props.currentTeam.id === teamId) {
|
||||||
handleCommentClick(e);
|
handleCommentClick(e);
|
||||||
} else {
|
} else {
|
||||||
handleJumpClick(e);
|
handleJumpClick(e);
|
||||||
}
|
}
|
||||||
}, [handleCommentClick, handleJumpClick]);
|
}, [handleCommentClick, handleJumpClick, props.currentTeam.id, teamId]);
|
||||||
|
|
||||||
const postClass = classNames('post__body', {'post--edited': PostUtils.isEdited(post), 'search-item-snippet': isSearchResultItem});
|
const postClass = classNames('post__body', {'post--edited': PostUtils.isEdited(post), 'search-item-snippet': isSearchResultItem});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user