MM-26339 - Add context and CommandArgs to dynamic autocomplete calls (#14940)
* pass commandArgs and pluginContext to dynamic list suggestion calls * update tests Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
71925ea224
Коммит
f5be738923
@@ -382,7 +382,8 @@ func listCommandAutocompleteSuggestions(c *Context, w http.ResponseWriter, r *ht
|
||||
roleId = model.SYSTEM_ADMIN_ROLE_ID
|
||||
}
|
||||
|
||||
userInput := r.URL.Query().Get("user_input")
|
||||
query := r.URL.Query()
|
||||
userInput := query.Get("user_input")
|
||||
if userInput == "" {
|
||||
c.SetInvalidParam("userInput")
|
||||
return
|
||||
@@ -395,7 +396,19 @@ func listCommandAutocompleteSuggestions(c *Context, w http.ResponseWriter, r *ht
|
||||
return
|
||||
}
|
||||
|
||||
suggestions := c.App.GetSuggestions(commands, userInput, roleId)
|
||||
commandArgs := &model.CommandArgs{
|
||||
ChannelId: query.Get("channel_id"),
|
||||
TeamId: c.Params.TeamId,
|
||||
RootId: query.Get("root_id"),
|
||||
ParentId: query.Get("parent_id"),
|
||||
UserId: c.App.Session().UserId,
|
||||
T: c.App.T,
|
||||
Session: *c.App.Session(),
|
||||
SiteURL: c.GetSiteURLHeader(),
|
||||
Command: userInput,
|
||||
}
|
||||
|
||||
suggestions := c.App.GetSuggestions(commandArgs, commands, roleId)
|
||||
|
||||
w.Write(model.AutocompleteSuggestionsToJSON(suggestions))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user