Skip to content

Commit

Permalink
Fix user settings available for omitLeadingSlash (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaBernstein authored Nov 14, 2022
1 parent d4221c9 commit 35d2d8a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions db/migrations/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func Migrate(db *sql.DB) {
migrationWrapper(v9, 9)(db)
migrationWrapper(v10, 10)(db)
migrationWrapper(v11, 11)(db)
migrationWrapper(v12, 12)(db)

helpers.LogLocalf(helpers.INFO, nil, "Migrations ran through. Schema version: %d", schema(db))
}
Expand Down
21 changes: 21 additions & 0 deletions db/migrations/v12.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package migrations

import (
"database/sql"
"log"
)

func v12(db *sql.Tx) {
v12AddLeadingSlashSetting(db)
}

func v12AddLeadingSlashSetting(db *sql.Tx) {
sqlStatement := `
INSERT INTO "bot::userSettingTypes" ("setting", "description") VALUES
('user.omitCommandSlash', 'make leading slash for commands optional');
`
_, err := db.Exec(sqlStatement)
if err != nil {
log.Fatal(err)
}
}
7 changes: 7 additions & 0 deletions scenarioTests/features/config.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Feature: config user settings

Scenario: test config command handling
Given I have a bot
When I send the message "/config omit_slash on"
Then 1 messages should be sent back
And the response should include the message "has successfully been turned on"

0 comments on commit 35d2d8a

Please sign in to comment.