Snippets are now case-insensitive everywhere
parent
90dd35194c
commit
db40c39dfa
|
@ -8,7 +8,7 @@ const Snippet = require("./Snippet");
|
||||||
*/
|
*/
|
||||||
async function getSnippet(trigger) {
|
async function getSnippet(trigger) {
|
||||||
const snippet = await knex("snippets")
|
const snippet = await knex("snippets")
|
||||||
.where("trigger", trigger)
|
.where(knex.raw("LOWER(trigger)"), trigger.toLowerCase())
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
return (snippet ? new Snippet(snippet) : null);
|
return (snippet ? new Snippet(snippet) : null);
|
||||||
|
@ -36,7 +36,7 @@ async function addSnippet(trigger, body, createdBy = 0) {
|
||||||
*/
|
*/
|
||||||
async function deleteSnippet(trigger) {
|
async function deleteSnippet(trigger) {
|
||||||
return knex("snippets")
|
return knex("snippets")
|
||||||
.where("trigger", trigger)
|
.where(knex.raw("LOWER(trigger)"), trigger.toLowerCase())
|
||||||
.delete();
|
.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const threads = require("../data/threads");
|
const threads = require("../data/threads");
|
||||||
const snippets = require("../data/snippets");
|
const snippets = require("../data/snippets");
|
||||||
const config = require("../cfg");
|
|
||||||
const utils = require("../utils");
|
const utils = require("../utils");
|
||||||
const { parseArguments } = require("knub-command-manager");
|
const { parseArguments } = require("knub-command-manager");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue