WIP: Channel Sync feature #2

Draft
Ben wants to merge 8 commits from feat/channel-sync into master
Owner

WIP - Channel Sync

Work in progress. Do not merge yet.

Commits

  • Channel sync feature and layout endpoint
  • Comprehensive test suite and security tests
  • Test fixes and status override improvements
## WIP - Channel Sync Work in progress. Do not merge yet. ### Commits - Channel sync feature and layout endpoint - Comprehensive test suite and security tests - Test fixes and status override improvements
Add extensive tests covering all layers of the ChannelSync plugin feature:

Server-side tests:
- Model tests: validation, JSON serialization, helper methods
- Store tests: CRUD operations, dismissals, database constraints
- App layer tests: business logic, user exclusion, channel filtering
- API security tests: permission checks, authorization, input validation,
  team isolation, data leakage prevention, user exclusion enforcement

Webapp tests:
- Reducer tests: state updates, immutability, action handling
- Selector tests: state extraction, filtering, computed values
- Action/thunk tests: async operations, error handling, API calls

Security testing coverage:
- Permission boundary testing (ViewTeam, ManageTeam, ManageSystem)
- Channel access control (private channel visibility)
- User exclusion enforcement (server-side and client-side)
- Team isolation (no cross-team data access)
- Data leakage prevention (users only see channels they have access to)
- Input validation (layout validation, category constraints)
- Authorization bypass prevention

Test files created:
- server/public/model/channel_sync_test.go
- server/channels/store/storetest/channel_sync.go
- server/channels/store/sqlstore/channel_sync_store_test.go
- server/channels/app/channel_sync_test.go
- server/channels/api4/channel_sync_test.go
- webapp/channels/src/tests/mattermost_extended/channel_sync/reducers.test.ts
- webapp/channels/src/tests/mattermost_extended/channel_sync/selectors.test.ts
- webapp/channels/src/tests/mattermost_extended/channel_sync/actions.test.ts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Cover authorization bypass attempts, resource limits, data isolation,
cross-user/cross-team boundaries, and config exposure edge cases.
The save layout endpoint is registered as PUT, not POST.
Using POST caused 404 "not found handler" from gorilla mux.
- Remove StatusPauseAllowedUsers/InvisibilityAllowedUsers from client config
  (sensitive user lists should not be exposed to all authenticated users)
- Add feature flag check to GetSyncedCategoriesForUser (return ShouldSync=false
  when ChannelSync is disabled)
- Fix test for invalid team ID to use invalid ID in URL path, not body
- Fix test for non-existent team to test permission denial correctly
- Remove TearDown() calls from app/channel_sync_test.go (uses t.Cleanup)
Regular user permission test should use BasicTeam where BasicUser is a
member but not admin, matching the pattern used by existing tests.
- Add teamRoute() and apiBaseRoute() test helpers (Client4 methods are unexported)
- Fix all channel_sync test files using non-existent GetTeamRoute/GetBaseRoute
- Fix UpdateActivityFromHeartbeat to ignore Manual flag with AccurateStatuses
  (matching the transition manager fix from b479b701fa)
- Remove TearDown() calls (api4 TestHelper uses t.Cleanup() automatically)
- Fix LinkUserToTeam() calls to include testing.TB parameter
- Fix StatusTransitionManager to clear Manual flag on automatic transitions
- UpdateActivityFromManualAction now overrides manual Away/Offline to
  Online when user performs direct actions (send message, switch channel).
  Previously the !status.Manual check prevented this, but manual actions
  prove the user is actively engaged. DND and Out of Office still protected.

- channel_sync/actions.test.ts: mock posts selectors to break circular
  dependency chain (utils/constants -> post_list -> posts -> roles_helpers)

- guilded_layout_status.test.tsx: add useLocation to react-router-dom mock
  since DMListPage component uses it at line 80
Ben force-pushed feat/channel-sync from af369202ac to f9016f4132
Some checks failed
Tests / Go Tests (pull_request) Failing after 1s
Tests / Webapp Tests (pull_request) Failing after 11m41s
Tests / Test Summary (pull_request) Failing after 16s
2026-02-14 17:30:39 +00:00
Compare
Some checks failed
Tests / Go Tests (pull_request) Failing after 1s
Tests / Webapp Tests (pull_request) Failing after 11m41s
Tests / Test Summary (pull_request) Failing after 16s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/channel-sync:feat/channel-sync
git switch feat/channel-sync

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff feat/channel-sync
git switch feat/channel-sync
git rebase master
git switch master
git merge --ff-only feat/channel-sync
git switch feat/channel-sync
git rebase master
git switch master
git merge --no-ff feat/channel-sync
git switch master
git merge --squash feat/channel-sync
git switch master
git merge --ff-only feat/channel-sync
git switch master
git merge feat/channel-sync
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Ben/mattermost-extended!2
No description provided.