snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
// 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 @websocket
import {getRandomId} from '@/utils';
describe('Handle removed user - new sidebar', () => {
it('MM-27202 should add new channels to the sidebar when created from another session', () => {
// # Start with a new team
const teamName = `team-${getRandomId()}`;
cy.createNewTeam(teamName, teamName);
// * Verify that we've switched to the new team
cy.uiGetLHSHeader().findByText(teamName);
// # Create a new channel from another session
const channelName = `channel-${getRandomId()}`;
cy.apiGetTeamByName(teamName).then(({team}) => {
cy.apiCreateChannel(team.id, channelName, channelName, 'O', '', '', false);
});
// Verify that the new channel is in the sidebar
cy.get(`#sidebarItem_${channelName}`).should('be.visible');
});
});

View File

@@ -0,0 +1,33 @@
// 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 @websocket
import {getRandomId} from '@/utils';
describe('Handle removed user - new sidebar', () => {
it('MM-27202 should add new channels to the sidebar when created from another session', () => {
// # Start with a new team
const teamName = `team-${getRandomId()}`;
cy.createNewTeam(teamName, teamName);
// * Verify that we've switched to the new team
cy.uiGetLHSHeader().findByText(teamName);
// # Create a new channel from another session
const channelName = `channel-${getRandomId()}`;
cy.apiGetTeamByName(teamName).then(({team}) => {
cy.apiCreateChannel(team.id, channelName, channelName, 'O', '', '', false);
});
// Verify that the new channel is in the sidebar
cy.get(`#sidebarItem_${channelName}`).should('be.visible');
});
});

View File

@@ -0,0 +1,144 @@
// 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 @websocket
import {beRead, beUnread} from '@/support/assertions';
import {getAdminAccount} from '@/support/env';
import {getRandomId} from '@/utils';
describe('Handle new post', () => {
const admin = getAdminAccount();
let channel1;
let team1;
let user1;
before(() => {
cy.apiInitSetup().then(({channel, team, user}) => {
channel1 = channel;
team1 = team;
user1 = user;
cy.apiLogin(user1);
cy.visit(`/${team.name}/channels/town-square`);
});
});
it.skip('MM-T4609 - should mark channel as unread when a message is sent in another channel', () => {
// # Explicitly click over to the test channel from Town Square
// # to dismiss the unread + badge from adding `user` to the channel
cy.get(`#sidebarItem_${channel1.name}`).click();
// * Verify those are now gone
cy.get(`#sidebarItem_${channel1.name}`).should(beRead);
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
// # Switch back to Town Square
cy.get('#sidebarItem_town-square').click();
// # Have another user post in the test channel
cy.postMessageAs({sender: admin, message: 'post', channelId: channel1.id});
// * Verify that the channel is now unread
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
});
it.skip('MM-T4610 - should show the mention badge when a mention is sent in another channel', () => {
// # Explicitly click over to the test channel from Town Square
// # to dismiss the unread + badge from the end of the previous test
// # (maybe should use a new channel but then the same thing has to be done
// # for that anyways)
cy.get(`#sidebarItem_${channel1.name}`).click();
cy.get(`#sidebarItem_${channel1.name}`).should(beRead);
cy.get(`#sidebarItem_${channel1.name} .badge`).should('not.exist');
// # Switch back to Town Square
cy.get('#sidebarItem_town-square').click();
// # Have another user post in the test channel
cy.postMessageAs({sender: admin, message: `@${user1.username}`, channelId: channel1.id});
// * Verify that the channel is now unread with one mention
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
cy.get(`#sidebarItem_${channel1.name} .badge`).should('exist').contains('1');
// # And have them post again
cy.postMessageAs({sender: admin, message: `@${user1.username}`, channelId: channel1.id});
// * Verify that the channel is now unread with two mentions
cy.get(`#sidebarItem_${channel1.name}`).should(beUnread);
cy.get(`#sidebarItem_${channel1.name} .badge`).should('exist').contains('2');
});
it('MM-T2015 - should show the mention badge when added to another channel', () => {
const baseUrl = Cypress.config('baseUrl');
// # Have another user create a new channel
const channelName = 'channel_' + getRandomId();
cy.externalRequest({
user: admin,
baseUrl,
method: 'post',
path: 'channels',
data: {
display_name: channelName,
name: channelName,
team_id: team1.id,
type: 'O',
},
}).then((response) => {
expect(response.status).to.equal(201);
const channel = response.data;
// # And then invite the current user
cy.externalAddUserToChannel(user1.id, channel.id);
});
// * Verify that the channel is in the current user's sidebar and is unread with one mention
cy.get(`#sidebarItem_${channelName}`).should(beUnread);
cy.get(`#sidebarItem_${channelName} .badge`).should('exist').contains('1');
});
it('MM-25452 should only show one mention added to another channel with network lag', () => {
const baseUrl = Cypress.config('baseUrl');
// # Have another user create a new channel
const channelName = 'channel_' + getRandomId();
cy.externalRequest({
user: admin,
baseUrl,
method: 'post',
path: 'channels',
data: {
display_name: channelName,
name: channelName,
team_id: team1.id,
type: 'O',
},
}).then((response) => {
expect(response.status).to.equal(201);
const channel = response.data;
// # Add a small delay to the request to fetch the channel
cy.delayRequestToRoutes([`channels/${channel.id}`], 100);
// # And then invite the current user
cy.externalAddUserToChannel(user1.id, channel.id);
});
// * Verify that the channel is in the current user's sidebar and is unread with one mention
cy.get(`#sidebarItem_${channelName}`).should(beUnread);
cy.get(`#sidebarItem_${channelName} .badge`).should('exist').contains('1');
});
});

