Files
mostlymatter/server/public/model/feature_flags.go
Harshil Sharma d1e5fdea2c Content flagging systems console settings (#31411)
* Added enable/disable setting and feature flag

* added rest of notifgication settings

* Added backend for content flagging setting and populated notification values from server side defaults

* WIP user selector

* Added common reviewers UI

* Added additonal reviewers section

* WIP

* WIP

* Team table base

* Added search in teams

* Added search in teams

* Added additional settings section

* WIP

* Inbtegrated reviewers settings

* WIP

* WIP

* Added server side validation

* cleanup

* cleanup

* [skip ci]

* Some refactoring

* type fixes

* lint fix

* test: add content flagging settings test file

* test: add comprehensive unit tests for content flagging settings

* enhanced tests

* test: add test file for content flagging additional settings

* test: add comprehensive unit tests for ContentFlaggingAdditionalSettingsSection

* Added additoonal settings test

* test: add empty test file for team reviewers section

* test: add comprehensive unit tests for TeamReviewersSection component

* test: update tests to handle async data fetching in team reviewers section

* test: add empty test file for content reviewers component

* feat: add comprehensive unit tests for ContentFlaggingContentReviewers component

* Added ContentFlaggingContentReviewersContentFlaggingContentReviewers test

* test: add notification settings test file for content flagging

* test: add comprehensive unit tests for content flagging notification settings

* Added ContentFlaggingNotificationSettingsSection tests

* test: add user profile pill test file

* test: add comprehensive unit tests for UserProfilePill component

* refactor: Replace enzyme shallow with renderWithContext in user_profile_pill tests

* Added UserProfilePill tests

* test: add empty test file for content reviewers team option

* test: add comprehensive unit tests for TeamOptionComponent

* Added TeamOptionComponent tests

* test: add empty test file for reason_option component

* test: add comprehensive unit tests for ReasonOption component

* Added ReasonOption tests

* cleanup

* Fixed i18n error

* fixed e2e test lijnt issues

* Updated test cases

* Added snaoshot

* Updated snaoshot

* lint fix

* lint fix

* review fixes

* updated snapshot

* CI

* Review fixes

* Removed an test, updated comment

* CI

* Test update
2025-07-10 17:47:16 +05:30

126 строки
3.1 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"reflect"
"strconv"
)
type FeatureFlags struct {
// Exists only for unit and manual testing.
// When set to a value, will be returned by the ping endpoint.
TestFeature string
// Exists only for testing bool functionality. Boolean feature flags interpret "on" or "true" as true and
// all other values as false.
TestBoolFeature bool
// Enable the remote cluster service for shared channels.
EnableRemoteClusterService bool
// Enable DMs and GMs for shared channels.
EnableSharedChannelsDMs bool
// Enable plugins in shared channels.
EnableSharedChannelsPlugins bool
// Enable synchronization of channel members in shared channels
EnableSharedChannelsMemberSync bool
// Enable syncing all users for remote clusters in shared channels
EnableSyncAllUsersForRemoteCluster bool
// AppsEnabled toggles the Apps framework functionalities both in server and client side
AppsEnabled bool
PermalinkPreviews bool
NormalizeLdapDNs bool
// Enable WYSIWYG text editor
WysiwygEditor bool
OnboardingTourTips bool
DeprecateCloudFree bool
EnableExportDirectDownload bool
MoveThreadsEnabled bool
StreamlinedMarketplace bool
CloudIPFiltering bool
ConsumePostHook bool
CloudAnnualRenewals bool
CloudDedicatedExportUI bool
ChannelBookmarks bool
WebSocketEventScope bool
NotificationMonitoring bool
ExperimentalAuditSettingsSystemConsoleUI bool
CustomProfileAttributes bool
AttributeBasedAccessControl bool
ContentFlagging bool
}
func (f *FeatureFlags) SetDefaults() {
f.TestFeature = "off"
f.TestBoolFeature = false
f.EnableRemoteClusterService = false
f.EnableSharedChannelsDMs = false
f.EnableSharedChannelsMemberSync = false
f.EnableSyncAllUsersForRemoteCluster = false
f.EnableSharedChannelsPlugins = true
f.AppsEnabled = false
f.NormalizeLdapDNs = false
f.DeprecateCloudFree = false
f.WysiwygEditor = false
f.OnboardingTourTips = true
f.EnableExportDirectDownload = false
f.MoveThreadsEnabled = false
f.StreamlinedMarketplace = true
f.CloudIPFiltering = false
f.ConsumePostHook = false
f.CloudAnnualRenewals = false
f.CloudDedicatedExportUI = false
f.ChannelBookmarks = true
f.WebSocketEventScope = true
f.NotificationMonitoring = true
f.ExperimentalAuditSettingsSystemConsoleUI = true
f.CustomProfileAttributes = true
f.AttributeBasedAccessControl = true
f.ContentFlagging = false
}
// 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)
refStructType := reflect.TypeOf(*f)
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
}