2020-09-30 00:41:22 -04:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
|
|
package model
|
|
|
|
|
|
2021-04-27 11:58:38 -04:00
|
|
|
import (
|
|
|
|
|
"reflect"
|
|
|
|
|
"strconv"
|
|
|
|
|
)
|
2021-01-04 16:21:02 -05:00
|
|
|
|
2020-09-30 00:41:22 -04:00
|
|
|
type FeatureFlags struct {
|
|
|
|
|
// Exists only for unit and manual testing.
|
|
|
|
|
// When set to a value, will be returned by the ping endpoint.
|
|
|
|
|
TestFeature string
|
2020-12-01 10:27:05 -05:00
|
|
|
// Exists only for testing bool functionality. Boolean feature flags interpret "on" or "true" as true and
|
2020-11-25 10:27:06 -05:00
|
|
|
// all other values as false.
|
|
|
|
|
TestBoolFeature bool
|
2020-11-12 09:07:31 -05:00
|
|
|
|
2021-04-01 13:44:56 -04:00
|
|
|
// Enable the remote cluster service for shared channels.
|
|
|
|
|
EnableRemoteClusterService bool
|
|
|
|
|
|
2024-10-24 13:38:00 -04:00
|
|
|
// Enable DMs and GMs for shared channels.
|
|
|
|
|
EnableSharedChannelsDMs bool
|
|
|
|
|
|
2025-06-02 08:59:19 -04:00
|
|
|
// Enable plugins in shared channels.
|
|
|
|
|
EnableSharedChannelsPlugins bool
|
|
|
|
|
|
2025-06-15 04:07:56 -04:00
|
|
|
// Enable synchronization of channel members in shared channels
|
|
|
|
|
EnableSharedChannelsMemberSync bool
|
|
|
|
|
|
2025-06-13 10:51:12 -04:00
|
|
|
// Enable syncing all users for remote clusters in shared channels
|
|
|
|
|
EnableSyncAllUsersForRemoteCluster bool
|
|
|
|
|
|
2021-11-10 13:10:14 -05:00
|
|
|
// AppsEnabled toggles the Apps framework functionalities both in server and client side
|
2021-03-29 09:53:31 -04:00
|
|
|
AppsEnabled bool
|
|
|
|
|
|
2021-08-09 11:33:21 -04:00
|
|
|
PermalinkPreviews bool
|
|
|
|
|
|
2022-01-19 09:19:23 -05:00
|
|
|
NormalizeLdapDNs bool
|
2022-02-03 13:28:22 -05:00
|
|
|
|
2023-01-09 10:50:43 -05:00
|
|
|
// Enable WYSIWYG text editor
|
|
|
|
|
WysiwygEditor bool
|
|
|
|
|
|
2023-02-07 14:08:34 -05:00
|
|
|
OnboardingTourTips bool
|
2023-03-31 16:08:52 -04:00
|
|
|
|
2023-04-12 11:08:37 -04:00
|
|
|
DeprecateCloudFree bool
|
|
|
|
|
|
2023-07-19 16:01:39 -04:00
|
|
|
EnableExportDirectDownload bool
|
|
|
|
|
|
2023-12-11 15:27:34 -05:00
|
|
|
MoveThreadsEnabled bool
|
|
|
|
|
|
2023-08-25 15:39:25 -04:00
|
|
|
StreamlinedMarketplace bool
|
2023-10-23 10:12:46 -04:00
|
|
|
|
2023-11-14 09:12:04 -05:00
|
|
|
CloudIPFiltering bool
|
|
|
|
|
ConsumePostHook bool
|
2023-11-29 09:10:17 -05:00
|
|
|
|
2024-03-12 10:36:05 -04:00
|
|
|
CloudAnnualRenewals bool
|
2024-02-28 11:06:17 -05:00
|
|
|
CloudDedicatedExportUI bool
|
|
|
|
|
|
2024-03-12 10:36:05 -04:00
|
|
|
ChannelBookmarks bool
|
|
|
|
|
|
2024-02-22 10:55:34 -05:00
|
|
|
WebSocketEventScope bool
|
2024-04-18 10:30:08 -04:00
|
|
|
|
|
|
|
|
NotificationMonitoring bool
|
2024-05-06 09:46:16 -04:00
|
|
|
|
2024-05-07 13:36:07 -04:00
|
|
|
ExperimentalAuditSettingsSystemConsoleUI bool
|
2024-11-21 15:40:46 -05:00
|
|
|
|
2025-01-13 12:12:38 -05:00
|
|
|
CustomProfileAttributes bool
|
2025-05-15 05:33:08 -04:00
|
|
|
|
|
|
|
|
AttributeBasedAccessControl bool
|
2025-07-10 08:17:16 -04:00
|
|
|
|
|
|
|
|
ContentFlagging bool
|
Update Interactive Dialog to use AppsForm (#31821)
* Add AppsForm-based InteractiveDialog implementation with feature flag control
- Add InteractiveDialogAppsForm feature flag (default enabled) to control migration path
- Enhance AppsForm components with backwards compatibility features:
- Add onHide prop support for legacy dialog behavior
- Add RADIO field type support with proper rendering
- Add required field indicators with red asterisk styling
- Use FormattedMessage for "(optional)" text internationalization
- Create InteractiveDialogAdapter to bridge legacy dialogs to AppsForm:
- Convert DialogElement fields to AppField format with proper type mapping
- Handle default value conversion for select, radio, and boolean fields
- Implement submission adapter to convert between Apps and legacy formats
- Support cancel notifications and proper context creation
- Update InteractiveDialog container to route between implementations based on feature flag
- Add Redux selector for feature flag state management
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix circular dependency issue with dynamic InteractiveDialog import
Replace static import of InteractiveDialog in websocket_actions.jsx with
dynamic import to resolve circular dependency chain that was causing test
failures in unrelated components.
The static import created a dependency chain:
websocket_actions → InteractiveDialog → AppsFormContainer → AppsFormComponent
→ Markdown → AtMention → user group components
This affected many tests because websocket_actions is imported by core
system components. The dynamic import only loads InteractiveDialog when
the dialog event is actually triggered, improving performance and breaking
the circular dependency.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor InteractiveDialog to use isolated DialogRouter architecture
Move InteractiveDialogAdapter out of the interactive_dialog directory to
break circular dependency chain that was causing test failures in unrelated
components.
**Changes:**
- Create new `dialog_router` component with dynamic imports for both legacy
InteractiveDialog and AppsForm-based adapter
- Move InteractiveDialogAdapter to dialog_router directory to isolate it
from existing components
- Update adapter to use dynamic import for AppsFormContainer to avoid
circular dependency
- Replace embedded routing logic in interactive_dialog/index.tsx with
clean DialogRouter usage
**Benefits:**
- Fixes circular dependency: websocket_actions → InteractiveDialog →
AppsFormContainer → AppsFormComponent → Markdown → AtMention components
- Cleaner separation of concerns - new code is isolated from existing stable code
- Dynamic imports improve performance by loading components only when needed
- Maintains backward compatibility while enabling new AppsForm features
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* lint fixes
* Fix TypeScript compilation error in dropdown_input_hybrid
Explicitly constrain react-select types to single-select mode (isMulti=false)
to resolve type inference conflicts introduced by the InteractiveDialog to
AppsForm migration. The component was always single-select only, but the
types were previously ambiguous.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix ESLint errors in dropdown_input_hybrid
- Fix variable naming convention violation
- Add eslint-disable comment for intentionally unused components prop
- Ensures clean CI/CD pipeline
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Enhance InteractiveDialogAdapter with comprehensive validation and type safety
- Add enhanced TypeScript interfaces (ValidationError, ConversionContext)
- Implement comprehensive dialog and element validation with server-side limits
- Add XSS prevention through string sanitization for security
- Implement structured logging following Mattermost webapp conventions
- Maintain complete backwards compatibility (validation disabled by default)
- Add configurable validation modes (validateInputs, strictMode, enableDebugLogging)
- Enhance error handling with detailed field-specific validation
- Support all dialog element types with proper validation rules
- Add proper server-side length limits (title: 24, name: 300, etc.)
- Improve type safety throughout conversion logic
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix lint errors
* Fix test expectations for XSS sanitization in InteractiveDialogAdapter
- Update test assertions to match actual sanitization behavior
- Fix expected text content for script and iframe tag removal
- Correct event handler sanitization test expectations
- All 23 InteractiveDialogAdapter tests now pass successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix ESLint errors in InteractiveDialogAdapter test file
- Replace await-in-loop with Promise.all for boolean conversion tests
- Add newline at end of file to satisfy eol-last rule
- All tests continue to pass (23/23)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix React act() warnings in apps_form_field tests
- Wrap async select field renders in act() to prevent console warnings
- Fix user, channel, and dynamic select field test warnings
- Add proper async/await handling for react-select components
- All 17 apps_form_field tests now pass without warnings
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Simplify default value handling to match original InteractiveDialog
- Remove complex numeric subtype logic - not needed
- Use simple `element.default ?? null` for all text/textarea fields
- Matches original InteractiveDialog behavior exactly (lines 42-50)
- Treat all field types consistently like original dialog
- Fix syntax error with missing brace in switch statement
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Enhance InteractiveDialogAdapter with server-side error handling and improved type safety
- Fix server-side submission failures to keep dialog open and display errors
- Add proper TypeScript types for ActionResult<SubmitDialogResponse>
- Implement comprehensive error handling for both server and network errors
- Add numeric field support with proper number conversion and fallback
- Enhance test coverage with server-side error handling scenarios
- Maintain backwards compatibility with existing InteractiveDialog behavior
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add internationalization for InteractiveDialogAdapter error messages
- Replace hardcoded error strings with proper i18n using intl.formatMessage()
- Add new localization keys to server/i18n/en.json for user-facing error messages
- Support parameter interpolation for dynamic error details
- Maintain backwards compatibility with default English messages
- Follow Mattermost internationalization patterns and conventions
Error messages localized:
- interactive_dialog.submission_failed
- interactive_dialog.submission_failed_validation
- interactive_dialog.validation_failed
- interactive_dialog.element_validation_failed
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix i18n-extract
* remove dynamic loading, see if tests still fail
* Optimize InteractiveDialogAppsForm validation and performance
- Remove redundant validateDialogElement calls (50% validation performance improvement)
- Simplify DialogRouter by eliminating unnecessary async loading state
- Optimize option validation with combined loop for select/radio fields
- Fix TypeScript errors with proper PropsFromRedux type inheritance
- Replace regex stringMatching with traditional string patterns in tests
- Simplify mocked state in interactive_dialog.test.ts (1500+ lines → minimal)
- Fix ESLint issues: trailing spaces and import ordering
Performance improvements:
- DialogRouter: 50% faster mounting (eliminated loading state)
- Validation: 50% fewer validation calls per element
- Bundle: No size increase, better tree-shaking
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Convert all test files from enzyme to React Testing Library
- Replace enzyme shallow/mount with React Testing Library's renderWithContext
- Update all assertions to test user-visible behavior instead of implementation details
- Remove brittle snapshot test and replace with behavioral assertions
- Add comprehensive test coverage for form validation, lookup functionality, and edge cases
- Fix all ESLint and styling issues
- Remove unused enzyme imports and dependencies
This improves test maintainability and aligns with modern React testing best practices
by focusing on user interactions rather than component internals.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix all failing tests in apps_form_component.test.tsx
- Fix error message assertion to match exact text instead of regex
- Simplify lookup functionality tests to avoid async rendering issues
- Update custom submit buttons test to handle multiple cancel buttons correctly
- Remove complex field configurations that were causing React Select warnings
- All 27 tests now pass successfully
The tests are now more stable and focus on verifying component configuration
and user-visible behavior rather than complex async interactions.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix lint
* cleanup tests, fix E2E tests
* Improve unit test coverage for InteractiveDialogAdapter and AppsForm components
• Add 22 new comprehensive test cases across both components
• interactive_dialog_adapter.test.tsx: Added 9 new tests covering advanced validation scenarios, enhanced type conversion, and error handling
• apps_form_component.test.tsx: Added 13 new tests covering component lifecycle, field error handling, client-side validation, and lookup functionality
• Enhanced coverage includes validation edge cases, error recovery, form state management, and component interaction patterns
• All tests passing: 49/49 for interactive_dialog_adapter and 50/50 for apps_form_component
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add submit_label backward compatibility for Interactive Dialog to AppsForm migration
This commit restores the submit_label functionality that was lost during the transition from Interactive Dialog to AppsForm. The changes ensure backward compatibility by allowing interactive dialogs to specify custom submit button text through the submit_label property.
Changes made:
- Added submit_label property to AppForm interface in apps.ts
- Updated InteractiveDialogAdapter to extract and pass through submitLabel from legacy dialogs
- Modified AppsForm component to use custom submit_label when provided instead of hardcoded "Submit"
- Added comprehensive test coverage for the new functionality
- Maintained XSS protection through existing sanitization methods
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update e2e tests for AppsForm compatibility and fix TypeScript compilation errors
This commit updates interactive dialog e2e tests to work with AppsForm instead of legacy interactive dialog:
Key changes:
- Update modal selectors from #interactiveDialogModal to #appsModal
- Update button selectors from #interactiveDialogSubmit to #appsModalSubmit
- Fix label selectors to work with AppsForm DOM structure
- Handle ReactSelect portal rendering for dropdown options
- Fix TypeScript compilation errors in demo_boolean_spec.ts with triple-slash references
- Add ESLint comment spacing fixes to interactive_dialog_adapter.test.tsx
- Update checkbox selectors to use generic input[type="checkbox"] instead of element IDs
- Remove feature flag disabling InteractiveDialogAppsForm to use AppsForm by default
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* updates from self review
* revert bad file commits
* Update files_1_spec.ts
* initial fixes from reviews
* more review cleanup/fixes
* i18n-extract
* fix interactive dialog tests
* fix circular reference error in tests
* fix/cleanup tests
* lint fix
* use makeAsyncComponent instead of DynamicAppsFormContainer
* mysql fixes
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-07-28 20:24:54 -04:00
|
|
|
|
|
|
|
|
// Enable AppsForm for Interactive Dialogs instead of legacy dialog implementation
|
|
|
|
|
InteractiveDialogAppsForm bool
|
2025-08-21 13:37:43 -04:00
|
|
|
|
2025-08-27 10:05:39 -04:00
|
|
|
EnableMattermostEntry bool
|
2025-09-29 17:29:32 -04:00
|
|
|
|
2026-02-16 11:07:02 -05:00
|
|
|
// DEPRECATED: Mobile SSO SAML code-exchange flow - disabled by default
|
|
|
|
|
// This feature is deprecated and will be removed in a future release.
|
|
|
|
|
// Mobile clients should use the direct SSO callback flow with srv parameter verification.
|
2025-09-29 17:29:32 -04:00
|
|
|
MobileSSOCodeExchange bool
|
2025-10-09 00:56:44 -04:00
|
|
|
|
|
|
|
|
// FEATURE_FLAG_REMOVAL: AutoTranslation - Remove this when MVP is to be released
|
|
|
|
|
// Enable auto-translation feature for messages in channels
|
|
|
|
|
AutoTranslation bool
|
2025-10-30 15:09:27 -04:00
|
|
|
|
2025-11-11 06:08:56 -05:00
|
|
|
// Enable burn-on-read messages that automatically delete after viewing
|
|
|
|
|
BurnOnRead bool
|
|
|
|
|
|
2025-10-30 15:09:27 -04:00
|
|
|
// FEATURE_FLAG_REMOVAL: EnableAIPluginBridge
|
|
|
|
|
EnableAIPluginBridge bool
|
[MM-66359] Recaps MVP (#34337)
* initial commit for POC of Plugin Bridge
* Updates
* POC for plugin bridge
* Updates from collaboration
* Fixes
* Refactor Plugin Bridge to use HTTP/REST instead of RPC
- Remove ExecuteBridgeCall hook and Context.SourcePluginId
- Implement HTTP-based bridge using existing PluginHTTP infrastructure
- Add CallPlugin API method with endpoint parameter instead of method name
- Update CallPluginBridge to construct HTTP POST requests
- Add proper headers: Mattermost-User-Id, Mattermost-Plugin-ID
- Use 'com.mattermost.server' as plugin ID for core server calls
- Update ai.go to use REST endpoint /inter-plugin/v1/completion
- Add comprehensive spec documentation in server/spec.md
- Add MIGRATION_GUIDE.md for plugin developers
- Fix 401/404 issues by setting correct headers and URL paths
* Improve Plugin Bridge security and architecture
- Create ServeInternalPluginRequest for internal plugin calls (core + plugin-to-plugin)
- Move header-setting logic from CallPluginBridge to ServeInternalPluginRequest
- Improve separation of concerns: business logic vs HTTP transport
- Add security documentation explaining header protection
Security Improvements:
- ServeInternalPluginRequest is NOT exposed as HTTP route (internal only)
- Headers (Mattermost-User-Id, Mattermost-Plugin-ID) are set by trusted server code
- External requests cannot spoof these headers (stripped by servePluginRequest)
- Core calls use 'com.mattermost.server' as plugin ID for authorization
- Plugin-to-plugin calls use real plugin ID (enforced by server)
Backward Compatibility:
- Keep ServeInterPluginRequest for existing API.PluginHTTP callers (deprecated)
- All tests pass
Docs:
- Update spec.md with security model explanation
- Update MIGRATION_GUIDE.md with correct header usage examples
* Space
* cursor please stop creating markdown files
* Fix style
* Fix i18n, linter
* REMOVE MARKDOWN
* Remove CallPlugin method from plugin API interface
Per review feedback, this method is no longer needed.
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* Remove CallPlugin method implementation from PluginAPI
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* fixes
* Add AI OpenAPI spec
* fix openapi spec
* Use agents client (#34225)
* Use agents client
* Remove default agent
* Fixes
* fix: modify system prompts to ensure JSON is being returned
* Base implementation for recaps working
* small fixes
* Adjustments
* remove webapp changes
* Add feature flags for rewrites and ai bridge, clean up
* Remove comments that aren't helpful
* Fix i18n
* Remove rewrites
* Fix tests
* Fix i18n
* adjust i18n again
* Add back translations
* Remove leftover mock code
* remove model file
* Changes from PR review
* Make the real substitutions
* Include a basic invokation of the client with noop to ensure build works
* more fix
* Remove unneeded change
* Updates from review
* Fixes
* Remove some logic from rewrites to clean up branch
* Use v1.5.0 of agents plugin
* A bunch more additions for general UX flow
* Add missing files
* Add mocks
* Fixes for vet-api, i18n, build, types, etc
* One more linter fix
* Fix i18n and some tests
* Refactors and cleanup in backend code
* remove rogue markdown file
* fixes after refactors from backend
* Add back renamed files, and add tests
* More self code review
* More fixes
* More refactors
* Fix call stack exceeded bug
* Include read messages if there are no unreads
* Fix test failure: use correct error message key for recap permission denied
The getRecapAndCheckOwnership function was using strings.ToLower(callerName)
to generate error keys, which caused 'GetRecap' to become 'getrecap' instead
of the expected 'get'. Changed to use the correct static key that matches
the en.json localization file.
Fixes TestGetRecap/get_recap_by_non-owner test failure.
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* Consolidate permission errors down to a single string
* Fixes for i18n, worktrees making this difficult
* Fix i18n
* Fix i18n once and for all (for real) (final)
* Fix duplicate getAgents method in client4.ts
* Remove duplicate ai state from initial_state.ts
* Fix types
* Fix tests
* Fix return type of GetAgents and GetServices
* Add tests for recaps components
* Fix types
* Update i18n
* Fixes
* Fixes
* More cleanup
* Revert random file
* Use undefined
* fix linter
* Address feedback
* Missed a git add
* Fixes
* Fix i18n
* Remove fallback
* Fixes for PR
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
Co-authored-by: Christopher Speller <crspeller@gmail.com>
Co-authored-by: Felipe Martin <me@fmartingr.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-01-13 11:59:22 -05:00
|
|
|
|
|
|
|
|
// FEATURE_FLAG_REMOVAL: EnableAIRecaps - Remove this when GA is released
|
|
|
|
|
EnableAIRecaps bool
|
2026-02-25 10:18:51 -05:00
|
|
|
|
Merge the Integrated Boards MVP feature branch (#35796)
* Add CreatedBy and UpdatedBy to the properties fields and values (#34485)
* Add CreatedBy and UpdatedBy to the properties fields and values
* Fix types
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds ObjectType to the property fields table (#34908)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Update ObjectType migration setting an empty value and marking the column as not null (#34915)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds uniqueness mechanisms to the property fields (#35058)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Fixing retrylayer mocks
* Remove retrylayer duplication
* Address review comments
* Fix comment to avoid linter issues
* Address PR comments
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.down.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.up.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.up.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update field validation to check only for valid target types
* Update migrations to avoid concurrent index creation within a transaction
* Update migrations to make all index ops concurrent
* Update tests to use valid PSAv2 property fields
* Adds a helper for valid PSAv2 TargetTypes
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Fix property tests (#35388)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds Integrated Boards feature flag (#35378)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds Integrated Boards MVP API changes (#34822)
This PR includes the necessary changes for channels and posts
endpoints and adds a set of generic endpoints to retrieve and manage
property fields and values following the new Property System approach.
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Mattermost Build <build@mattermost.com>
* Property System Architecture permissions for v2 (#35113)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Fix i18n sorting
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Add Views store and app layer (#35361)
* Add Views store and app layer for Integrated Boards
Implements the View entity (model, SQL store, service, app) as described
in the Integrated Boards tech spec. Views are channel-scoped board
configurations with typed props (board, kanban subviews) and soft-delete.
- public/model: View, ViewBoardProps, Subview, ViewPatch types with
PreSave/PreUpdate/IsValid/Patch/Clone/Auditable
- Migration 158: Views table with jsonb Props column and indexes
- SqlViewStore: CRUD with nil-safe Props marshaling (AppendBinaryFlag)
- ViewService: CreateView seeds default kanban subview and links the
boards property field; caches boardPropertyFieldID at startup
- App layer: CreateView/GetView/GetViewsForChannel/UpdateView/DeleteView
with channel-membership permission checks and WebSocket events
(view_created, view_updated, view_deleted)
- doSetupBoardsPropertyField: registers the Boards property group and
board field in NewServer() before ViewService construction
- GetFieldByName now returns store.ErrNotFound instead of raw sql.ErrNoRows
* Move permission checks out of App layer for views
- Remove HasPermissionToChannel calls from all App view methods
- Drop userID params from GetView, GetViewsForChannel, UpdateView, DeleteView
- Fix doSetupBoardsPropertyField to include required TargetType for PSAv2 field
* Make View service generic and enforce board validation in model
- Remove board-specific auto-setup from service and server startup
- Enforce that board views require Props, at least one subview, and at least one linked property in IsValid()
- Move default subview seeding out of app layer; callers must provide valid props
- Call PreSave on subviews during PreUpdate to assign IDs to new subviews
- Update all tests to reflect the new validation requirements
* Restore migrations files to match base branch
* Distinguish ErrNotFound from other errors in view store Get
* Use CONCURRENTLY and nontransactional for index operations in views migration
* Split views index creation into separate nontransactional migrations
* Update migrations.list
* Update i18n translations for views
* Fix makeView helper to include required Props for board view validation
* Rename ctx parameter from c to rctx in OAuthProvider mock
* Remove views service layer, call store directly from app
* Return 500 for unexpected DB errors in GetView, 404 only for not-found
* Harden View model: deep-copy Props, validate linked property IDs
- Add ViewBoardProps.Clone() to deep-copy LinkedProperties and Subviews
- Use it in View.Clone() and View.Patch() to prevent shared-slice aliasing
- Iterate over LinkedProperties in View.IsValid() and reject invalid IDs
with a dedicated i18n key
- Register ViewStore in storetest AssertExpectations so mock expectations
are enforced
- Add tests covering all new behaviours
* Restore autotranslation worker_stopped i18n translation
* Fix view store test IDs and improve error handling in app layer
- Use model.NewId() for linked property IDs in testUpdateView to fix
validation failure (IsValid rejects non-UUID strings)
- Fix import grouping in app/view.go (stdlib imports in one block)
- Return 404 instead of 500 when Update/Delete store calls return
ErrNotFound (e.g. concurrent deletion TOCTOU race)
* Add View store mock to retrylayer test genStore helper
The View store was added to the store interface but the genStore()
helper in retrylayer_test.go was not updated, causing TestRetry to panic.
Also removes the duplicate Recap mock registration.
* Refactor view deletion and websocket event handling; update SQL store methods to use query builder
* revert property field store
* Remove useless migrations
* Add cursor-based pagination to View store GetForChannel
- Add ViewQueryCursor and ViewQueryOpts types with validation
- Return (views, cursor, error) for caller-driven pagination
- PerPage clamping: <=0 defaults to 20, >200 clamps to 200
- Support IncludeDeleted filter
- Add comprehensive store tests for pagination, cursor edge cases,
PerPage clamping, and invalid input rejection
- Add app layer test for empty channelID → 400
- Update interface, retrylayer, timerlayer, and mock signatures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor test loops in ViewStore tests for improved readability
* change pagination to limit/offset
* Add upper-bound limits on View Subviews and LinkedProperties
Defense-in-depth validation: cap Subviews at 50 and LinkedProperties
at 500 to prevent abuse below the 300KB payload limit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* MM-67388, MM-66528, MM-67750: Add View REST API endpoints, websocket events, and sort order (#35442)
* Add Views store and app layer for Integrated Boards
Implements the View entity (model, SQL store, service, app) as described
in the Integrated Boards tech spec. Views are channel-scoped board
configurations with typed props (board, kanban subviews) and soft-delete.
- public/model: View, ViewBoardProps, Subview, ViewPatch types with
PreSave/PreUpdate/IsValid/Patch/Clone/Auditable
- Migration 158: Views table with jsonb Props column and indexes
- SqlViewStore: CRUD with nil-safe Props marshaling (AppendBinaryFlag)
- ViewService: CreateView seeds default kanban subview and links the
boards property field; caches boardPropertyFieldID at startup
- App layer: CreateView/GetView/GetViewsForChannel/UpdateView/DeleteView
with channel-membership permission checks and WebSocket events
(view_created, view_updated, view_deleted)
- doSetupBoardsPropertyField: registers the Boards property group and
board field in NewServer() before ViewService construction
- GetFieldByName now returns store.ErrNotFound instead of raw sql.ErrNoRows
* Move permission checks out of App layer for views
- Remove HasPermissionToChannel calls from all App view methods
- Drop userID params from GetView, GetViewsForChannel, UpdateView, DeleteView
- Fix doSetupBoardsPropertyField to include required TargetType for PSAv2 field
* Make View service generic and enforce board validation in model
- Remove board-specific auto-setup from service and server startup
- Enforce that board views require Props, at least one subview, and at least one linked property in IsValid()
- Move default subview seeding out of app layer; callers must provide valid props
- Call PreSave on subviews during PreUpdate to assign IDs to new subviews
- Update all tests to reflect the new validation requirements
* Restore migrations files to match base branch
* Distinguish ErrNotFound from other errors in view store Get
* Use CONCURRENTLY and nontransactional for index operations in views migration
* Split views index creation into separate nontransactional migrations
* Update migrations.list
* Update i18n translations for views
* Fix makeView helper to include required Props for board view validation
* Rename ctx parameter from c to rctx in OAuthProvider mock
* Remove views service layer, call store directly from app
* Return 500 for unexpected DB errors in GetView, 404 only for not-found
* Harden View model: deep-copy Props, validate linked property IDs
- Add ViewBoardProps.Clone() to deep-copy LinkedProperties and Subviews
- Use it in View.Clone() and View.Patch() to prevent shared-slice aliasing
- Iterate over LinkedProperties in View.IsValid() and reject invalid IDs
with a dedicated i18n key
- Register ViewStore in storetest AssertExpectations so mock expectations
are enforced
- Add tests covering all new behaviours
* Restore autotranslation worker_stopped i18n translation
* Fix view store test IDs and improve error handling in app layer
- Use model.NewId() for linked property IDs in testUpdateView to fix
validation failure (IsValid rejects non-UUID strings)
- Fix import grouping in app/view.go (stdlib imports in one block)
- Return 404 instead of 500 when Update/Delete store calls return
ErrNotFound (e.g. concurrent deletion TOCTOU race)
* Add View store mock to retrylayer test genStore helper
The View store was added to the store interface but the genStore()
helper in retrylayer_test.go was not updated, causing TestRetry to panic.
Also removes the duplicate Recap mock registration.
* Refactor view deletion and websocket event handling; update SQL store methods to use query builder
* revert property field store
* Add View API endpoints with OpenAPI spec, client methods, and i18n
Implement REST API for channel views (board-type) behind the
IntegratedBoards feature flag. Adds CRUD endpoints under
/api/v4/channels/{channel_id}/views with permission checks
matching the channel bookmark pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove useless migrations
* Add cursor-based pagination to View store GetForChannel
- Add ViewQueryCursor and ViewQueryOpts types with validation
- Return (views, cursor, error) for caller-driven pagination
- PerPage clamping: <=0 defaults to 20, >200 clamps to 200
- Support IncludeDeleted filter
- Add comprehensive store tests for pagination, cursor edge cases,
PerPage clamping, and invalid input rejection
- Add app layer test for empty channelID → 400
- Update interface, retrylayer, timerlayer, and mock signatures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add cursor-based pagination to View API for channel views
* Enhance cursor handling in getViewsForChannel and update tests for pagination
* Refactor test loops in ViewStore tests for improved readability
* Refactor loop in TestGetViewsForChannel for improved readability
* change pagination to limit/offset
* switch to limit/offset pagination
* Add upper-bound limits on View Subviews and LinkedProperties
Defense-in-depth validation: cap Subviews at 50 and LinkedProperties
at 500 to prevent abuse below the 300KB payload limit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add view sort order API endpoint
Add POST /api/v4/channels/{channel_id}/views/{view_id}/sort_order
endpoint following the channel bookmarks reorder pattern. Includes
store, app, and API layers with full test coverage at each layer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add connectionId to view WebSocket events and sort_order API spec
Thread connectionId from request header through all view handlers
(create, update, delete, sort_order) to WebSocket events, matching
the channel bookmarks pattern. Add sort_order endpoint to OpenAPI
spec. Update minimum server version to 11.6.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove duplicate View/ViewPatch definitions from definitions.yaml
The merge from integrated-boards-mvp introduced duplicate View and
ViewPatch schema definitions that were already defined earlier in
the file with more detail (including ViewBoardProps ref and enums).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update minimum server version to 11.6 in views API spec
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add missing translations for view sort order error messages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Merge integrated-boards-mvp into ibmvp_api-views; remove spec files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix flaky TestViewStore timestamp test on CI
Add sleep before UpdateSortOrder to ensure timestamps differ,
preventing same-millisecond comparisons on fast CI machines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* remove duplicate views.yaml imclude
* Use c.boolString() for include_deleted query param in GetViewsForChannel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix views.yaml sort order schema: use integer type and require body
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor view sort order tests to use named IDs instead of array indices
Extract idA/idB/idC from views slice and add BEFORE/AFTER comments
to make stateful subtest ordering easier to follow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Return 404 instead of 403 for view operations on deleted channels
Deleted channels should appear non-existent to callers rather than
revealing their existence via a 403. Detailed error text explains
the context for debugging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add missing channel deleteat checks
* Use c.Params.Page instead of manual page query param parsing in getViewsForChannel
c.Params already validates and defaults page/per_page, so the manual
parsing was redundant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add support for total count in views retrieval
* Add tests for handling deleted views in GetViewsForChannel and GetView
* Short-circuit negative newIndex in UpdateSortOrder before opening transaction
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add per-channel limit on views to bound UpdateSortOrder cost
Without a cap, unbounded view creation makes sort-order updates
increasingly expensive (CASE WHEN per view, row locks). Adds
MaxViewsPerChannel=50 constant and enforces it in the app layer
before saving. Includes API and app layer tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove include_deleted support from views API
Soft-deleted views are structural metadata with low risk, but no other
similar endpoint (e.g. channel bookmarks) exposes deleted records without
an admin gate. Rather than adding an admin-only permission check for
consistency, remove the feature entirely since there is no current use case.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update view permissions to require `create_post` instead of channel management permissions
* Remove obsolete view management error messages for direct and group messages
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat(migrations): add user tracking and object type to property fields
- Introduced user tracking columns (CreatedBy, UpdatedBy) to PropertyFields and PropertyValues.
- Added ObjectType column to PropertyFields with associated unique indexes for legacy and typed properties.
- Created new migration scripts for adding and dropping these features, including necessary indexes for data integrity.
- Established views for managing property fields with new attributes.
This update enhances the schema to support better tracking and categorization of property fields.
* Add Property System Architecture v2 API endpoints (#35583)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Adds the Property System Architecture v2 API endpoints
* Adds permission checks to the create field endpoint
* Add target access checks to value endpoints
* Add default branches for object_type and target_type and extra guards for cursor client4 methods
* Fix vet API mismatch
* Fix error checks
* Fix linter
* Add merge semantics for property patch logic and API endpoint
* Fix i18n
* Fix duplicated patch elements and early return on bad cursor
* Update docs to use enums
* Fix i18n sorting
* Update app layer to return model.AppError
* Adds a limit to the number of property values that can be patched in the same request
* Require target_type filter when searching property fields
* Add objectType validation as part of field.IsValid()
* Fix linter
* Fix test with bad objecttpye
* Fix test grouping
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* MM-67968: Flatten view model — remove icon, subviews, typed board props (#35726)
* feat(views): flatten view model by removing icon, subview, and board props
Simplifies the View data model as part of MM-67968: removes Icon, Subview,
and ViewBoardProps types; renames ViewTypeBoard to ViewTypeKanban; replaces
typed Props with StringInterface (map[string]any); adds migration 000167
to drop the Icon column from the Views table.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* feat(api): update views OpenAPI spec to reflect flattened model
Removes ViewBoardProps, Subview, and icon from the View and ViewPatch
schemas. Changes type enum from board to kanban. Replaces typed props
with a free-form StringInterface object. Aligns with MM-67968.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* refactor(views): simplify store by dropping dbView and marshalViewProps
StringInterface already implements driver.Valuer and sql.Scanner, so the
manual JSON marshal/unmarshal and the dbView intermediate struct were
redundant. model.View now scans directly from the database. Also removes
the dead ViewMaxLinkedProperties constant and wraps the Commit() error in
UpdateSortOrder.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(api): allow arbitrary JSON in view props OpenAPI schema
The props field was restricted to string values via
additionalProperties: { type: string }, conflicting with the Go model's
StringInterface (map[string]any). Changed to additionalProperties: true
in View, ViewPatch, and inline POST schemas.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Adds basic implementation of the generic redux store for PSAv2 (#35512)
* Adds basic implementation of the generic redux store for PSAv2
* Add created_by and updated_by to the test fixtures
* Make target_id, target_type and object_type mandatory
* Wrap getPropertyFieldsByIds and getPropertyValuesForTargetByFieldIds with createSelector
* Address PR comments
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds websocket messages for the PSAv2 API events (#35696)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Adds the Property System Architecture v2 API endpoints
* Adds permission checks to the create field endpoint
* Add target access checks to value endpoints
* Add default branches for object_type and target_type and extra guards for cursor client4 methods
* Fix vet API mismatch
* Fix error checks
* Fix linter
* Add merge semantics for property patch logic and API endpoint
* Fix i18n
* Fix duplicated patch elements and early return on bad cursor
* Update docs to use enums
* Fix i18n sorting
* Update app layer to return model.AppError
* Adds a limit to the number of property values that can be patched in the same request
* Adds websocket messages for the PSAv2 API events
* Add IsPSAv2 helper to the property field for clarity
* Add guard against nil returns on field deletion
* Add docs to the websocket endpoints
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* migrations: consolidate views migrations and reorder after master
- Merged 000165 (create Views) with 000167 (drop Icon) since Icon was never needed
- Renumbered branch migrations 159-166 → 160-167 so master's 000159 (deduplicate_policy_names) runs first
- Regenerated migrations.list
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add API endpoint to retrieve posts for a specific view (#35604)
Automatic Merge
* Apply fixes after merge
* Return a more specific error from getting multiple fields
* Prevent getting broadcast params on field deletion if not needed
* Remove duplicated migration code
* Update property conflict code to always use master
* Adds nil guard when iterating on property fields
* Check that permission level is valid before getting rejected by the database
* Validate correctness on TargetID for PSAv2 fields
* Avoid PSAv1 using permissions or protected
* Fix test data after validation change
* Fix flaky search test
* Adds more posts for filter use cases to properly test exclusions
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Julien Tant <julien@craftyx.fr>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Julien Tant <785518+JulienTant@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 05:36:35 -04:00
|
|
|
// FEATURE_FLAG_REMOVAL: IntegratedBoards - Remove this when GA is released
|
|
|
|
|
// Enable the Integrated Boards feature within Mattermost channels
|
|
|
|
|
IntegratedBoards bool
|
|
|
|
|
|
2026-02-25 10:18:51 -05:00
|
|
|
// Enable LIKE-based CJK (Chinese, Japanese, Korean) search for PostgreSQL
|
|
|
|
|
CJKSearch bool
|
2020-09-30 00:41:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (f *FeatureFlags) SetDefaults() {
|
|
|
|
|
f.TestFeature = "off"
|
2020-11-25 10:27:06 -05:00
|
|
|
f.TestBoolFeature = false
|
2021-04-01 13:44:56 -04:00
|
|
|
f.EnableRemoteClusterService = false
|
2024-10-24 13:38:00 -04:00
|
|
|
f.EnableSharedChannelsDMs = false
|
2025-06-15 04:07:56 -04:00
|
|
|
f.EnableSharedChannelsMemberSync = false
|
2025-06-13 10:51:12 -04:00
|
|
|
f.EnableSyncAllUsersForRemoteCluster = false
|
2025-06-02 08:59:19 -04:00
|
|
|
f.EnableSharedChannelsPlugins = true
|
2024-07-31 13:18:30 -04:00
|
|
|
f.AppsEnabled = false
|
2022-01-19 09:19:23 -05:00
|
|
|
f.NormalizeLdapDNs = false
|
2023-04-12 11:08:37 -04:00
|
|
|
f.DeprecateCloudFree = false
|
2023-01-09 10:50:43 -05:00
|
|
|
f.WysiwygEditor = false
|
2023-02-07 14:08:34 -05:00
|
|
|
f.OnboardingTourTips = true
|
2023-07-19 16:01:39 -04:00
|
|
|
f.EnableExportDirectDownload = false
|
2023-12-11 15:27:34 -05:00
|
|
|
f.MoveThreadsEnabled = false
|
2023-08-25 15:39:25 -04:00
|
|
|
f.StreamlinedMarketplace = true
|
2023-11-14 09:12:04 -05:00
|
|
|
f.CloudIPFiltering = false
|
2023-10-23 10:12:46 -04:00
|
|
|
f.ConsumePostHook = false
|
2023-11-29 09:10:17 -05:00
|
|
|
f.CloudAnnualRenewals = false
|
2024-02-28 11:06:17 -05:00
|
|
|
f.CloudDedicatedExportUI = false
|
2024-09-17 12:50:34 -04:00
|
|
|
f.ChannelBookmarks = true
|
2024-07-25 09:11:40 -04:00
|
|
|
f.WebSocketEventScope = true
|
2024-04-18 10:30:08 -04:00
|
|
|
f.NotificationMonitoring = true
|
2025-06-19 14:18:46 -04:00
|
|
|
f.ExperimentalAuditSettingsSystemConsoleUI = true
|
2025-05-27 07:35:02 -04:00
|
|
|
f.CustomProfileAttributes = true
|
2025-06-02 09:40:28 -04:00
|
|
|
f.AttributeBasedAccessControl = true
|
2025-11-04 03:24:49 -05:00
|
|
|
f.ContentFlagging = true
|
Update Interactive Dialog to use AppsForm (#31821)
* Add AppsForm-based InteractiveDialog implementation with feature flag control
- Add InteractiveDialogAppsForm feature flag (default enabled) to control migration path
- Enhance AppsForm components with backwards compatibility features:
- Add onHide prop support for legacy dialog behavior
- Add RADIO field type support with proper rendering
- Add required field indicators with red asterisk styling
- Use FormattedMessage for "(optional)" text internationalization
- Create InteractiveDialogAdapter to bridge legacy dialogs to AppsForm:
- Convert DialogElement fields to AppField format with proper type mapping
- Handle default value conversion for select, radio, and boolean fields
- Implement submission adapter to convert between Apps and legacy formats
- Support cancel notifications and proper context creation
- Update InteractiveDialog container to route between implementations based on feature flag
- Add Redux selector for feature flag state management
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix circular dependency issue with dynamic InteractiveDialog import
Replace static import of InteractiveDialog in websocket_actions.jsx with
dynamic import to resolve circular dependency chain that was causing test
failures in unrelated components.
The static import created a dependency chain:
websocket_actions → InteractiveDialog → AppsFormContainer → AppsFormComponent
→ Markdown → AtMention → user group components
This affected many tests because websocket_actions is imported by core
system components. The dynamic import only loads InteractiveDialog when
the dialog event is actually triggered, improving performance and breaking
the circular dependency.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor InteractiveDialog to use isolated DialogRouter architecture
Move InteractiveDialogAdapter out of the interactive_dialog directory to
break circular dependency chain that was causing test failures in unrelated
components.
**Changes:**
- Create new `dialog_router` component with dynamic imports for both legacy
InteractiveDialog and AppsForm-based adapter
- Move InteractiveDialogAdapter to dialog_router directory to isolate it
from existing components
- Update adapter to use dynamic import for AppsFormContainer to avoid
circular dependency
- Replace embedded routing logic in interactive_dialog/index.tsx with
clean DialogRouter usage
**Benefits:**
- Fixes circular dependency: websocket_actions → InteractiveDialog →
AppsFormContainer → AppsFormComponent → Markdown → AtMention components
- Cleaner separation of concerns - new code is isolated from existing stable code
- Dynamic imports improve performance by loading components only when needed
- Maintains backward compatibility while enabling new AppsForm features
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* lint fixes
* Fix TypeScript compilation error in dropdown_input_hybrid
Explicitly constrain react-select types to single-select mode (isMulti=false)
to resolve type inference conflicts introduced by the InteractiveDialog to
AppsForm migration. The component was always single-select only, but the
types were previously ambiguous.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix ESLint errors in dropdown_input_hybrid
- Fix variable naming convention violation
- Add eslint-disable comment for intentionally unused components prop
- Ensures clean CI/CD pipeline
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Enhance InteractiveDialogAdapter with comprehensive validation and type safety
- Add enhanced TypeScript interfaces (ValidationError, ConversionContext)
- Implement comprehensive dialog and element validation with server-side limits
- Add XSS prevention through string sanitization for security
- Implement structured logging following Mattermost webapp conventions
- Maintain complete backwards compatibility (validation disabled by default)
- Add configurable validation modes (validateInputs, strictMode, enableDebugLogging)
- Enhance error handling with detailed field-specific validation
- Support all dialog element types with proper validation rules
- Add proper server-side length limits (title: 24, name: 300, etc.)
- Improve type safety throughout conversion logic
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix lint errors
* Fix test expectations for XSS sanitization in InteractiveDialogAdapter
- Update test assertions to match actual sanitization behavior
- Fix expected text content for script and iframe tag removal
- Correct event handler sanitization test expectations
- All 23 InteractiveDialogAdapter tests now pass successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix ESLint errors in InteractiveDialogAdapter test file
- Replace await-in-loop with Promise.all for boolean conversion tests
- Add newline at end of file to satisfy eol-last rule
- All tests continue to pass (23/23)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix React act() warnings in apps_form_field tests
- Wrap async select field renders in act() to prevent console warnings
- Fix user, channel, and dynamic select field test warnings
- Add proper async/await handling for react-select components
- All 17 apps_form_field tests now pass without warnings
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Simplify default value handling to match original InteractiveDialog
- Remove complex numeric subtype logic - not needed
- Use simple `element.default ?? null` for all text/textarea fields
- Matches original InteractiveDialog behavior exactly (lines 42-50)
- Treat all field types consistently like original dialog
- Fix syntax error with missing brace in switch statement
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Enhance InteractiveDialogAdapter with server-side error handling and improved type safety
- Fix server-side submission failures to keep dialog open and display errors
- Add proper TypeScript types for ActionResult<SubmitDialogResponse>
- Implement comprehensive error handling for both server and network errors
- Add numeric field support with proper number conversion and fallback
- Enhance test coverage with server-side error handling scenarios
- Maintain backwards compatibility with existing InteractiveDialog behavior
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add internationalization for InteractiveDialogAdapter error messages
- Replace hardcoded error strings with proper i18n using intl.formatMessage()
- Add new localization keys to server/i18n/en.json for user-facing error messages
- Support parameter interpolation for dynamic error details
- Maintain backwards compatibility with default English messages
- Follow Mattermost internationalization patterns and conventions
Error messages localized:
- interactive_dialog.submission_failed
- interactive_dialog.submission_failed_validation
- interactive_dialog.validation_failed
- interactive_dialog.element_validation_failed
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix i18n-extract
* remove dynamic loading, see if tests still fail
* Optimize InteractiveDialogAppsForm validation and performance
- Remove redundant validateDialogElement calls (50% validation performance improvement)
- Simplify DialogRouter by eliminating unnecessary async loading state
- Optimize option validation with combined loop for select/radio fields
- Fix TypeScript errors with proper PropsFromRedux type inheritance
- Replace regex stringMatching with traditional string patterns in tests
- Simplify mocked state in interactive_dialog.test.ts (1500+ lines → minimal)
- Fix ESLint issues: trailing spaces and import ordering
Performance improvements:
- DialogRouter: 50% faster mounting (eliminated loading state)
- Validation: 50% fewer validation calls per element
- Bundle: No size increase, better tree-shaking
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Convert all test files from enzyme to React Testing Library
- Replace enzyme shallow/mount with React Testing Library's renderWithContext
- Update all assertions to test user-visible behavior instead of implementation details
- Remove brittle snapshot test and replace with behavioral assertions
- Add comprehensive test coverage for form validation, lookup functionality, and edge cases
- Fix all ESLint and styling issues
- Remove unused enzyme imports and dependencies
This improves test maintainability and aligns with modern React testing best practices
by focusing on user interactions rather than component internals.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix all failing tests in apps_form_component.test.tsx
- Fix error message assertion to match exact text instead of regex
- Simplify lookup functionality tests to avoid async rendering issues
- Update custom submit buttons test to handle multiple cancel buttons correctly
- Remove complex field configurations that were causing React Select warnings
- All 27 tests now pass successfully
The tests are now more stable and focus on verifying component configuration
and user-visible behavior rather than complex async interactions.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix lint
* cleanup tests, fix E2E tests
* Improve unit test coverage for InteractiveDialogAdapter and AppsForm components
• Add 22 new comprehensive test cases across both components
• interactive_dialog_adapter.test.tsx: Added 9 new tests covering advanced validation scenarios, enhanced type conversion, and error handling
• apps_form_component.test.tsx: Added 13 new tests covering component lifecycle, field error handling, client-side validation, and lookup functionality
• Enhanced coverage includes validation edge cases, error recovery, form state management, and component interaction patterns
• All tests passing: 49/49 for interactive_dialog_adapter and 50/50 for apps_form_component
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add submit_label backward compatibility for Interactive Dialog to AppsForm migration
This commit restores the submit_label functionality that was lost during the transition from Interactive Dialog to AppsForm. The changes ensure backward compatibility by allowing interactive dialogs to specify custom submit button text through the submit_label property.
Changes made:
- Added submit_label property to AppForm interface in apps.ts
- Updated InteractiveDialogAdapter to extract and pass through submitLabel from legacy dialogs
- Modified AppsForm component to use custom submit_label when provided instead of hardcoded "Submit"
- Added comprehensive test coverage for the new functionality
- Maintained XSS protection through existing sanitization methods
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update e2e tests for AppsForm compatibility and fix TypeScript compilation errors
This commit updates interactive dialog e2e tests to work with AppsForm instead of legacy interactive dialog:
Key changes:
- Update modal selectors from #interactiveDialogModal to #appsModal
- Update button selectors from #interactiveDialogSubmit to #appsModalSubmit
- Fix label selectors to work with AppsForm DOM structure
- Handle ReactSelect portal rendering for dropdown options
- Fix TypeScript compilation errors in demo_boolean_spec.ts with triple-slash references
- Add ESLint comment spacing fixes to interactive_dialog_adapter.test.tsx
- Update checkbox selectors to use generic input[type="checkbox"] instead of element IDs
- Remove feature flag disabling InteractiveDialogAppsForm to use AppsForm by default
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* updates from self review
* revert bad file commits
* Update files_1_spec.ts
* initial fixes from reviews
* more review cleanup/fixes
* i18n-extract
* fix interactive dialog tests
* fix circular reference error in tests
* fix/cleanup tests
* lint fix
* use makeAsyncComponent instead of DynamicAppsFormContainer
* mysql fixes
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-07-28 20:24:54 -04:00
|
|
|
f.InteractiveDialogAppsForm = true
|
2025-09-10 22:52:19 -04:00
|
|
|
f.EnableMattermostEntry = true
|
2025-10-26 23:36:25 -04:00
|
|
|
|
2026-02-16 11:07:02 -05:00
|
|
|
// DEPRECATED: Disabled by default - mobile clients use direct SSO callback flow
|
|
|
|
|
f.MobileSSOCodeExchange = false
|
2025-10-09 00:56:44 -04:00
|
|
|
|
2026-02-16 06:53:29 -05:00
|
|
|
f.AutoTranslation = true
|
2025-10-30 15:09:27 -04:00
|
|
|
|
2025-12-18 03:39:44 -05:00
|
|
|
f.BurnOnRead = true
|
2025-11-11 06:08:56 -05:00
|
|
|
|
2025-10-30 15:09:27 -04:00
|
|
|
// FEATURE_FLAG_REMOVAL: EnableAIPluginBridge - Remove this default when MVP is to be released
|
|
|
|
|
f.EnableAIPluginBridge = false
|
[MM-66359] Recaps MVP (#34337)
* initial commit for POC of Plugin Bridge
* Updates
* POC for plugin bridge
* Updates from collaboration
* Fixes
* Refactor Plugin Bridge to use HTTP/REST instead of RPC
- Remove ExecuteBridgeCall hook and Context.SourcePluginId
- Implement HTTP-based bridge using existing PluginHTTP infrastructure
- Add CallPlugin API method with endpoint parameter instead of method name
- Update CallPluginBridge to construct HTTP POST requests
- Add proper headers: Mattermost-User-Id, Mattermost-Plugin-ID
- Use 'com.mattermost.server' as plugin ID for core server calls
- Update ai.go to use REST endpoint /inter-plugin/v1/completion
- Add comprehensive spec documentation in server/spec.md
- Add MIGRATION_GUIDE.md for plugin developers
- Fix 401/404 issues by setting correct headers and URL paths
* Improve Plugin Bridge security and architecture
- Create ServeInternalPluginRequest for internal plugin calls (core + plugin-to-plugin)
- Move header-setting logic from CallPluginBridge to ServeInternalPluginRequest
- Improve separation of concerns: business logic vs HTTP transport
- Add security documentation explaining header protection
Security Improvements:
- ServeInternalPluginRequest is NOT exposed as HTTP route (internal only)
- Headers (Mattermost-User-Id, Mattermost-Plugin-ID) are set by trusted server code
- External requests cannot spoof these headers (stripped by servePluginRequest)
- Core calls use 'com.mattermost.server' as plugin ID for authorization
- Plugin-to-plugin calls use real plugin ID (enforced by server)
Backward Compatibility:
- Keep ServeInterPluginRequest for existing API.PluginHTTP callers (deprecated)
- All tests pass
Docs:
- Update spec.md with security model explanation
- Update MIGRATION_GUIDE.md with correct header usage examples
* Space
* cursor please stop creating markdown files
* Fix style
* Fix i18n, linter
* REMOVE MARKDOWN
* Remove CallPlugin method from plugin API interface
Per review feedback, this method is no longer needed.
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* Remove CallPlugin method implementation from PluginAPI
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* fixes
* Add AI OpenAPI spec
* fix openapi spec
* Use agents client (#34225)
* Use agents client
* Remove default agent
* Fixes
* fix: modify system prompts to ensure JSON is being returned
* Base implementation for recaps working
* small fixes
* Adjustments
* remove webapp changes
* Add feature flags for rewrites and ai bridge, clean up
* Remove comments that aren't helpful
* Fix i18n
* Remove rewrites
* Fix tests
* Fix i18n
* adjust i18n again
* Add back translations
* Remove leftover mock code
* remove model file
* Changes from PR review
* Make the real substitutions
* Include a basic invokation of the client with noop to ensure build works
* more fix
* Remove unneeded change
* Updates from review
* Fixes
* Remove some logic from rewrites to clean up branch
* Use v1.5.0 of agents plugin
* A bunch more additions for general UX flow
* Add missing files
* Add mocks
* Fixes for vet-api, i18n, build, types, etc
* One more linter fix
* Fix i18n and some tests
* Refactors and cleanup in backend code
* remove rogue markdown file
* fixes after refactors from backend
* Add back renamed files, and add tests
* More self code review
* More fixes
* More refactors
* Fix call stack exceeded bug
* Include read messages if there are no unreads
* Fix test failure: use correct error message key for recap permission denied
The getRecapAndCheckOwnership function was using strings.ToLower(callerName)
to generate error keys, which caused 'GetRecap' to become 'getrecap' instead
of the expected 'get'. Changed to use the correct static key that matches
the en.json localization file.
Fixes TestGetRecap/get_recap_by_non-owner test failure.
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
* Consolidate permission errors down to a single string
* Fixes for i18n, worktrees making this difficult
* Fix i18n
* Fix i18n once and for all (for real) (final)
* Fix duplicate getAgents method in client4.ts
* Remove duplicate ai state from initial_state.ts
* Fix types
* Fix tests
* Fix return type of GetAgents and GetServices
* Add tests for recaps components
* Fix types
* Update i18n
* Fixes
* Fixes
* More cleanup
* Revert random file
* Use undefined
* fix linter
* Address feedback
* Missed a git add
* Fixes
* Fix i18n
* Remove fallback
* Fixes for PR
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Nick Misasi <nickmisasi@users.noreply.github.com>
Co-authored-by: Christopher Speller <crspeller@gmail.com>
Co-authored-by: Felipe Martin <me@fmartingr.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2026-01-13 11:59:22 -05:00
|
|
|
|
|
|
|
|
f.EnableAIRecaps = false
|
2026-02-25 10:18:51 -05:00
|
|
|
|
Merge the Integrated Boards MVP feature branch (#35796)
* Add CreatedBy and UpdatedBy to the properties fields and values (#34485)
* Add CreatedBy and UpdatedBy to the properties fields and values
* Fix types
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds ObjectType to the property fields table (#34908)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Update ObjectType migration setting an empty value and marking the column as not null (#34915)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds uniqueness mechanisms to the property fields (#35058)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Fixing retrylayer mocks
* Remove retrylayer duplication
* Address review comments
* Fix comment to avoid linter issues
* Address PR comments
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.down.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.up.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update server/channels/db/migrations/postgres/000157_add_object_type_to_property_fields.up.sql
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Update field validation to check only for valid target types
* Update migrations to avoid concurrent index creation within a transaction
* Update migrations to make all index ops concurrent
* Update tests to use valid PSAv2 property fields
* Adds a helper for valid PSAv2 TargetTypes
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* Fix property tests (#35388)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds Integrated Boards feature flag (#35378)
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds Integrated Boards MVP API changes (#34822)
This PR includes the necessary changes for channels and posts
endpoints and adds a set of generic endpoints to retrieve and manage
property fields and values following the new Property System approach.
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Mattermost Build <build@mattermost.com>
* Property System Architecture permissions for v2 (#35113)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Fix i18n sorting
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Add Views store and app layer (#35361)
* Add Views store and app layer for Integrated Boards
Implements the View entity (model, SQL store, service, app) as described
in the Integrated Boards tech spec. Views are channel-scoped board
configurations with typed props (board, kanban subviews) and soft-delete.
- public/model: View, ViewBoardProps, Subview, ViewPatch types with
PreSave/PreUpdate/IsValid/Patch/Clone/Auditable
- Migration 158: Views table with jsonb Props column and indexes
- SqlViewStore: CRUD with nil-safe Props marshaling (AppendBinaryFlag)
- ViewService: CreateView seeds default kanban subview and links the
boards property field; caches boardPropertyFieldID at startup
- App layer: CreateView/GetView/GetViewsForChannel/UpdateView/DeleteView
with channel-membership permission checks and WebSocket events
(view_created, view_updated, view_deleted)
- doSetupBoardsPropertyField: registers the Boards property group and
board field in NewServer() before ViewService construction
- GetFieldByName now returns store.ErrNotFound instead of raw sql.ErrNoRows
* Move permission checks out of App layer for views
- Remove HasPermissionToChannel calls from all App view methods
- Drop userID params from GetView, GetViewsForChannel, UpdateView, DeleteView
- Fix doSetupBoardsPropertyField to include required TargetType for PSAv2 field
* Make View service generic and enforce board validation in model
- Remove board-specific auto-setup from service and server startup
- Enforce that board views require Props, at least one subview, and at least one linked property in IsValid()
- Move default subview seeding out of app layer; callers must provide valid props
- Call PreSave on subviews during PreUpdate to assign IDs to new subviews
- Update all tests to reflect the new validation requirements
* Restore migrations files to match base branch
* Distinguish ErrNotFound from other errors in view store Get
* Use CONCURRENTLY and nontransactional for index operations in views migration
* Split views index creation into separate nontransactional migrations
* Update migrations.list
* Update i18n translations for views
* Fix makeView helper to include required Props for board view validation
* Rename ctx parameter from c to rctx in OAuthProvider mock
* Remove views service layer, call store directly from app
* Return 500 for unexpected DB errors in GetView, 404 only for not-found
* Harden View model: deep-copy Props, validate linked property IDs
- Add ViewBoardProps.Clone() to deep-copy LinkedProperties and Subviews
- Use it in View.Clone() and View.Patch() to prevent shared-slice aliasing
- Iterate over LinkedProperties in View.IsValid() and reject invalid IDs
with a dedicated i18n key
- Register ViewStore in storetest AssertExpectations so mock expectations
are enforced
- Add tests covering all new behaviours
* Restore autotranslation worker_stopped i18n translation
* Fix view store test IDs and improve error handling in app layer
- Use model.NewId() for linked property IDs in testUpdateView to fix
validation failure (IsValid rejects non-UUID strings)
- Fix import grouping in app/view.go (stdlib imports in one block)
- Return 404 instead of 500 when Update/Delete store calls return
ErrNotFound (e.g. concurrent deletion TOCTOU race)
* Add View store mock to retrylayer test genStore helper
The View store was added to the store interface but the genStore()
helper in retrylayer_test.go was not updated, causing TestRetry to panic.
Also removes the duplicate Recap mock registration.
* Refactor view deletion and websocket event handling; update SQL store methods to use query builder
* revert property field store
* Remove useless migrations
* Add cursor-based pagination to View store GetForChannel
- Add ViewQueryCursor and ViewQueryOpts types with validation
- Return (views, cursor, error) for caller-driven pagination
- PerPage clamping: <=0 defaults to 20, >200 clamps to 200
- Support IncludeDeleted filter
- Add comprehensive store tests for pagination, cursor edge cases,
PerPage clamping, and invalid input rejection
- Add app layer test for empty channelID → 400
- Update interface, retrylayer, timerlayer, and mock signatures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor test loops in ViewStore tests for improved readability
* change pagination to limit/offset
* Add upper-bound limits on View Subviews and LinkedProperties
Defense-in-depth validation: cap Subviews at 50 and LinkedProperties
at 500 to prevent abuse below the 300KB payload limit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* MM-67388, MM-66528, MM-67750: Add View REST API endpoints, websocket events, and sort order (#35442)
* Add Views store and app layer for Integrated Boards
Implements the View entity (model, SQL store, service, app) as described
in the Integrated Boards tech spec. Views are channel-scoped board
configurations with typed props (board, kanban subviews) and soft-delete.
- public/model: View, ViewBoardProps, Subview, ViewPatch types with
PreSave/PreUpdate/IsValid/Patch/Clone/Auditable
- Migration 158: Views table with jsonb Props column and indexes
- SqlViewStore: CRUD with nil-safe Props marshaling (AppendBinaryFlag)
- ViewService: CreateView seeds default kanban subview and links the
boards property field; caches boardPropertyFieldID at startup
- App layer: CreateView/GetView/GetViewsForChannel/UpdateView/DeleteView
with channel-membership permission checks and WebSocket events
(view_created, view_updated, view_deleted)
- doSetupBoardsPropertyField: registers the Boards property group and
board field in NewServer() before ViewService construction
- GetFieldByName now returns store.ErrNotFound instead of raw sql.ErrNoRows
* Move permission checks out of App layer for views
- Remove HasPermissionToChannel calls from all App view methods
- Drop userID params from GetView, GetViewsForChannel, UpdateView, DeleteView
- Fix doSetupBoardsPropertyField to include required TargetType for PSAv2 field
* Make View service generic and enforce board validation in model
- Remove board-specific auto-setup from service and server startup
- Enforce that board views require Props, at least one subview, and at least one linked property in IsValid()
- Move default subview seeding out of app layer; callers must provide valid props
- Call PreSave on subviews during PreUpdate to assign IDs to new subviews
- Update all tests to reflect the new validation requirements
* Restore migrations files to match base branch
* Distinguish ErrNotFound from other errors in view store Get
* Use CONCURRENTLY and nontransactional for index operations in views migration
* Split views index creation into separate nontransactional migrations
* Update migrations.list
* Update i18n translations for views
* Fix makeView helper to include required Props for board view validation
* Rename ctx parameter from c to rctx in OAuthProvider mock
* Remove views service layer, call store directly from app
* Return 500 for unexpected DB errors in GetView, 404 only for not-found
* Harden View model: deep-copy Props, validate linked property IDs
- Add ViewBoardProps.Clone() to deep-copy LinkedProperties and Subviews
- Use it in View.Clone() and View.Patch() to prevent shared-slice aliasing
- Iterate over LinkedProperties in View.IsValid() and reject invalid IDs
with a dedicated i18n key
- Register ViewStore in storetest AssertExpectations so mock expectations
are enforced
- Add tests covering all new behaviours
* Restore autotranslation worker_stopped i18n translation
* Fix view store test IDs and improve error handling in app layer
- Use model.NewId() for linked property IDs in testUpdateView to fix
validation failure (IsValid rejects non-UUID strings)
- Fix import grouping in app/view.go (stdlib imports in one block)
- Return 404 instead of 500 when Update/Delete store calls return
ErrNotFound (e.g. concurrent deletion TOCTOU race)
* Add View store mock to retrylayer test genStore helper
The View store was added to the store interface but the genStore()
helper in retrylayer_test.go was not updated, causing TestRetry to panic.
Also removes the duplicate Recap mock registration.
* Refactor view deletion and websocket event handling; update SQL store methods to use query builder
* revert property field store
* Add View API endpoints with OpenAPI spec, client methods, and i18n
Implement REST API for channel views (board-type) behind the
IntegratedBoards feature flag. Adds CRUD endpoints under
/api/v4/channels/{channel_id}/views with permission checks
matching the channel bookmark pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove useless migrations
* Add cursor-based pagination to View store GetForChannel
- Add ViewQueryCursor and ViewQueryOpts types with validation
- Return (views, cursor, error) for caller-driven pagination
- PerPage clamping: <=0 defaults to 20, >200 clamps to 200
- Support IncludeDeleted filter
- Add comprehensive store tests for pagination, cursor edge cases,
PerPage clamping, and invalid input rejection
- Add app layer test for empty channelID → 400
- Update interface, retrylayer, timerlayer, and mock signatures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add cursor-based pagination to View API for channel views
* Enhance cursor handling in getViewsForChannel and update tests for pagination
* Refactor test loops in ViewStore tests for improved readability
* Refactor loop in TestGetViewsForChannel for improved readability
* change pagination to limit/offset
* switch to limit/offset pagination
* Add upper-bound limits on View Subviews and LinkedProperties
Defense-in-depth validation: cap Subviews at 50 and LinkedProperties
at 500 to prevent abuse below the 300KB payload limit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add view sort order API endpoint
Add POST /api/v4/channels/{channel_id}/views/{view_id}/sort_order
endpoint following the channel bookmarks reorder pattern. Includes
store, app, and API layers with full test coverage at each layer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add connectionId to view WebSocket events and sort_order API spec
Thread connectionId from request header through all view handlers
(create, update, delete, sort_order) to WebSocket events, matching
the channel bookmarks pattern. Add sort_order endpoint to OpenAPI
spec. Update minimum server version to 11.6.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove duplicate View/ViewPatch definitions from definitions.yaml
The merge from integrated-boards-mvp introduced duplicate View and
ViewPatch schema definitions that were already defined earlier in
the file with more detail (including ViewBoardProps ref and enums).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update minimum server version to 11.6 in views API spec
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add missing translations for view sort order error messages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Merge integrated-boards-mvp into ibmvp_api-views; remove spec files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix flaky TestViewStore timestamp test on CI
Add sleep before UpdateSortOrder to ensure timestamps differ,
preventing same-millisecond comparisons on fast CI machines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* remove duplicate views.yaml imclude
* Use c.boolString() for include_deleted query param in GetViewsForChannel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix views.yaml sort order schema: use integer type and require body
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor view sort order tests to use named IDs instead of array indices
Extract idA/idB/idC from views slice and add BEFORE/AFTER comments
to make stateful subtest ordering easier to follow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Return 404 instead of 403 for view operations on deleted channels
Deleted channels should appear non-existent to callers rather than
revealing their existence via a 403. Detailed error text explains
the context for debugging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add missing channel deleteat checks
* Use c.Params.Page instead of manual page query param parsing in getViewsForChannel
c.Params already validates and defaults page/per_page, so the manual
parsing was redundant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add support for total count in views retrieval
* Add tests for handling deleted views in GetViewsForChannel and GetView
* Short-circuit negative newIndex in UpdateSortOrder before opening transaction
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add per-channel limit on views to bound UpdateSortOrder cost
Without a cap, unbounded view creation makes sort-order updates
increasingly expensive (CASE WHEN per view, row locks). Adds
MaxViewsPerChannel=50 constant and enforces it in the app layer
before saving. Includes API and app layer tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove include_deleted support from views API
Soft-deleted views are structural metadata with low risk, but no other
similar endpoint (e.g. channel bookmarks) exposes deleted records without
an admin gate. Rather than adding an admin-only permission check for
consistency, remove the feature entirely since there is no current use case.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update view permissions to require `create_post` instead of channel management permissions
* Remove obsolete view management error messages for direct and group messages
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat(migrations): add user tracking and object type to property fields
- Introduced user tracking columns (CreatedBy, UpdatedBy) to PropertyFields and PropertyValues.
- Added ObjectType column to PropertyFields with associated unique indexes for legacy and typed properties.
- Created new migration scripts for adding and dropping these features, including necessary indexes for data integrity.
- Established views for managing property fields with new attributes.
This update enhances the schema to support better tracking and categorization of property fields.
* Add Property System Architecture v2 API endpoints (#35583)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Adds the Property System Architecture v2 API endpoints
* Adds permission checks to the create field endpoint
* Add target access checks to value endpoints
* Add default branches for object_type and target_type and extra guards for cursor client4 methods
* Fix vet API mismatch
* Fix error checks
* Fix linter
* Add merge semantics for property patch logic and API endpoint
* Fix i18n
* Fix duplicated patch elements and early return on bad cursor
* Update docs to use enums
* Fix i18n sorting
* Update app layer to return model.AppError
* Adds a limit to the number of property values that can be patched in the same request
* Require target_type filter when searching property fields
* Add objectType validation as part of field.IsValid()
* Fix linter
* Fix test with bad objecttpye
* Fix test grouping
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* MM-67968: Flatten view model — remove icon, subviews, typed board props (#35726)
* feat(views): flatten view model by removing icon, subview, and board props
Simplifies the View data model as part of MM-67968: removes Icon, Subview,
and ViewBoardProps types; renames ViewTypeBoard to ViewTypeKanban; replaces
typed Props with StringInterface (map[string]any); adds migration 000167
to drop the Icon column from the Views table.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* feat(api): update views OpenAPI spec to reflect flattened model
Removes ViewBoardProps, Subview, and icon from the View and ViewPatch
schemas. Changes type enum from board to kanban. Replaces typed props
with a free-form StringInterface object. Aligns with MM-67968.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* refactor(views): simplify store by dropping dbView and marshalViewProps
StringInterface already implements driver.Valuer and sql.Scanner, so the
manual JSON marshal/unmarshal and the dbView intermediate struct were
redundant. model.View now scans directly from the database. Also removes
the dead ViewMaxLinkedProperties constant and wraps the Commit() error in
UpdateSortOrder.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(api): allow arbitrary JSON in view props OpenAPI schema
The props field was restricted to string values via
additionalProperties: { type: string }, conflicting with the Go model's
StringInterface (map[string]any). Changed to additionalProperties: true
in View, ViewPatch, and inline POST schemas.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* Adds basic implementation of the generic redux store for PSAv2 (#35512)
* Adds basic implementation of the generic redux store for PSAv2
* Add created_by and updated_by to the test fixtures
* Make target_id, target_type and object_type mandatory
* Wrap getPropertyFieldsByIds and getPropertyValuesForTargetByFieldIds with createSelector
* Address PR comments
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* Adds websocket messages for the PSAv2 API events (#35696)
* Adds uniqueness mechanisms to the property fields
After adding ObjectType, this commit ensures that both the PSAv1 and
PSAv2 schemas are supported, and enforces property uniqueness through
both database indexes and a logical check when creating new property
fields.
* Adds uniqueness check to property updates
Updates are covered on this commit and we refactor as well the SQL
code to use the squirrel builder and work better with the conditional
addition of the `existingID` piece of the query.
* Add translations to error messages
* Add the permissions to the migrations, model and update the store calls
* Adds the property field and property group app layer
* Adds authorization helpers for property fields and values
* Make sure that users cannot lock themselves out of property fields
* Migrate permissions from a JSON column to three normalized columns
* Remove the audit comment
* Use target level constants in authorization
* Log authorization membership failures
* Rename admin to sysadmin
* Adds the Property System Architecture v2 API endpoints
* Adds permission checks to the create field endpoint
* Add target access checks to value endpoints
* Add default branches for object_type and target_type and extra guards for cursor client4 methods
* Fix vet API mismatch
* Fix error checks
* Fix linter
* Add merge semantics for property patch logic and API endpoint
* Fix i18n
* Fix duplicated patch elements and early return on bad cursor
* Update docs to use enums
* Fix i18n sorting
* Update app layer to return model.AppError
* Adds a limit to the number of property values that can be patched in the same request
* Adds websocket messages for the PSAv2 API events
* Add IsPSAv2 helper to the property field for clarity
* Add guard against nil returns on field deletion
* Add docs to the websocket endpoints
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
* migrations: consolidate views migrations and reorder after master
- Merged 000165 (create Views) with 000167 (drop Icon) since Icon was never needed
- Renumbered branch migrations 159-166 → 160-167 so master's 000159 (deduplicate_policy_names) runs first
- Regenerated migrations.list
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add API endpoint to retrieve posts for a specific view (#35604)
Automatic Merge
* Apply fixes after merge
* Return a more specific error from getting multiple fields
* Prevent getting broadcast params on field deletion if not needed
* Remove duplicated migration code
* Update property conflict code to always use master
* Adds nil guard when iterating on property fields
* Check that permission level is valid before getting rejected by the database
* Validate correctness on TargetID for PSAv2 fields
* Avoid PSAv1 using permissions or protected
* Fix test data after validation change
* Fix flaky search test
* Adds more posts for filter use cases to properly test exclusions
---------
Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Julien Tant <julien@craftyx.fr>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Julien Tant <785518+JulienTant@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 05:36:35 -04:00
|
|
|
f.IntegratedBoards = false
|
|
|
|
|
|
2026-02-25 10:18:51 -05:00
|
|
|
f.CJKSearch = false
|
2021-01-04 16:21:02 -05:00
|
|
|
}
|
2022-05-10 13:29:48 -04:00
|
|
|
|
2021-04-27 11:58:38 -04:00
|
|
|
// ToMap returns the feature flags as a map[string]string
|
|
|
|
|
// Supports boolean and string feature flags.
|
|
|
|
|
func (f *FeatureFlags) ToMap() map[string]string {
|
|
|
|
|
refStructVal := reflect.ValueOf(*f)
|
2025-11-04 06:09:11 -05:00
|
|
|
refStructType := reflect.TypeFor[FeatureFlags]()
|
2021-04-27 11:58:38 -04:00
|
|
|
ret := make(map[string]string)
|
|
|
|
|
for i := 0; i < refStructVal.NumField(); i++ {
|
|
|
|
|
refFieldVal := refStructVal.Field(i)
|
|
|
|
|
if !refFieldVal.IsValid() {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
refFieldType := refStructType.Field(i)
|
|
|
|
|
switch refFieldType.Type.Kind() {
|
|
|
|
|
case reflect.Bool:
|
|
|
|
|
ret[refFieldType.Name] = strconv.FormatBool(refFieldVal.Bool())
|
|
|
|
|
default:
|
|
|
|
|
ret[refFieldType.Name] = refFieldVal.String()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
}
|