[MM-52924] Implement ConfigurationWillBeSaved plugin hook (#23567)

* Implement ConfigurationWillBeSaved plugin hook

* Add comment

* Update comment

* Fix potential nil dereference if plugin environment is unset

* Address PR review
Этот коммит содержится в:
Claudio Costa
2023-06-12 18:23:02 -06:00
коммит произвёл GitHub
родитель d0ad46b496
Коммит 62a3ee8adc
10 изменённых файлов: 267 добавлений и 9 удалений

Просмотреть файл

@@ -0,0 +1,27 @@
package main
import (
"fmt"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
)
type TestPlugin struct {
plugin.MattermostPlugin
}
func (p *TestPlugin) OnActivate() error {
fmt.Println("activated")
return nil
}
// This acts like a template as the content of this file gets passed to
// fmt.Sprintf to inject additional logic based on the test case.
func (p *TestPlugin) ConfigurationWillBeSaved(newCfg *model.Config) (*model.Config, error) {
%s
}
func main() {
plugin.ClientMain(&TestPlugin{})
}