mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* 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 * Added base APIs * Fetched team status data on load and team switch * WIP * Review fixes * wip * WIP * Removed an test, updated comment * CI * Added tests * Added tests * Lint fix * Added API specs * Fixed types * CI fixes * API tests * lint fixes * Set env variable so API routes are regiustered * Test update * term renaming and disabling API tests on MySQL * typo * Updated store type definition * Minor tweaks * Updated tests and docs * finction rename * Updated tests * refactor * lint fix * Removed unnecesseery nil check * Updated error code order in API docs
73 lines
2.7 KiB
Go
73 lines
2.7 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestContentFlaggingEnabledForTeam(t *testing.T) {
|
|
getBaseConfig := func() *model.Config {
|
|
contentFlaggingSettings := model.ContentFlaggingSettings{}
|
|
contentFlaggingSettings.SetDefaults()
|
|
|
|
return &model.Config{
|
|
ContentFlaggingSettings: contentFlaggingSettings,
|
|
}
|
|
}
|
|
t.Run("should return true for common reviewers", func(t *testing.T) {
|
|
config := getBaseConfig()
|
|
config.ContentFlaggingSettings.ReviewerSettings.CommonReviewers = model.NewPointer(true)
|
|
config.ContentFlaggingSettings.ReviewerSettings.CommonReviewerIds = &[]string{"reviewer_user_id_1", "reviewer_user_id_2"}
|
|
|
|
status := ContentFlaggingEnabledForTeam(config, "team1")
|
|
require.True(t, status, "expected team post reporting feature to be enabled for common reviewers")
|
|
})
|
|
|
|
t.Run("should return true when configured for specified team", func(t *testing.T) {
|
|
config := getBaseConfig()
|
|
config.ContentFlaggingSettings.ReviewerSettings.CommonReviewers = model.NewPointer(false)
|
|
config.ContentFlaggingSettings.ReviewerSettings.TeamReviewersSetting = &map[string]model.TeamReviewerSetting{
|
|
"team1": {
|
|
Enabled: model.NewPointer(true),
|
|
ReviewerIds: model.NewPointer([]string{"reviewer_user_id_1"}),
|
|
},
|
|
}
|
|
|
|
status := ContentFlaggingEnabledForTeam(config, "team1")
|
|
require.True(t, status, "expected team post reporting feature to be disabled for team without reviewers")
|
|
})
|
|
|
|
t.Run("should return true when using Additional Reviewers", func(t *testing.T) {
|
|
config := getBaseConfig()
|
|
config.ContentFlaggingSettings.ReviewerSettings.CommonReviewers = model.NewPointer(false)
|
|
config.ContentFlaggingSettings.ReviewerSettings.TeamAdminsAsReviewers = model.NewPointer(true)
|
|
config.ContentFlaggingSettings.ReviewerSettings.TeamReviewersSetting = &map[string]model.TeamReviewerSetting{
|
|
"team1": {
|
|
Enabled: model.NewPointer(true),
|
|
},
|
|
}
|
|
|
|
status := ContentFlaggingEnabledForTeam(config, "team1")
|
|
require.True(t, status)
|
|
|
|
config = getBaseConfig()
|
|
config.ContentFlaggingSettings.ReviewerSettings.TeamAdminsAsReviewers = model.NewPointer(false)
|
|
config.ContentFlaggingSettings.ReviewerSettings.SystemAdminsAsReviewers = model.NewPointer(true)
|
|
|
|
status = ContentFlaggingEnabledForTeam(config, "team1")
|
|
require.True(t, status)
|
|
|
|
config = getBaseConfig()
|
|
config.ContentFlaggingSettings.ReviewerSettings.TeamAdminsAsReviewers = model.NewPointer(true)
|
|
config.ContentFlaggingSettings.ReviewerSettings.SystemAdminsAsReviewers = model.NewPointer(true)
|
|
|
|
status = ContentFlaggingEnabledForTeam(config, "team1")
|
|
require.True(t, status)
|
|
})
|
|
}
|