MM-30338 Add feature flag for collapsedthreads (#16598)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Eli Yukelzon
2021-01-13 12:42:35 +02:00
committed by GitHub
parent aa64bde1e1
commit 110ac3b1ec
3 changed files with 12 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ package api4
import (
"fmt"
"net/http"
"os"
"regexp"
"strings"
"testing"
@@ -5405,6 +5406,9 @@ func TestGetThreadsForUser(t *testing.T) {
func TestThreadSocketEvents(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.ThreadAutoFollow = true
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
@@ -5548,6 +5552,8 @@ func TestFollowThreads(t *testing.T) {
func TestMaintainUnreadRepliesInThread(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.ThreadAutoFollow = true
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
@@ -5619,6 +5625,8 @@ func TestMaintainUnreadMentionsInThread(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
Client := th.Client
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.ThreadAutoFollow = true
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON

View File

@@ -420,7 +420,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
a.Publish(message)
// If this is a reply in a thread, notify participants
if *a.Config().ServiceSettings.CollapsedThreads != model.COLLAPSED_THREADS_DISABLED && post.RootId != "" {
if a.Config().FeatureFlags.CollapsedThreads && *a.Config().ServiceSettings.CollapsedThreads != model.COLLAPSED_THREADS_DISABLED && post.RootId != "" {
thread, err := a.Srv().Store.Thread().Get(post.RootId)
if err != nil {
return nil, errors.Wrapf(err, "cannot get thread %q", post.RootId)

View File

@@ -16,6 +16,8 @@ type FeatureFlags struct {
// Toggle on and off scheduled jobs for cloud user limit emails see MM-29999
CloudDelinquentEmailJobsEnabled bool
// Toggle on and off support for Collapsed Threads
CollapsedThreads bool
// Feature flags to control plugin versions
PluginIncidentManagement string `plugin_id:"com.mattermost.plugin-incident-management"`
}
@@ -24,7 +26,7 @@ func (f *FeatureFlags) SetDefaults() {
f.TestFeature = "off"
f.TestBoolFeature = false
f.CloudDelinquentEmailJobsEnabled = false
f.CollapsedThreads = false
f.PluginIncidentManagement = "1.1.1"
}