Fixed Handle whitespace

- removed whitespace from handles
- fixed character length not being detected
pull/2/head
Trivernis 5 years ago
parent dc3f9f1702
commit 580f15da3d

1
.gitignore vendored

@ -9,3 +9,4 @@ config.yaml
sqz-force
greenvironment.db
logs
logs*

@ -18,7 +18,7 @@ import * as models from "./models";
* @param username
*/
async function generateHandle(username: string) {
username = username.toLowerCase();
username = username.toLowerCase().replace(/\s/g, "_");
const count = await models.User.count({where: {handle: {[sqz.Op.like]: `%${username}%`}}});
if (count > 0) {
return `${username}${count}`;

@ -9,7 +9,7 @@ import {EventEmitter} from "events";
import * as fsx from "fs-extra";
import * as yaml from "js-yaml";
import * as winston from "winston";
require('winston-daily-rotate-file');
require("winston-daily-rotate-file");
const configPath = "config.yaml";
const defaultConfig = __dirname + "/../default-config.yaml";

Loading…
Cancel
Save