Skip to content

Commit

Permalink
Fixed: Allowing /icebreaker with a space in the end (as autocomplete …
Browse files Browse the repository at this point in the history
…fills it in for the user)
  • Loading branch information
Nils Brinkmann committed Aug 7, 2020
1 parent 2c41fb9 commit abb0943
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "com.nilsbrinkmann.icebreaker",
"name": "Icebreaker Plugin",
"description": "This plugin creates a bot which asks random questions",
"version": "1.4.1",
"version": "1.4.2",
"min_server_version": "5.12.0",
"server": {
"executables": {
Expand Down
1 change: 1 addition & 0 deletions server/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*mo
}

trigger := strings.TrimPrefix(args.Command, "/")
trigger = strings.TrimSuffix(trigger, " ")

//first check for admin commands, make sure the user has the right permission
for key, value := range adminCommands {
Expand Down
4 changes: 2 additions & 2 deletions server/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ func TestAskIcebreaker_success(t *testing.T) {
plugin.SetAPI(api)

args := &model.CommandArgs{
Command: "/icebreaker",
Command: "/icebreaker ",
ChannelId: "TestChannel",
TeamId: "TestTeam",
RootId: "TestRoot",
UserId: "TestUser",
}

plugin.executeCommandIcebreaker(args)
plugin.ExecuteCommand(nil, args)
})
t.Run("Successful, other user", func(t *testing.T) {
rand.Seed(4) //seed guarantees that the loop goes through a few users before picking success_user2
Expand Down
2 changes: 1 addition & 1 deletion server/manifest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abb0943

Please sign in to comment.