1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +00:00

Create first custom emoji

This commit is contained in:
2020-04-03 16:20:08 +02:00
parent 2465b0c1ac
commit 131735a5f0
6 changed files with 108 additions and 1 deletions

View File

@ -5,7 +5,7 @@
*/
import { UserHelper } from "../helpers/UserHelper";
import { removeHTMLNodes, checkMail, checkURL } from "../utils/StringUtils";
import { removeHTMLNodes, checkMail, checkURL, checkEmojiCode } from "../utils/StringUtils";
import { FriendsHelper } from "../helpers/FriendsHelper";
import { AccountHelper } from "../helpers/AccountHelper";
import { GroupsHelper } from "../helpers/GroupsHelper";
@ -405,4 +405,18 @@ export abstract class BaseRequestsHandler implements AbstractUserConnectionConta
return convID;
}
/**
* Get the shorcut of an emoji included in a POST request
*
* @param name The name of the POST field containing the id of the emoji
*/
public postEmojiShorcut(name: string) : string {
const emojiID = this.postString(name);
if(!checkEmojiCode(emojiID))
this.error(401, "Invalid emoji specified at " + name + "!")
return emojiID;
}
}

View File

@ -0,0 +1,26 @@
/**
* Custom smiley
*
* @author Pierre Hubert
*/
export interface CustomEmojiBuilder {
id: number,
userID: number,
shorcut: string,
path: string,
}
export class CustomEmoji implements CustomEmojiBuilder {
id: number;
userID: number;
shorcut: string;
path: string;
public constructor(info: CustomEmojiBuilder) {
for (const key in info) {
if (info.hasOwnProperty(key))
this[key] = info[key];
}
}
}