GH-9737: Allow setting min_server_version in plugin manifest (#9743)
* Add github.com/blang/semver as vendor * Add MinServerVersion check for plugins * Add tests for MinServerVersion in manifest * Move logic to model/manifest.go & add tests
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
bce7a7c73d
Коммит
789b2f72dd
@@ -166,6 +166,16 @@ func (env *Environment) Activate(id string) (manifest *model.Manifest, activated
|
||||
env.activePlugins.Store(pluginInfo.Manifest.Id, activePlugin)
|
||||
}()
|
||||
|
||||
if pluginInfo.Manifest.MinServerVersion != "" {
|
||||
fulfilled, err := pluginInfo.Manifest.MeetMinServerVersion(model.CurrentVersion)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("%v: %v", err.Error(), id)
|
||||
}
|
||||
if !fulfilled {
|
||||
return nil, false, fmt.Errorf("plugin requires Mattermost %v: %v", pluginInfo.Manifest.MinServerVersion, id)
|
||||
}
|
||||
}
|
||||
|
||||
componentActivated := false
|
||||
|
||||
if pluginInfo.Manifest.HasWebapp() {
|
||||
|
||||
Ссылка в новой задаче
Block a user