MM-13851 Added a UserWasCreated hook for server-side plugins (#10178)
Этот коммит содержится в:
11
app/user.go
11
app/user.go
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
"github.com/mattermost/mattermost-server/mlog"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/plugin"
|
||||
"github.com/mattermost/mattermost-server/services/mfa"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mattermost/mattermost-server/utils/fileutils"
|
||||
@@ -212,6 +213,16 @@ func (a *App) CreateUser(user *model.User) (*model.User, *model.AppError) {
|
||||
message.Add("user_id", ruser.Id)
|
||||
a.Publish(message)
|
||||
|
||||
if pluginsEnvironment := a.GetPluginsEnvironment(); pluginsEnvironment != nil {
|
||||
a.Srv.Go(func() {
|
||||
pluginContext := a.PluginContext()
|
||||
pluginsEnvironment.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
|
||||
hooks.UserHasBeenCreated(pluginContext, user)
|
||||
return true
|
||||
}, plugin.UserHasBeenCreatedId)
|
||||
})
|
||||
}
|
||||
|
||||
return ruser, nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user