Merge branch 'julius-dev' of Software_Engineering_I/greenvironment-server into develop

pull/2/head
Trivernis 5 years ago committed by Gitea
commit 9e2a2740a0

1
.gitignore vendored

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

@ -144,9 +144,13 @@ export function resolver(req: any, res: any): any {
async createPost({content}: { content: string }) {
if (content) {
if (req.session.userId) {
if (content.length > 2048) {
return new GraphQLError("Content too long.");
} else {
const post = await dataaccess.createPost(content, req.session.userId);
globals.internalEmitter.emit(InternalEvents.GQLPOSTCREATE, post);
return post;
}
} else {
res.status(status.UNAUTHORIZED);
return new NotLoggedInGqlError();

@ -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