MM-30338 Add feature flag for collapsedthreads (#16598)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aa64bde1e1
Коммит
110ac3b1ec
@@ -6,6 +6,7 @@ package api4
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -5405,6 +5406,9 @@ func TestGetThreadsForUser(t *testing.T) {
|
|||||||
func TestThreadSocketEvents(t *testing.T) {
|
func TestThreadSocketEvents(t *testing.T) {
|
||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
|
||||||
|
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
|
||||||
|
|
||||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||||
*cfg.ServiceSettings.ThreadAutoFollow = true
|
*cfg.ServiceSettings.ThreadAutoFollow = true
|
||||||
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
||||||
@@ -5548,6 +5552,8 @@ func TestFollowThreads(t *testing.T) {
|
|||||||
func TestMaintainUnreadRepliesInThread(t *testing.T) {
|
func TestMaintainUnreadRepliesInThread(t *testing.T) {
|
||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
|
||||||
|
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
|
||||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||||
*cfg.ServiceSettings.ThreadAutoFollow = true
|
*cfg.ServiceSettings.ThreadAutoFollow = true
|
||||||
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
||||||
@@ -5619,6 +5625,8 @@ func TestMaintainUnreadMentionsInThread(t *testing.T) {
|
|||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
Client := th.Client
|
Client := th.Client
|
||||||
|
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
|
||||||
|
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
|
||||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||||
*cfg.ServiceSettings.ThreadAutoFollow = true
|
*cfg.ServiceSettings.ThreadAutoFollow = true
|
||||||
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
|
|
||||||
a.Publish(message)
|
a.Publish(message)
|
||||||
// If this is a reply in a thread, notify participants
|
// 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)
|
thread, err := a.Srv().Store.Thread().Get(post.RootId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "cannot get thread %q", post.RootId)
|
return nil, errors.Wrapf(err, "cannot get thread %q", post.RootId)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ type FeatureFlags struct {
|
|||||||
// Toggle on and off scheduled jobs for cloud user limit emails see MM-29999
|
// Toggle on and off scheduled jobs for cloud user limit emails see MM-29999
|
||||||
CloudDelinquentEmailJobsEnabled bool
|
CloudDelinquentEmailJobsEnabled bool
|
||||||
|
|
||||||
|
// Toggle on and off support for Collapsed Threads
|
||||||
|
CollapsedThreads bool
|
||||||
// Feature flags to control plugin versions
|
// Feature flags to control plugin versions
|
||||||
PluginIncidentManagement string `plugin_id:"com.mattermost.plugin-incident-management"`
|
PluginIncidentManagement string `plugin_id:"com.mattermost.plugin-incident-management"`
|
||||||
}
|
}
|
||||||
@@ -24,7 +26,7 @@ func (f *FeatureFlags) SetDefaults() {
|
|||||||
f.TestFeature = "off"
|
f.TestFeature = "off"
|
||||||
f.TestBoolFeature = false
|
f.TestBoolFeature = false
|
||||||
f.CloudDelinquentEmailJobsEnabled = false
|
f.CloudDelinquentEmailJobsEnabled = false
|
||||||
|
f.CollapsedThreads = false
|
||||||
f.PluginIncidentManagement = "1.1.1"
|
f.PluginIncidentManagement = "1.1.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user