Skip to content

Commit

Permalink
[MM-43065] Fix not able to set plugin settings
Browse files Browse the repository at this point in the history
Fixes: mattermost/mmctl#427
Closes: mattermost#21013

Handles below cases:
- Uploading through API
- Installing through URL
- Installing from Marketplace
  • Loading branch information
ChandanChainani committed Apr 5, 2023
1 parent 067784d commit ff9a8f8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/channels/app/plugin_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ func (ch *Channels) installPlugin(pluginFile, signature io.ReadSeeker, installat
mlog.Warn("Failed to notify plugin status changed", mlog.Err(err))
}

ch.cfgSvc.UpdateConfig(func(cfg *model.Config) {
if _, ok := cfg.PluginSettings.Plugins[manifest.Id]; !ok {
cfg.PluginSettings.Plugins[manifest.Id] = make(map[string]any)
}

for _, pluginSetting := range manifest.SettingsSchema.Settings {
cfg.PluginSettings.Plugins[manifest.Id][pluginSetting.Key] = pluginSetting.Default
}
})

return manifest, nil
}

Expand Down

0 comments on commit ff9a8f8

Please sign in to comment.