diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-07-06 06:07:09 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-07-06 09:07:09 -0400 |
commit | 4c1ddcff10b359baf5728b334acb60cc3e1b1123 (patch) | |
tree | 40e9ae1aa914c7a8676da8ae3e10fbc8e2b36d95 /plugin/hooks.go | |
parent | 7bfb5aec26c6bb8c49fa19e8347bc91acc86fe92 (diff) | |
download | chat-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 'plugin/hooks.go')
-rw-r--r-- | plugin/hooks.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugin/hooks.go b/plugin/hooks.go index 68eca8ede..852f4684c 100644 --- a/plugin/hooks.go +++ b/plugin/hooks.go @@ -48,11 +48,11 @@ type Hooks interface { // // The Mattermost-User-Id header will be present if (and only if) the request is by an // authenticated user. - ServeHTTP(w http.ResponseWriter, r *http.Request) + ServeHTTP(c *Context, w http.ResponseWriter, r *http.Request) // ExecuteCommand executes a command that has been previously registered via the RegisterCommand // API. - ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError) + ExecuteCommand(c *Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) // MessageWillBePosted is invoked when a message is posted by a user before it is commited // to the database. If you also want to act on edited posts, see MessageWillBeUpdated. @@ -62,7 +62,7 @@ type Hooks interface { // // Note that this method will be called for posts created by plugins, including the plugin that // created the post. - MessageWillBePosted(post *model.Post) (*model.Post, string) + MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string) // MessageWillBeUpdated is invoked when a message is updated by a user before it is commited // to the database. If you also want to act on new posts, see MessageWillBePosted. @@ -73,17 +73,17 @@ type Hooks interface { // // Note that this method will be called for posts updated by plugins, including the plugin that // updated the post. - MessageWillBeUpdated(newPost, oldPost *model.Post) (*model.Post, string) + MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string) // MessageHasBeenPosted is invoked after the message has been commited to the databse. // If you need to modify or reject the post, see MessageWillBePosted // Note that this method will be called for posts created by plugins, including the plugin that // created the post. - MessageHasBeenPosted(post *model.Post) + MessageHasBeenPosted(c *Context, post *model.Post) // MessageHasBeenUpdated is invoked after a message is updated and has been updated in the databse. // If you need to modify or reject the post, see MessageWillBeUpdated // Note that this method will be called for posts created by plugins, including the plugin that // created the post. - MessageHasBeenUpdated(newPost, oldPost *model.Post) + MessageHasBeenUpdated(c *Context, newPost, oldPost *model.Post) } |