mattermost/webapp/CLAUDE.OPTIONAL.md
Maria A Nunez f1b9aa052e
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-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 with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (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
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (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
Rename Content Flagging to Data Spillage Handling (#35407)
* Rename Content Flagging to Data Spillage Handling

Update all user-facing text to use "Data Spillage Handling" and
"Quarantine for Review" terminology. Rename i18n keys that referenced
content flagging. Auto-patch bot display name on pre-existing servers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fixed searchable stringgs

* Revert unintended package-lock.json changes

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix i18n extract check: correct typo and key ordering

Fix "posed" -> "posted" typo in keep/remove quarantine modal
defaultMessages. Move admin.contentFlagging.title to correct
alphabetical position in en.json.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix webapp tests for Data Spillage Handling rename

Update test assertions to match renamed i18n strings:
notification settings, content reviewers, and additional
settings tests now expect the new quarantine terminology.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Use translatable i18n strings for notification messages

Replace hardcoded "flagged for review" notification templates with
i18n.T() calls using "quarantined for review" terminology. Add six
new server i18n keys for author, reporter, and reviewer notifications.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix server i18n key mismatches and update test assertions

Rename remaining app.content_flagging.* keys to app.data_spillage.*
in server/i18n/en.json to match Go code references. Fix the
quarantine_post_confirmation key name. Update test assertions to
match new "quarantined for review" terminology.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix gofmt formatting in content_flagging.go

Co-authored-by: Cursor <cursoragent@cursor.com>

* Prevent nil bot on PatchBot failure in getContentReviewBot

Use a separate variable for PatchBot result so the original bot
is preserved if the display name update fails.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Reorder server i18n keys after extract

Run mmgotool i18n extract to sort entries into correct
alphabetical order.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Replace i18n.T() with fmt.Sprintf for notification messages and fix test assertions

Use direct string formatting for bot notification messages instead of
i18n translation keys, which were being removed by mmgotool i18n extract
due to indirect key references. Also update test expectations for renamed
error keys (content_flagging -> data_spillage).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Update default quarantine reasons to DISC-aligned terminology

Replace generic content moderation reasons with defense/intelligence
sector terminology: Classification mismatch, Need-to-know violation,
PII exposure, OPSEC concern, CUI violation, Unauthorized disclosure,
and Other. Updated across model, API tests, webapp tests, and e2e tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Adding a string missing from bad merge

* Update remaining flagged terminology and icon for data spillage rename

- Change post menu icon from flag-outline to alert-outline
- Update reviewer notification: "quarantined" -> "submitted" a message
- Update action notifications: "flagged message" -> "quarantined message"
- Update modal errors: "flagging" -> "quarantining" this message
- Update report title: "flagged" -> "submitted" a message for review
- Update e2e page object locator for renamed menu item

Made-with: Cursor

* Fix tests

* Fix quarantine icon alignment in post dot menu

Use AlertOutlineIcon React component with size={18} instead of raw
<i> tag to match the sizing of all other menu item icons.

Made-with: Cursor

* Fixed E2E tests

* Missing test fix

* Fix E2E tests

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-03-06 21:15:01 -05:00

5.4 KiB
Raw Permalink Blame History

CLAUDE.md

Guidance for Claude Code when working inside webapp/.

Project Overview

This is the Mattermost web app codebase, a React-based frontend application for the Mattermost collaboration platform. The repository is structured as an npm workspace monorepo with multiple packages, with the main application code in the channels package and shared platform code in platform/* packages.

  • Primary workspace: channels/ (UI, Redux, routing).
  • Shared packages: platform/*.
  • Scripts: webapp/scripts/ power dev server, builds, and localization flows.
  • Coding Standards: Read webapp/STYLE_GUIDE.md for canonical standards; nested CLAUDE.md files cover directory-specific rules.

Core Commands

Task Command
Install deps npm install (includes postinstall build of platform packages)
Dev server (prod build watch) make run
Dev server (webpack-dev-server) make dev or npm run dev-server --workspace=channels
Build all workspaces make dist or npm run build
Build Channels only npm run build --workspace=channels
Tests make test or npm run test --workspace=channels (use test:watch, test:updatesnapshot as needed)
Lint / Style make check-style, make fix-style, npm run check --workspace=channels, npm run fix --workspace=channels
Type check make check-types
Clean artifacts make clean or npm run clean --workspaces --if-present

Top-Level Directory Map

  • channels/ Channels workspace. See channels/CLAUDE.md.
    • src/ App source with further scoped guides (components, actions, selectors, reducers, store, sass, i18n, tests, utils, types, plugins, packages/mattermost-redux).
  • platform/ Shared packages (client, components, types, eslint-plugin). See platform/CLAUDE.md plus sub-guides.
  • scripts/ Build/dev automation. See scripts/CLAUDE.md.
  • STYLE_GUIDE.md Authoritative style + accessibility + testing reference.
  • README.md, config.mk, Makefile onboarding, env config, and command wiring.

Workspace Architecture

This repository uses npm workspaces:

  • channels (channels/): Main Mattermost web app containing all UI components, Redux logic, and application code
  • @mattermost/types (platform/types/): TypeScript type definitions
  • @mattermost/client (platform/client/): REST and WebSocket client for the Mattermost API
  • @mattermost/components (platform/components/): Shared React components
  • @mattermost/eslint-plugin (platform/eslint-plugin/): Custom ESLint rules

Importing Packages

Always import packages using their full name, never relative paths:

// Correct
import {Client4} from '@mattermost/client';
import {UserProfile} from '@mattermost/types/users';
import {getUser} from 'mattermost-redux/selectors/entities/users';

// Incorrect
import Client4 from '../platform/client/src/client4.ts';

Key Dependencies

  • React 18.2: Main UI framework
  • Redux 5.0: State management
  • React Router 5.3: Client-side routing
  • React Intl: Internationalization
  • Floating UI: Tooltips and popovers (prefer WithTooltip component)
  • @mattermost/compass-icons: Icon library (prefer over font-awesome)
  • Monaco Editor: Code editor integration
  • Styled Components: Limited use (for MUI and some legacy components)

Important Configuration Files

  • channels/webpack.config.js: Webpack configuration with module federation
  • channels/jest.config.js: Jest test configuration
  • channels/tsconfig.json: TypeScript configuration with workspace references
  • channels/.eslintrc.json: ESLint configuration

Cross-Cutting Standards & Common Gotchas

  • Functional Components: Prefer functional React components with hooks; memoize expensive logic.
  • Data Access: Client4/WebSocket access happens via Redux actions only—never directly from components.
  • Internationalization: All UI strings must be translatable via React Intl. Use FormattedMessage unless a raw string is required. When adding or modifying a new translatable string, add or modify ONLY the English main file en.json. DO NOT update the other languages.
  • Styling: Uses SCSS + CSS variables with BEM naming; avoid !important unless migrating legacy code.
  • Testing: RTL + userEvent for tests; no snapshots. Use helpers under channels/src/tests/.
  • Accessibility: Follow guidance in STYLE_GUIDE.md (semantic elements, keyboard support, focus management).
  • Platform Packages: Rebuild automatically on npm install; re-run if types appear stale.
  • Adding Dependencies: Always add dependencies with npm add <pkg> --workspace=channels (or the relevant workspace).
  • Redux State Split: state.entities.* (server data via mattermost-redux) vs state.views.* (UI/persisted). Store new server entities in mattermost-redux first.
  • Client4 Returns: Methods return {response, headers, data} unwrap accordingly in actions.

Nested CLAUDE Files

  • Channels workspace: channels/CLAUDE.md, channels/src/CLAUDE.md.
  • Channels source subfolders: components/, actions/, selectors/, reducers/, store/, sass/, i18n/, tests/, utils/, types/, plugins/, packages/mattermost-redux/.
  • Platform packages: platform/CLAUDE.md, plus platform/client/, platform/components/, platform/types/.
  • Tooling: scripts/CLAUDE.md.

Use these nested guides for focused, actionable instructions when working within each directory.