summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-07-06 06:07:09 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-07-06 09:07:09 -0400
commit4c1ddcff10b359baf5728b334acb60cc3e1b1123 (patch)
tree40e9ae1aa914c7a8676da8ae3e10fbc8e2b36d95 /app/post.go
parent7bfb5aec26c6bb8c49fa19e8347bc91acc86fe92 (diff)
downloadchat-4c1ddcff10b359baf5728b334acb60cc3e1b1123.tar.gz
chat-4c1ddcff10b359baf5728b334acb60cc3e1b1123.tar.bz2
chat-4c1ddcff10b359baf5728b334acb60cc3e1b1123.zip
MM-10703 Adding blank request context to plugin hooks for future use. (#9043)
* Adding blank request context to plugin hooks for future use. * Rename RequestContext to Context * Adding context to ServeHTTP and ExecuteCommand * Fixing import cycle in test.
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/post.go b/app/post.go
index 7e53de2f9..8d94aba2e 100644
--- a/app/post.go
+++ b/app/post.go
@@ -163,8 +163,9 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo
if a.PluginsReady() {
var rejectionReason string
+ pluginContext := &plugin.Context{}
a.Plugins.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
- post, rejectionReason = hooks.MessageWillBePosted(post)
+ post, rejectionReason = hooks.MessageWillBePosted(pluginContext, post)
return post != nil
}, plugin.MessageWillBePostedId)
if post == nil {
@@ -181,8 +182,9 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo
if a.PluginsReady() {
a.Go(func() {
+ pluginContext := &plugin.Context{}
a.Plugins.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
- hooks.MessageHasBeenPosted(rpost)
+ hooks.MessageHasBeenPosted(pluginContext, rpost)
return true
}, plugin.MessageHasBeenPostedId)
})
@@ -394,8 +396,9 @@ func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model
if a.PluginsReady() {
var rejectionReason string
+ pluginContext := &plugin.Context{}
a.Plugins.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
- newPost, rejectionReason = hooks.MessageWillBeUpdated(newPost, oldPost)
+ newPost, rejectionReason = hooks.MessageWillBeUpdated(pluginContext, newPost, oldPost)
return post != nil
}, plugin.MessageWillBeUpdatedId)
if newPost == nil {
@@ -410,8 +413,9 @@ func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model
if a.PluginsReady() {
a.Go(func() {
+ pluginContext := &plugin.Context{}
a.Plugins.RunMultiPluginHook(func(hooks plugin.Hooks) bool {
- hooks.MessageHasBeenUpdated(newPost, oldPost)
+ hooks.MessageHasBeenUpdated(pluginContext, newPost, oldPost)
return true
}, plugin.MessageHasBeenUpdatedId)
})