Skip to content

Commit

Permalink
MM-28103: prepackage incident-response (#15360) (#15429)
Browse files Browse the repository at this point in the history
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
  • Loading branch information
lieut-data and mattermod committed Sep 11, 2020
1 parent c1ac3e6 commit 7dfe24e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ PLUGIN_PACKAGES += mattermost-plugin-antivirus-v0.1.2
PLUGIN_PACKAGES += mattermost-plugin-jira-v2.3.2
PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.1.0
PLUGIN_PACKAGES += mattermost-plugin-jenkins-v1.0.0
PLUGIN_PACKAGES += mattermost-plugin-incident-response-v0.6.0

# Prepares the enterprise build if exists. The IGNORE stuff is a hack to get the Makefile to execute the commands outside a target
ifeq ($(BUILD_ENTERPRISE_READY),true)
Expand Down
5 changes: 5 additions & 0 deletions model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,11 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
s.PluginStates["com.mattermost.nps"] = &PluginState{Enable: ls.EnableDiagnostics == nil || *ls.EnableDiagnostics}
}

if s.PluginStates["com.mattermost.plugin-incident-response"] == nil {
// Enable the incident response plugin by default
s.PluginStates["com.mattermost.plugin-incident-response"] = &PluginState{Enable: true}
}

if s.EnableMarketplace == nil {
s.EnableMarketplace = NewBool(PLUGIN_SETTINGS_DEFAULT_ENABLE_MARKETPLACE)
}
Expand Down
25 changes: 25 additions & 0 deletions model/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,31 @@ func TestConfigDefaultNPSPluginState(t *testing.T) {
})
}

func TestConfigDefaultIncidentResponsePluginState(t *testing.T) {
t.Run("should enable IncidentResponse plugin by default", func(t *testing.T) {
c1 := Config{}
c1.SetDefaults()

assert.True(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-incident-response"].Enable)
})

t.Run("should not re-enable IncidentResponse plugin after it has been disabled", func(t *testing.T) {
c1 := Config{
PluginSettings: PluginSettings{
PluginStates: map[string]*PluginState{
"com.mattermost.plugin-incident-response": {
Enable: false,
},
},
},
}

c1.SetDefaults()

assert.False(t, c1.PluginSettings.PluginStates["com.mattermost.plugin-incident-response"].Enable)
})
}

func TestTeamSettingsIsValidSiteNameEmpty(t *testing.T) {
c1 := Config{}
c1.SetDefaults()
Expand Down

0 comments on commit 7dfe24e

Please sign in to comment.