Enable to AI plugin by default (#28770)
* Enable to AI plugin by default * Fix tests.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
77862dd581
Коммит
728eae2cb5
@@ -789,6 +789,9 @@ func TestDiff(t *testing.T) {
|
|||||||
"com.mattermost.calls": {
|
"com.mattermost.calls": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
|
"mattermost-ai": {
|
||||||
|
Enable: true,
|
||||||
|
},
|
||||||
"playbooks": {
|
"playbooks": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
@@ -821,6 +824,9 @@ func TestDiff(t *testing.T) {
|
|||||||
"com.mattermost.calls": {
|
"com.mattermost.calls": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
|
"mattermost-ai": {
|
||||||
|
Enable: true,
|
||||||
|
},
|
||||||
"playbooks": {
|
"playbooks": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
@@ -845,6 +851,9 @@ func TestDiff(t *testing.T) {
|
|||||||
"com.mattermost.calls": {
|
"com.mattermost.calls": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
|
"mattermost-ai": {
|
||||||
|
Enable: true,
|
||||||
|
},
|
||||||
"playbooks": {
|
"playbooks": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3190,6 +3190,11 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
|||||||
s.PluginStates[PluginIdPlaybooks] = &PluginState{Enable: true}
|
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 {
|
if s.EnableMarketplace == nil {
|
||||||
s.EnableMarketplace = NewPointer(PluginSettingsDefaultEnableMarketplace)
|
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) {
|
func TestConfigGetMessageRetentionHours(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ const (
|
|||||||
PluginIdCalls = "com.mattermost.calls"
|
PluginIdCalls = "com.mattermost.calls"
|
||||||
PluginIdNPS = "com.mattermost.nps"
|
PluginIdNPS = "com.mattermost.nps"
|
||||||
PluginIdChannelExport = "com.mattermost.plugin-channel-export"
|
PluginIdChannelExport = "com.mattermost.plugin-channel-export"
|
||||||
|
PluginIdAI = "mattermost-ai"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ var InstalledIntegrationsIgnoredPlugins = map[string]struct{}{
|
|||||||
PluginIdCalls: {},
|
PluginIdCalls: {},
|
||||||
PluginIdNPS: {},
|
PluginIdNPS: {},
|
||||||
PluginIdChannelExport: {},
|
PluginIdChannelExport: {},
|
||||||
|
PluginIdAI: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
type InstalledIntegration struct {
|
type InstalledIntegration struct {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user