MM-12855 Plugin Context (#9922)
* Basic plugin context. * Adding more useful fields to plugin context. * Fix spelling Co-Authored-By: crspeller <crspeller@gmail.com> * Fixing location of context creation.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
de5440d979
Коммит
aba194188f
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/mlog"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/plugin"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
)
|
||||
|
||||
@@ -520,11 +519,3 @@ func (c *Context) RequireRoleName() *Context {
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Context) ToPluginContext() *plugin.Context {
|
||||
return &plugin.Context{
|
||||
//sessionId: c.Session.Id,
|
||||
//requestId: c.RequestId,
|
||||
//userIp: c.IpAddress,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
c.App.T, _ = utils.GetTranslationsAndLocale(w, r)
|
||||
c.App.RequestId = model.NewId()
|
||||
c.App.IpAddress = utils.GetIpAddress(r)
|
||||
c.App.UserAgent = r.UserAgent()
|
||||
c.App.AcceptLanguage = r.Header.Get("Accept-Language")
|
||||
c.Params = ParamsFromRequest(r)
|
||||
c.App.Path = r.URL.Path
|
||||
c.Log = c.App.Log
|
||||
|
||||
Ссылка в новой задаче
Block a user