mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-25 02:48:37 -04:00
Used short mode of data spillage report card in threads view to fix spacing issue (#36709)
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / Check go fix (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres (shard 0) (push) Blocked by required conditions
Server CI / Postgres (shard 1) (push) Blocked by required conditions
Server CI / Postgres (shard 2) (push) Blocked by required conditions
Server CI / Postgres (shard 3) (push) Blocked by required conditions
Server CI / Merge Postgres Test Results (push) Blocked by required conditions
Server CI / Elasticsearch v8 Compatibility (push) Blocked by required conditions
Server CI / OpenSearch v2 Compatibility (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 0) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 1) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 2) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 3) (push) Blocked by required conditions
Server CI / Merge Postgres FIPS Test Results (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Tools CI / check-style (mattermost-govet) (push) Waiting to run
Tools CI / Test (mattermost-govet) (push) Waiting to run
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-external-links (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
YAML Lint / yamllint (push) Waiting to run
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / Check go fix (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres (shard 0) (push) Blocked by required conditions
Server CI / Postgres (shard 1) (push) Blocked by required conditions
Server CI / Postgres (shard 2) (push) Blocked by required conditions
Server CI / Postgres (shard 3) (push) Blocked by required conditions
Server CI / Merge Postgres Test Results (push) Blocked by required conditions
Server CI / Elasticsearch v8 Compatibility (push) Blocked by required conditions
Server CI / OpenSearch v2 Compatibility (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 0) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 1) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 2) (push) Blocked by required conditions
Server CI / Postgres FIPS (shard 3) (push) Blocked by required conditions
Server CI / Merge Postgres FIPS Test Results (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Tools CI / check-style (mattermost-govet) (push) Waiting to run
Tools CI / Test (mattermost-govet) (push) Waiting to run
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-external-links (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
YAML Lint / yamllint (push) Waiting to run
This commit is contained in:
parent
508f1551e3
commit
cfafefe58c
2 changed files with 32 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import {act} from '@testing-library/react';
|
||||
import {createMemoryHistory} from 'history';
|
||||
import React from 'react';
|
||||
|
||||
import type {Post} from '@mattermost/types/posts';
|
||||
|
|
@ -431,6 +432,32 @@ describe('components/post_view/data_spillage_report/DataSpillageReport', () => {
|
|||
expect(screen.queryByTestId('data-spillage-action-keep-message')).toBeVisible();
|
||||
});
|
||||
|
||||
it('should render in short mode in the global threads view even when isRHS is true', async () => {
|
||||
const history = createMemoryHistory({initialEntries: ['/myteam/threads/abcdefghijklmnopqrstuvwxyz']});
|
||||
|
||||
renderWithContext(
|
||||
<DataSpillageReport
|
||||
post={post}
|
||||
isRHS={true}
|
||||
/>,
|
||||
baseState,
|
||||
{history},
|
||||
);
|
||||
|
||||
await act(async () => {});
|
||||
|
||||
const card = screen.getByTestId('data-spillage-report');
|
||||
expect(card).toHaveClass('mode_short');
|
||||
expect(card).not.toHaveClass('mode_full');
|
||||
|
||||
// short mode renders only the short field set
|
||||
expect(screen.queryAllByTestId('property-card-row')).toHaveLength(4);
|
||||
|
||||
// action rows are gated on mode === 'full', so they must not render here
|
||||
expect(screen.queryByTestId('data-spillage-action')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('data-spillage-action-download-report')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe.each([
|
||||
['Pending', true],
|
||||
['Retained', false],
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import React, {useMemo} from 'react';
|
||||
import {FormattedMessage, useIntl} from 'react-intl';
|
||||
import {matchPath, useLocation} from 'react-router-dom';
|
||||
|
||||
import {ContentFlaggingStatus} from '@mattermost/types/content_flagging';
|
||||
import type {Post} from '@mattermost/types/posts';
|
||||
|
|
@ -60,6 +61,9 @@ type Props = {
|
|||
|
||||
export function DataSpillageReport({post, isRHS}: Props) {
|
||||
const {formatMessage} = useIntl();
|
||||
const {pathname} = useLocation();
|
||||
|
||||
const inGlobalThreadsView = matchPath(pathname, {path: '/:team/threads/:threadIdentifier?'}) != null;
|
||||
|
||||
const reportedPostId = post.props.reported_post_id as string;
|
||||
|
||||
|
|
@ -108,7 +112,7 @@ export function DataSpillageReport({post, isRHS}: Props) {
|
|||
user: (<AtMention mentionName={reportingUser?.username || ''}/>),
|
||||
});
|
||||
|
||||
const mode = isRHS ? 'full' : 'short';
|
||||
const mode = (isRHS && !inGlobalThreadsView) ? 'full' : 'short';
|
||||
|
||||
const metadata = useMemo<PropertiesCardViewMetadata>(() => {
|
||||
const fieldMetadata: PropertiesCardViewMetadata = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue