PLT-1429 Fixing code review comments
Этот коммит содержится в:
@@ -318,7 +318,7 @@ func regenCommandToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
} else {
|
||||
cmd = result.Data.(*model.Command)
|
||||
|
||||
if c.Session.TeamId != cmd.TeamId && c.Session.UserId != cmd.CreatorId && !c.IsTeamAdmin() {
|
||||
if c.Session.TeamId != cmd.TeamId || (c.Session.UserId != cmd.CreatorId && !c.IsTeamAdmin()) {
|
||||
c.LogAudit("fail - inappropriate permissions")
|
||||
c.Err = model.NewLocAppError("regenToken", "api.command.regen.app_error", nil, "user_id="+c.Session.UserId)
|
||||
return
|
||||
@@ -364,7 +364,7 @@ func deleteCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.Err = result.Err
|
||||
return
|
||||
} else {
|
||||
if c.Session.TeamId != result.Data.(*model.Command).TeamId && c.Session.UserId != result.Data.(*model.Command).CreatorId && !c.IsTeamAdmin() {
|
||||
if c.Session.TeamId != result.Data.(*model.Command).TeamId || (c.Session.UserId != result.Data.(*model.Command).CreatorId && !c.IsTeamAdmin()) {
|
||||
c.LogAudit("fail - inappropriate permissions")
|
||||
c.Err = model.NewLocAppError("deleteCommand", "api.command.delete.app_error", nil, "user_id="+c.Session.UserId)
|
||||
return
|
||||
|
||||
@@ -327,7 +327,7 @@ func (me *LoadTestProvider) UrlCommand(c *Context, channelId string, message str
|
||||
}
|
||||
}
|
||||
|
||||
return &model.CommandResponse{Text: "Loading url...", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
|
||||
return &model.CommandResponse{Text: "Loading data...", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
|
||||
}
|
||||
|
||||
func parseRange(command string, cmd string) (utils.Range, bool) {
|
||||
|
||||
@@ -197,17 +197,17 @@ func TestLoadTestUrlCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
command = "/loadtest url https://raw.githubusercontent.com/mattermost/platform/master/README.md"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading url..." {
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for README.md should've executed")
|
||||
}
|
||||
|
||||
command = "/loadtest url test-emoticons.md"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading url..." {
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for test-emoticons.md should've executed")
|
||||
}
|
||||
|
||||
command = "/loadtest url test-emoticons"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading url..." {
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for test-emoticons should've executed")
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ var versions = []string{
|
||||
}
|
||||
|
||||
var CurrentVersion string = versions[0]
|
||||
|
||||
var BuildNumber = "_BUILD_NUMBER_"
|
||||
var BuildDate = "_BUILD_DATE_"
|
||||
var BuildHash = "_BUILD_HASH_"
|
||||
|
||||
@@ -787,7 +787,6 @@ export function getSuggestedCommands(command, suggestionId, component) {
|
||||
});
|
||||
|
||||
// pull out the suggested commands from the returned data
|
||||
//const terms = matches.map((suggestion) => suggestion.trigger);
|
||||
const terms = matches.map((suggestion) => suggestion.suggestion);
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
|
||||
Ссылка в новой задаче
Block a user