Commit Graph
3013 Commits
Author SHA1 Message Date
a9e574a826 MM-68547: Tighten authorization on group syncable link and patch endpoints (#36316) (#36423)
* MM-68547: Tighten authorization on group syncable link and patch endpoints

Adds an additional permission check on the group syncable link and patch
endpoints. Callers must hold the role-management permission for the
target team or channel (or the sysconsole groups-management permission).

Made-with: Cursor

* Linting

* MM-68547: Extend group syncable scheme_admin authorization checks

Gate any explicit scheme_admin value (in either direction) on link and
patch. Populate SchemeAdmin in the singular getGroupSyncable so that
patches that do not touch scheme_admin no longer overwrite the persisted
value. Restrict PermittedSyncableAdmins to active syncables. Start the
link upsert from the existing active row to preserve fields the caller
did not, or could not, set.

Made-with: Cursor

* MM-68547: Add store-layer regression coverage for SchemeAdmin handling

Extend testGetGroupSyncable to round-trip SchemeAdmin: true through
UpdateGroupSyncable and re-fetch, locking in that getGroupSyncable
populates the field from the persisted row.

Strengthen groupTestPermittedSyncableAdmins{Team,Channel} to assert
that DeleteGroupSyncable preserves SchemeAdmin in the persisted row
and that PermittedSyncableAdmins still excludes the row, making the
coupling between the two store changes explicit.

Made-with: Cursor

* MM-68547: Fix group details role-change dedup on remove

The roleChangeKey helper was reading team_id/channel_id from the items
in itemsToRemove, but onRemoveTeamOrChannel pushes those items with a
generic id field. The deletion of the staged role change in
handleRemovedTeamsAndChannels therefore never matched the key produced
by onChangeRoles, and a stale patchGroupSyncable was dispatched after
the unlink.

Accept either id or team_id/channel_id when computing the key. Also
extend the e2e assertion to verify the channel removal took effect
(delete_at != 0) alongside the existing scheme_admin check.

Made-with: Cursor

* MM-68547: Mirror delete_at assertion on the removed-team e2e test

The team variant of "does not update the role of a removed X" was left
asserting only on scheme_admin. Add the matching delete_at != 0 check
already present in the channel variant so both tests verify the same
user-visible contract.

Made-with: Cursor

* Skip SyncSyncableRoles if no scheme_admin

(cherry picked from commit 8c72083414)

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2026-05-05 14:13:45 -04:00
a30c335864 Update Agents plugin FIPS version to v2.0.3 (#36417) (#36420)
Automatic Merge

(cherry picked from commit 9bbe9ea6e6)

Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
2026-05-05 16:44:34 +02:00
Mattermost BuildandGitHub 56ffaa0201 Prepackage mattermost-plugin-agents v2.0.3 (#36401) (#36403)
Automatic Merge
2026-05-05 08:53:37 +02:00
Alejandro García MontoroandGitHub 7aef5a717a Update Agents plugin FIPS version to v2.0.2 (#36389) (#36393)
Automatic Merge
2026-05-04 17:55:20 +02:00
Alejandro García MontoroandGitHub b7019d1359 MM-67931: Prepackage the FIPS flavour of Playbooks v2.8.1 (#36387)
Automatic Merge
2026-05-04 12:47:39 +02:00
Mattermost BuildandGitHub f0a390b96e [MM-68393] Tighten protected role patch authorization (#36197) (#36377)
Automatic Merge
2026-05-04 08:47:38 +02:00
Mattermost BuildandGitHub 479fc42d0e MM-68382: Align team creation invite permission checks (#36188) (#36375)
Automatic Merge
2026-05-04 08:17:38 +02:00
Mattermost BuildandGitHub eb4399cbc7 [MM-67867] Update Playbooks plugin to v2.8.1 (#36361) (#36378)
Automatic Merge
2026-05-04 07:47:39 +02:00
9f382a5eaf Prepackage Agents plugin v2.0.2 (#36349) (#36354)
Update non-FIPS PLUGIN_PACKAGES entry to mattermost-plugin-agents-v2.0.2
(https://github.com/mattermost/mattermost-plugin-agents/releases/tag/v2.0.2).

FIPS prepackage is unchanged; v2.0.2 FIPS artifacts are not published yet.

Made-with: Cursor
(cherry picked from commit 082f6ba85a)

Co-authored-by: Nick Misasi <nick.misasi@mattermost.com>
2026-05-04 08:32:18 +03:00
4db0023a04 Cherry pick of: Update go version to 1.25.9 (#36357) (#36358)
(cherry picked from commit 035c3ba4b9)

Co-authored-by: Christopher Poile <cpoile@gmail.com>
2026-05-01 13:04:16 -04:00
fd7716a25c Cherry pick of #36348 update buildserver go base image versions to 1.25.9 (#36359)
Made-with: Cursor
(cherry picked from commit 1ead9ff038)

Co-authored-by: Eva Sarafianou <eva.sarafianou@gmail.com>
2026-05-01 16:06:12 +00:00
db9d6929e1 Update Agents plugin FIPS version to v2.0.0 (#36344) (#36347)
Automatic Merge

(cherry picked from commit 8d7507b1eb)

Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
2026-05-01 17:03:43 +02:00
Devin BinnieGitHubcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
d0c2842145 [MM-68608] Feature flag Managed Categories (#36345)
* [MM-68608] Feature flag Managed Categories

* Update server/channels/api4/channel_test.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix i18n

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-30 16:45:59 +00:00
Mattermost BuildandGitHub a0947f9201 Update Agents plugin to v2.0.0 (#36336) (#36337)
Automatic Merge
2026-04-30 14:47:40 +02:00
Mattermost BuildandGitHub 5e5eed3be1 MM-68499 - auto run sync jobs on team admin abac policy creation (#36276) (#36335)
Automatic Merge
2026-04-30 12:47:39 +02:00
Mattermost BuildandGitHub 3cb5870a2a [MM-68538] Wrap incoming query from the CEL -> SQL conversion with parentheses (#36293) (#36326)
Automatic Merge
2026-04-29 17:47:41 +02:00
Ibrahim Serdar AcikgozandGitHub f21e30c8d0 [MM-68535] Invalidate channel cache after policy assignment (#36292) (#36323)
Automatic Merge
2026-04-29 12:17:40 +02:00
Mattermost BuildandGitHub cad3e8e51a MM-68526: Harden remote cluster patch response (#36288) (#36306)
Automatic Merge
2026-04-28 18:47:39 +02:00
Mattermost BuildandGitHub f706d1f01e MM-68264: return error on bot username conflict (#36064) (#36305)
Automatic Merge
2026-04-28 18:17:39 +02:00
fd2eeace0f MM-68378: Fix empty error fields and spurious failures for OS/ES bulk deletes (#36264) (#36285)
* omit error_* fields if empty, add status code

* MM-68378: Add tests for 404-delete semantics in ES/OS indexing jobs

* MM-68378: Fix empty error fields and spurious failures for OS/ES bulk deletes

- Log resp.Status unconditionally in OnFailure so status-only failures
  (resp.Error nil, err nil) are always identifiable
- Downgrade per-item OnFailure log from Error to Warn; the job-level
  Error log already captures the aggregate failure
- Track real failures in a separate atomic counter shared between the
  OnFailure callback and the close closure; 404 deletes (document not
  found) are silently skipped and not counted
- Report num_failed from the real counter in close stats; retain
  stats_num_failed as the raw SDK count for reference

(cherry picked from commit 291c7cd081)

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2026-04-27 13:00:53 -03:00
Miguel de la CruzGitHubMiguel de la Cruzcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1b018ea016 Remove unused property fields index (#36279) (#36281)
* Remove unused property fields index

* Update server/channels/db/migrations/migrations.list



---------

Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-27 15:24:59 +02:00
beb5258fe8 Fix FIPS test failures by using model.NewTestPassword() for short passwords (#36262) (#36266)
(cherry picked from commit 1ed4d0215a)

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2026-04-24 19:05:40 +00:00
1409ed95ac Automated cherry pick of #36249 (#36259)
* Skip sqlstore DB setup during go test -list discovery (#36249)

sqlstore's TestMain calls sqlstore.InitTest (which opens postgres and
drops tables) before mainHelper.Main, so the -test.list bailout added
in #36222 never fired and shard-split discovery failed on the GitHub
host. Bail out at the top of TestMain instead, and restore HEAVY_MS
so sqlstore can still be treated as whole.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
(cherry picked from commit 6ce4db65dc)

* Revert test fix that is not needed on the v11.7 release branch

---------

Co-authored-by: David Krauser <david@krauser.org>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:34:46 +03:00
Jesse HallamandGitHub fc16aa08ca Cherry pick of #36214 on release-11.7 (#36234)
Automatic Merge
2026-04-24 10:47:43 +02:00
Mattermost BuildandGitHub a0056ed68d MM-68439 Centralize filename handling for FileInfo (#36223) (#36251)
Automatic Merge
2026-04-24 09:17:39 +02:00
27f65e1491 Cherry-pick #36222 to release-11.7 (#36237)
* Fix silent test discovery failure in sharded CI (#36222)

* Raise shard-split HEAVY_MS above sqlstore timing (#36233)

Made-with: Cursor
(cherry picked from commit 795672f077)

---------

Co-authored-by: David Krauser <david@krauser.org>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2026-04-23 11:36:51 -04:00
6eb222aa17 Update Agents plugin to v2.0.0-rc5 (#36207) (#36210)
* Update Agents plugin to v2.0.0-rc4

* Update Agents plugin to v2.0.0-rc5

(cherry picked from commit 863d581f98)

Co-authored-by: Christopher Speller <crspeller@gmail.com>
2026-04-22 12:21:23 +00:00
Mattermost BuildandGitHub a2e862b2a9 MM-68378: Fix silent bulk failures in OpenSearch/Elasticsearch indexers (#36189) (#36196)
Automatic Merge
2026-04-21 16:12:10 +02:00
Mattermost BuildandGitHub 5b3609b682 [MM-68237] Unshare channels when remote is removed (#35997) (#36195)
Automatic Merge
2026-04-21 14:42:10 +02:00
Mattermost BuildandGitHub 07f64ba0d8 Bump Boards FIPS version to v9.2.4 (#36165) (#36167)
Automatic Merge
2026-04-17 18:12:10 +02:00
f2a6377f5e MM-68356 - ensure files are stripped when session is nil for fail-secure handling (#36145) (#36154)
* MM-68356 - ensure files are stripped when session is nil for fail-secure handling

* Add test for file stripping in permalink preview when session is nil

(cherry picked from commit 983ea5a49f)

Co-authored-by: Pablo Vélez <pablovv2012@gmail.com>
2026-04-17 08:58:42 +03:00
05cc28e6b2 Update Agents plugin to v2.0.0-rc3 (#36157) (#36161)
(cherry picked from commit 41e59bf1d5)

Co-authored-by: Christopher Speller <crspeller@gmail.com>
2026-04-17 08:37:01 +03:00
Mattermost BuildandGitHub 2ae6d0ea63 Update en.json (#36139) (#36147)
Automatic Merge
2026-04-16 19:12:11 +02:00
Mattermost BuildandGitHub d9dff29f9e MM-68352 - update permission policy ff correctly checks in tests (#36142) (#36144)
Automatic Merge
2026-04-16 17:12:12 +02:00
b57f5c3d47 MM-68274 - Adding watermarking toggle in server (#36025) (#36141)
* Adding watermarking toggle in server

* Update setting to enterprise

* Adding it to mobile security

* Updating experimental section

* Moved back to experimental settings. Added license checks

* Updating tests

---------


(cherry picked from commit d2848a893a)

Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com>
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
2026-04-16 17:52:30 +05:00
beb96185cd [MM-68183] Permission policies (#36003)
---------

Co-authored-by: Pablo Vélez <pablovv2012@gmail.com>
2026-04-16 04:02:12 +03:00
80b977807a Feature mm 64509 team admin abac channels (#36061)
* MM-67592 - be changes for team admin abac channels (#35353)

* MM-67592 - be changes for team admin abac channels

* Revert team-scoped API routes, keep app layer business logic

* move from config to permission; Add cluster-aware LRU cache for policy team scope lookup

* remove unnecessary references to config value

* local/remote cache invalidation consistency for policy scope

* Replace policy scope cache with store-level team scope query

* rename functions and add comments to query

---------

Co-authored-by: Mattermost Build <build@mattermost.com>

* MM 67594 - policies CUD operations to team settings modal channels ABAC (#35590)

* MM-67592 - be changes for team admin abac channels

* Revert team-scoped API routes, keep app layer business logic

* move from config to permission; Add cluster-aware LRU cache for policy team scope lookup

* remove unnecessary references to config value

* local/remote cache invalidation consistency for policy scope

* Replace policy scope cache with store-level team scope query

* format files correctly

* fix mock expectations for store-query approach in tests

* rename functions and add comments to query

* revert error ids to original to prevent break tests

* adjust translations

* MM-67669 - add tab to team settings modal and basic listing

* adjust tests and fix linter

* use existing search api logic

* fix style and adjust flaky test to clean up and restore orinals

* address ai corabbit feedback and fix linter

* fix unit tests

* MM-67592 - be changes for team admin abac channels (#35353)

* MM-67592 - be changes for team admin abac channels

* fix linter

* fix ts linter for playwright

* Revert team-scoped API routes, keep app layer business logic

* move from config to permission; Add cluster-aware LRU cache for policy team scope lookup

* remove unnecessary references to config value

* local/remote cache invalidation consistency for policy scope

* Replace policy scope cache with store-level team scope query

* format files correctly

* fix mock expectations for store-query approach in tests

* rename functions and add comments to query

* revert error ids to original to prevent break tests

* adjust translations

---------

Co-authored-by: Mattermost Build <build@mattermost.com>

* MM-67594 - support cud operations for team abac BE changes

* create the team settings policy edit section, reuse most components, add basic e2e

* move optional refresh policy list button to list component

* temp get team admins cud policies and sync job

* enhance validation and adjust e2e

* Fix testExpression permission; fix pagination of team policies; add isValidId validation

* adjust styles, handling renaming and add permission migrations

* update the permissions names, use the simple confirmation modal, define the delete modal

* fix policy deletion flow

* fix some linter issues and adjust helper tests

* remove delete from list and fix e2e

* code comments clean up

* remove CEL editor for now, clean styles, enhance e2e

* fix linter, adjust unit test

* fix linter and add missing translation

* fix policy deletion ownership and sanitize test expression

* fixed e2e tests

* rollback orphaned policy on failed channel assignment

* enforce channelless check before last_team_id fallback

* enforce channelless guard on assign fallback too

* add translations missing

* add teamId to audit payload when present

* fix refresh button pagination reset

* fix null safety in channel selector loadChannels

* use responsive width cap for team settings modal and adjust header size

* remove redundant raw term from channel search URL, add showRefreshButton prop to PolicyList component

* handle error when stamping last team ID on channelless policy

* replace Props-based ownership with in-memory LRU cache, disable save on zero channels

* make e2e tests more reliable in CI

* test skip if no license valid found

* add childCount guard to cache-hit paths and reduce TTL to 5s

* fix e2e, adjust translation

* address review feedback: flatten permission checks and separate error types

- Flatten nested permission branching in deleteAccessControlPolicy using
  early returns to reduce indentation (review: isacikgoz)
- Validate teamID as input (400) before using it for permission checks (403)
  in testExpression and validateExpressionAgainstRequester handlers
- Remove redundant hasSystemPermission check in searchAccessControlPolicies
  since system_admin role already includes manage_team_access_rules
- Refactor ValidateTeamAdminPolicyOwnership to return (bool, *model.AppError)
  separating "not owned" from "internal error" across all 8 call sites
- Update tests to assert on both return values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* add persistent team scope to access control policies, replace in-memory cache

* fix translation

* fix case-insensitive policy search and sanitize search term input

* make policies tests have a unique name

* decouple scope/scopeID filter from TeamID in policy store

* Fix authZ bypass searchChannelsForAccessControlPolicy by forcing TeamIds to authorized team

* show unsaved changes on navigator back, and list all private channels on load

* filter already applied channels to a policy

* adjust the styles to dark mode; do not show added channels to the policy in the add channels modal

* fix linter

* MM-67967 add sync status footer to team settings (#35729)

* MM-67967 add sync status footer to team settings

* remove magic numbers and strings and polish the code

* fix linter

* fix linter: replace interface{} with any per gofmt rewrite rule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refine getJobsByType team-scoped filtering and permissions

* fix sync footer stuck in syncing state on job creation error

* fix team-scoped job pagination in getJobsByType

* Fix authZ bypass searchChannelsForAccessControlPolicy by forcing TeamIds to authorized team

* implement ux feedback, change titles font, fix marging and scroll view jump

* MM-68135 - migrate add channels to policy modal to generic modal (#35907)

* MM-67920 unify e2e team settings tests (#35867)

* MM-67920 - extract duplicated policy editor helpers

* remove duplicate team icon test file

* rename Access Control to Membership Policies in e2e

* replace networkidle with explicit element waits

* fix attribute loading issue

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix playwright feedback issues and persist filters to the store layer in the no systemconsole path

* Improve policy scope validation and team admin security checks

* Renamed public channels to "AAA Public Channel %03d" and private ones to "ZZZ Private..." so the 55 public channels now fill the 50-result cap

* fix e2e tests and add new unit tests to improve coverage

* Improve e2e test stability: race condition handling and timeout adjustments

* Improve team-scoped ABAC policies: scope preservation, input validation, shared exclusion

* Add comprehensive ABAC test coverage: team admin ops and security validation to reduce flakyness

* Fix team policy editor back button: preserve navigation intent through Undo

* style: format import statements for better readability

* Enhance access control policy creation for team admins: enforce scope stamping from query parameters to prevent unauthorized team assignments

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 00:48:43 +02:00
d4d65c8cfb Add manage_own_agent and manage_others_agent permissions (#35924)
* Add PermissionCreateAgent server-side permission definition

Define PermissionCreateAgent in the model layer with system scope,
add to SystemScopedPermissionsMinusSysconsole (feeds AllPermissions),
grant to system_user in MakeDefaultRoles(), and register a permissions
migration for existing installations (system_admin + system_user).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add exhaustive tests for PermissionCreateAgent permission

Model tests: verify create_agent is in AllPermissions, has system scope,
correct i18n fields, present in system_admin and system_user default roles,
and absent from system_guest.

Migration test: verify getAddCreateAgentPermissionMigration adds create_agent
to both system_admin and system_user, and is idempotent on re-run.

Also register the migration key in testlib mock store so server initialization
skips it during test setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add webapp permission constants and i18n for create_agent

Add CREATE_AGENT constant to permissions.ts, display strings with
defineMessages in permissions.tsx, and i18n entries in en.json so the
permission appears in System Console Permission Schemes UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Clean up tests and minor fixups for create_agent permission

Consolidate role_test.go into table-driven tests, remove redundant comments
in permissions_migrations_test.go, add .planning/ to .gitignore, and
refresh webapp/package-lock.json.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Split create_agent into manage_own_agent and manage_others_agent

Replace PermissionCreateAgent with system-scoped own/others permissions,
update migration and defaults, and wire System Scheme UI for integrations.

Made-with: Cursor

* fixes

* Stabilize autotranslation E2E by pinning mock source language

Set LibreTranslate mock to English before the pre-enable post and Spanish
before the post-enable message so parallel tests cannot leave the mock in
a state where the new message is not translated.

Made-with: Cursor

* Revert package-lock, add more chnages

* Revert "Revert package-lock, add more chnages"

This reverts commit 7f6752c2e0.

* Drop unrelated autotranslation E2E tweak; restore package-lock

The Playwright autotranslation change was not caused by MM-65671. Revert
that test edit and restore webapp/package-lock.json after an accidental
revert of the prior package-lock update.

Made-with: Cursor

* Put package-lock back again

* fixes

* Fix migration tests for manage_own_agent on system_user role

Made-with: Cursor

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-15 14:57:46 +00:00
Ibrahim Serdar AcikgozandGitHub c66bb0ecdb [MM-68109] Introduce new policy version v0.3 (#35904) 2026-04-15 11:22:41 +02:00
Doug LauderandGitHub 9fa8c8c0c8 Add bulk set (replace) channel memberships API endpoint (#36031)
* Add bulk set (replace) channel memberships API

  PUT /api/v4/channels/{channel_id}/members accepts a complete desired
  membership list and reconciles it against the current state, adding
  missing users and removing extras while leaving existing members
  untouched. Results stream back as NDJSON with configurable batch size
  and delay to manage server load. Sysadmin only. Private channels
  cannot be emptied entirely.
2026-04-15 01:41:33 -04:00
3cb00848a6 Add COALESCE guard for property values before PSAv2 migrations (#36079)
Rows created before the CreatedBy/UpdatedBy columns were added have NULL
in those fields, causing a scan error when reading them. Wraps those
columns with COALESCE(..., '') in the tableSelectQuery and in the Upsert
RETURNING clause.

Also removes the propertyValueColumns shared variable, inlining the
column lists directly in each INSERT statement to match the pattern used
in the property field store.

Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
2026-04-14 20:46:11 +00:00
Christopher SpellerandGitHub 0f2c16754f Add pluggable AI actions menu with custom prompts extension point (#35930)
* Add pluggable AI actions menu with rewrite submenu and plugin extension point

* Use cascading hover popover for AI actions submenus

* Fix lint errors in AI actions menu and related files

* Update i18n strings for AI actions menu

* Fix coding guideline violations in AI actions menu and tests

* Fix spacing

* Fix stylelint errors in use_rewrite.scss

* Support ReactNode for AI action menu item text

* Fix empty menu guard, keyboard a11y, and rewrite follow-up placeholder

* Hide rewrite actions while a rewrite is in progress

* Remove subMenuHeader from plugin API and pass isRHS context to plugin components

* Support simple click actions in AI action menu plugin API

* Fix import order in ai_actions_menu tests

* Flip AI actions submenu to open left when insufficient space on right

Adapts the viewport-aware positioning pattern from the existing SubMenu
component so the cascading submenu renders on the side with more space.

* Only flip submenu to left when right space is insufficient
2026-04-14 18:46:20 +00:00
Doug LauderandGitHub c3ab0f7f78 MM-68191: Add plugin Receive APIs for shared channel sync (#35962)
* Add plugin APIs for plugin to sync data into shared channels
2026-04-14 14:31:25 -04:00
fff3820ce4 fix(ci): restore testname format in sharded gotestsum runs (#36078)
run-shard-tests.sh called gotestsum directly without --format, so it
fell back to gotestsum's default (pkgname) instead of the testname
format set by the Makefile. Pass --format "${GOTESTSUM_FORMAT:-testname}"
to match the Makefile default.

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-14 15:13:39 -03:00
JG HeithcockandGitHub 88954db3de [MM-63434] Use forked PDF library with parsing depth limit (#35947)
* [MM-63434] Use forked PDF library with parsing depth limit

Replace github.com/ledongthuc/pdf with a fork that limits object
nesting depth during parsing. Add test coverage.

* Reverting incorrect merge that lost the change to msgpack

The error was in merge https://github.com/mattermost/mattermost/commit/64bdff88d853e030d6e0f243cf21370a78dde6ae
2026-04-14 10:28:59 -07:00
Jesse HallamandGitHub 2b2ae4778f test: clean up channel store data after TestChannelStore (#36066)
TestChannelStore sub-tests create channels, members, and team members
using fake TeamIds and UserIds (model.NewId() for non-existent rows).
These records are left in the database and cause integrity tests
(TestCheck*) running in the same binary to fail their full-table scans.

Register a t.Cleanup on TestChannelStore that purges the affected
tables entirely. A blanket purge is safe: the schema enforces no FK
constraints, and every test suite creates its own data independently.
2026-04-14 16:22:44 +02:00
Devin BinnieGitHubcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>Matthew BirtchHarrison HealeyMattermost Buildcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
01219efbf4 [MM-68037] Managed Sidebar Categories (MVF) (#35935)
* [MM-68037] Managed Sidebar Categories (MVF)

* PR feedback

* PR feedback

* Fix test issue again

* Fixed a few things

* Fix again

* PR feedback

* Update server/i18n/en.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update server/i18n/en.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update webapp/channels/src/packages/mattermost-redux/src/actions/channel_categories.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* PR feedback

* PR feedback

* More PR feedback

* Test fixes

* This one too

* PR feedback

* more

* More feedback

* More

* more

* Yup

* More

* PR feedback

* Update webapp/channels/src/components/channel_settings_modal/managed_category_selector.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Block setting behind Enterprise license

* Update webapp/channels/src/packages/mattermost-redux/src/selectors/entities/channel_categories.ts

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>

* Update webapp/channels/src/packages/mattermost-redux/src/actions/channel_categories.ts

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>

* PR feedback

* Don't await for the initial managed category check

* Turn into its own action

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2026-04-14 09:00:59 -04:00
ed80e8ba91 Shared channel UI for channel admins (#35448)
* Shared channel UI for channel admins

* Fix lint

* Use errors.is instead of using string comparison

* Fix configuration check

* Handle error when sharing an already shared channel

* Remove unneeded disabled prop

* Add missing tests

* Frontend tweaks

* Fix lint

* Fix lint and test

* Address coderabbit review

* Fix removing unconfirmed remotes

* Better handle errors while saving state

* Remove unneeded state

* Fix selector not being stable between different renders

* Fix i18n and improve one type

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/share_channel_with_workspaces.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/add_workspace_dropdown.tsx

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/share_channel_with_workspaces.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/workspace_list.tsx

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/share_channel_with_workspaces.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/share_channel_with_workspaces.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Apply suggestions from code review

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Deal with settings option permissions

* Add message when no remotes are available

* Add dividers

* Add disabled tooltip

* Fix tests

* Fix lint

* Touch update at on share/unshare

* Fix tests

* Fix lint

* Add missing await

* Add e2e tests

* Fix playwright prettier

* Update server.prepare to have connected workspaces enabled by default

* Revert changes on server.prepare and try with changes on server.generate

* Fix shared channel configuration E2E tests (#35786)

* Update webapp/channels/src/components/channel_settings_modal/share_channel_with_workspaces/share_channel_with_workspaces.scss

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* Update initial enabled state to properly handle saves

* Update role name in e2e tests

---------

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: yasser khan <attitude3cena.yf@gmail.com>
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2026-04-14 11:37:09 +02:00
Alejandro García MontoroandGitHub e7b60bbd10 MM-67291: ES health metric (#35844)
* Add search engine health Prometheus metric

Expose mattermost_search_engine_status as a GaugeFunc that
returns 0 when ES/OS is configured but unreachable, and 1
otherwise. This lets SRE build Grafana alerts for the case
where the search backend silently falls back to database
search (as happened on Hub with a misconfigured OpenSearch).

The gauge reads the IsHealthy flag set by the engine watcher,
so it fires on the first health-check failure (~60 s) rather
than waiting for the engine to be fully stopped.

* Test the new search engine status gauge
2026-04-13 21:45:48 +00:00
161f0713a4 MM-66612: Add health flag to fast-fail when ES is offline (#35843)
* Add health flag to fast-fail when ES is offline

When Elasticsearch goes offline, the watcher takes up to 3 health
check cycles (~180 s) to detect the outage and stop the engine.
During that window every search query blocks for 30 s before
falling back to the database, and indexing goroutines pile up
unboundedly — causing server-wide slowness, posting failures,
and duplicate posts from client retries (MM-66612).

Introduce a `healthy` atomic flag on each ES/OpenSearch engine.
The watcher sets it to false on the *first* health-check failure
and back to true on success. `Broker.GetActiveEngines()` now
requires both `IsActive()` and `IsHealthy()`, so all search and
indexing operations skip the unhealthy engine immediately. The
existing 3-failure stop/restart cycle is unchanged and continues
to handle full recovery.

* Fix other tests

* Fix unrelated flaky test

* Use atomic.int32 everywhere

* Revert "Fix unrelated flaky test"

This reverts commit a289015637.

* Improve coverage for ActiveEngine/GetActiveEngines

* Document expectations on SearchEngineInterface

* Use mock.On("call").Unset

* Remove healthCalls to avoid a flaky test

* Be explicit on Unset

* Log any change in the health of the search engine

* Test the healthy<->unhealthy changes are logged

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-04-13 22:43:14 +02:00