diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/command.go | 4 | ||||
-rw-r--r-- | api/command_loadtest.go | 2 | ||||
-rw-r--r-- | api/command_loadtest_test.go | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/api/command.go b/api/command.go index 390cc3770..a8573cdcc 100644 --- a/api/command.go +++ b/api/command.go @@ -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 diff --git a/api/command_loadtest.go b/api/command_loadtest.go index e320176f4..c7c4f98f5 100644 --- a/api/command_loadtest.go +++ b/api/command_loadtest.go @@ -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) { diff --git a/api/command_loadtest_test.go b/api/command_loadtest_test.go index 2ae426dc0..7cb77cf18 100644 --- a/api/command_loadtest_test.go +++ b/api/command_loadtest_test.go @@ -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") } |