View File

@@ -0,0 +1,98 @@
// 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.
// ***************************************************************
export function createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass) {
// # Start with a new team
cy.createNewTeam(teamName, teamName);
// * Verify that we've switched to the new team
cy.uiGetLHSHeader().findByText(teamName);
// # Click on Off Topic
cy.get(`${sidebarItemClass}:contains(Off-Topic)`).should('be.visible').click();
// * Verify that the channel changed
cy.url().should('include', `/${teamName}/channels/off-topic`);
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Off-Topic');
}
export function removeMeFromCurrentChannel() {
// # Remove the Guest User from channel
let channelId;
return cy.getCurrentChannelId().then((res) => {
channelId = res;
return cy.apiGetMe();
}).then(({user}) => {
return cy.removeUserFromChannel(channelId, user.id);
});
}
export function verifyRHS(teamName, sidebarItemClass, postId) {
// # Dismiss the modal informing the user they were kicked out
cy.get('#removedChannelBtn').click();
// * Verify that the channel changed back to Town Square
cy.url().should('include', `/${teamName}/channels/town-square`);
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Town Square');
// * Verify that Off-Topic has been removed
cy.get(`${sidebarItemClass}:contains(Off-Topic)`).should('not.exist');
// * Verify that the recently posted message is no longer in the RHS
cy.get(`#rhsPostMessageText_${postId}`).should('not.exist');
}
export function shouldRemoveMentionsInRHS(teamName, sidebarItemClass) {
let postId;
// # Post a unique message with a mention and retrieve its ID
cy.apiGetMe().then(({user}) => {
const messageText = `${Date.now()} - mention to @${user.username} `;
cy.postMessage(messageText);
return cy.getLastPostId();
}).then((lastPostId) => {
postId = lastPostId;
// # Click on the Recent Mentions button to open the RHS
cy.uiGetRecentMentionButton().click();
// * Verify that the recently posted message is shown in the RHS
cy.get(`#rhsPostMessageText_${postId}`).should('exist');
return removeMeFromCurrentChannel();
}).then(() => {
verifyRHS(teamName, sidebarItemClass, postId);
});
}
export function shouldRemoveSavedPostsInRHS(teamName, sidebarItemClass) {
let postId;
// # Post a unique message and retrieve its ID
const messageText = `${Date.now()} - post to save`;
cy.postMessage(messageText);
cy.getLastPostId().then((lastPostId) => {
postId = lastPostId;
// # Save the last post
cy.clickPostSaveIcon(postId);
// # Click on the Saved Posts button to open the RHS
cy.uiGetSavedPostButton().click();
// * Verify that the recently posted message is shown in the RHS
cy.get(`#rhsPostMessageText_${postId}`).should('exist');
return removeMeFromCurrentChannel();
}).then(() => {
verifyRHS(teamName, sidebarItemClass, postId);
});
}

View File

@@ -0,0 +1,53 @@
// 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 @websocket
import {
createNewTeamAndMoveToOffTopic,
removeMeFromCurrentChannel,
shouldRemoveSavedPostsInRHS,
shouldRemoveMentionsInRHS,
} from './helpers';
import {getRandomId} from '@/utils';
describe('Handle removed user - new sidebar', () => {
const sidebarItemClass = '.SidebarChannel';
before(() => {
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => {
cy.visit(`/${team.name}/channels/${channel.name}`);
});
});
it('should be redirected to last channel when a user is removed from their current channel', () => {
const teamName = `team-${getRandomId()}`;
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
removeMeFromCurrentChannel().then(() => {
// * Verify that the channel changed back to Town Square
cy.url().should('include', `/${teamName}/channels/town-square`);
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Town Square');
});
});
it('should remove mentions from RHS', () => {
const teamName = `team-${getRandomId()}`;
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
shouldRemoveMentionsInRHS(teamName, sidebarItemClass);
});
it('should remove saved posts from RHS', () => {
const teamName = `team-${getRandomId()}`;
createNewTeamAndMoveToOffTopic(teamName, sidebarItemClass);
shouldRemoveSavedPostsInRHS(teamName, sidebarItemClass);
});
});