mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
app type transition (#7167)
This commit is contained in:
@@ -34,7 +34,7 @@ func InitCommand() {
|
||||
}
|
||||
|
||||
func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
commands, err := app.ListAutocompleteCommands(c.TeamId, c.T)
|
||||
commands, err := c.App.ListAutocompleteCommands(c.TeamId, c.T)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -56,7 +56,7 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if len(commandArgs.ChannelId) > 0 {
|
||||
if !app.SessionHasPermissionToChannel(c.Session, commandArgs.ChannelId, model.PERMISSION_USE_SLASH_COMMANDS) {
|
||||
if !c.App.SessionHasPermissionToChannel(c.Session, commandArgs.ChannelId, model.PERMISSION_USE_SLASH_COMMANDS) {
|
||||
c.SetPermissionError(model.PERMISSION_USE_SLASH_COMMANDS)
|
||||
return
|
||||
}
|
||||
@@ -68,7 +68,7 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
commandArgs.Session = c.Session
|
||||
commandArgs.SiteURL = c.GetSiteURLHeader()
|
||||
|
||||
response, err := app.ExecuteCommand(commandArgs)
|
||||
response, err := c.App.ExecuteCommand(commandArgs)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -95,7 +95,7 @@ func createCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
cmd.CreatorId = c.Session.UserId
|
||||
cmd.TeamId = c.TeamId
|
||||
|
||||
rcmd, err := app.CreateCommand(cmd)
|
||||
rcmd, err := c.App.CreateCommand(cmd)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -115,7 +115,7 @@ func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
c.LogAudit("attempt")
|
||||
|
||||
oldCmd, err := app.GetCommand(cmd.Id)
|
||||
oldCmd, err := c.App.GetCommand(cmd.Id)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -138,7 +138,7 @@ func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
rcmd, err := app.UpdateCommand(oldCmd, cmd)
|
||||
rcmd, err := c.App.UpdateCommand(oldCmd, cmd)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -155,7 +155,7 @@ func listTeamCommands(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
cmds, err := app.ListTeamCommands(c.TeamId)
|
||||
cmds, err := c.App.ListTeamCommands(c.TeamId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -175,7 +175,7 @@ func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
c.LogAudit("attempt")
|
||||
|
||||
cmd, err := app.GetCommand(id)
|
||||
cmd, err := c.App.GetCommand(id)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -198,7 +198,7 @@ func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
rcmd, err := app.RegenCommandToken(cmd)
|
||||
rcmd, err := c.App.RegenCommandToken(cmd)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -218,7 +218,7 @@ func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
c.LogAudit("attempt")
|
||||
|
||||
cmd, err := app.GetCommand(id)
|
||||
cmd, err := c.App.GetCommand(id)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -241,7 +241,7 @@ func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
err = app.DeleteCommand(cmd.Id)
|
||||
err = c.App.DeleteCommand(cmd.Id)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user