mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Enable to AI plugin by default (#28770)
* Enable to AI plugin by default * Fix tests.
This commit is contained in:
committed by
GitHub
parent
77862dd581
commit
728eae2cb5
@@ -789,6 +789,9 @@ func TestDiff(t *testing.T) {
|
||||
"com.mattermost.calls": {
|
||||
Enable: true,
|
||||
},
|
||||
"mattermost-ai": {
|
||||
Enable: true,
|
||||
},
|
||||
"playbooks": {
|
||||
Enable: true,
|
||||
},
|
||||
@@ -821,6 +824,9 @@ func TestDiff(t *testing.T) {
|
||||
"com.mattermost.calls": {
|
||||
Enable: true,
|
||||
},
|
||||
"mattermost-ai": {
|
||||
Enable: true,
|
||||
},
|
||||
"playbooks": {
|
||||
Enable: true,
|
||||
},
|
||||
@@ -845,6 +851,9 @@ func TestDiff(t *testing.T) {
|
||||
"com.mattermost.calls": {
|
||||
Enable: true,
|
||||
},
|
||||
"mattermost-ai": {
|
||||
Enable: true,
|
||||
},
|
||||
"playbooks": {
|
||||
Enable: true,
|
||||
},
|
||||
|
||||
@@ -3190,6 +3190,11 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
s.PluginStates[PluginIdPlaybooks] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.PluginStates[PluginIdAI] == nil {
|
||||
// Enable the AI plugin by default
|
||||
s.PluginStates[PluginIdAI] = &PluginState{Enable: true}
|
||||
}
|
||||
|
||||
if s.EnableMarketplace == nil {
|
||||
s.EnableMarketplace = NewPointer(PluginSettingsDefaultEnableMarketplace)
|
||||
}
|
||||
|
||||
@@ -1800,6 +1800,39 @@ func TestConfigDefaultCallsPluginState(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestConfigDefaultAIPluginState(t *testing.T) {
|
||||
t.Run("should enable AI plugin by default on self-hosted", func(t *testing.T) {
|
||||
c1 := Config{}
|
||||
c1.SetDefaults()
|
||||
|
||||
assert.True(t, c1.PluginSettings.PluginStates["mattermost-ai"].Enable)
|
||||
})
|
||||
|
||||
t.Run("should enable AI plugin by default on Cloud", func(t *testing.T) {
|
||||
os.Setenv("MM_CLOUD_INSTALLATION_ID", "test")
|
||||
defer os.Unsetenv("MM_CLOUD_INSTALLATION_ID")
|
||||
c1 := Config{}
|
||||
c1.SetDefaults()
|
||||
|
||||
assert.True(t, c1.PluginSettings.PluginStates["mattermost-ai"].Enable)
|
||||
})
|
||||
|
||||
t.Run("should not re-enable AI plugin after it has been disabled", func(t *testing.T) {
|
||||
c1 := Config{
|
||||
PluginSettings: PluginSettings{
|
||||
PluginStates: map[string]*PluginState{
|
||||
"mattermost-ai": {
|
||||
Enable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
c1.SetDefaults()
|
||||
assert.False(t, c1.PluginSettings.PluginStates["mattermost-ai"].Enable)
|
||||
})
|
||||
}
|
||||
|
||||
func TestConfigGetMessageRetentionHours(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -10,4 +10,5 @@ const (
|
||||
PluginIdCalls = "com.mattermost.calls"
|
||||
PluginIdNPS = "com.mattermost.nps"
|
||||
PluginIdChannelExport = "com.mattermost.plugin-channel-export"
|
||||
PluginIdAI = "mattermost-ai"
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ var InstalledIntegrationsIgnoredPlugins = map[string]struct{}{
|
||||
PluginIdCalls: {},
|
||||
PluginIdNPS: {},
|
||||
PluginIdChannelExport: {},
|
||||
PluginIdAI: {},
|
||||
}
|
||||
|
||||
type InstalledIntegration struct {
|
||||
|
||||
Reference in New Issue
Block a user