mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Can get information about an emoji included in a POST request
This commit is contained in:
@ -16,6 +16,8 @@ import { CommentsHelper } from "../helpers/CommentsHelper";
|
||||
import { checkVirtualDirectory } from "../utils/VirtualDirsUtils";
|
||||
import { ConversationsHelper } from "../helpers/ConversationsHelper";
|
||||
import { AbstractUserConnectionContainer } from "./UserConnectionContainer";
|
||||
import { CustomEmoji } from "./CustomEmoji";
|
||||
import { CustomEmojisHelper } from "../helpers/CustomEmojisHelper";
|
||||
|
||||
export abstract class BaseRequestsHandler implements AbstractUserConnectionContainer {
|
||||
|
||||
@ -412,11 +414,27 @@ export abstract class BaseRequestsHandler implements AbstractUserConnectionConta
|
||||
* @param name The name of the POST field containing the id of the emoji
|
||||
*/
|
||||
public postEmojiShorcut(name: string) : string {
|
||||
const emojiID = this.postString(name);
|
||||
const emojiShorcut = this.postString(name);
|
||||
|
||||
if(!checkEmojiCode(emojiID))
|
||||
if(!checkEmojiCode(emojiShorcut))
|
||||
this.error(401, "Invalid emoji specified at " + name + "!")
|
||||
|
||||
return emojiID;
|
||||
return emojiShorcut;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about an emoji included in a POST request
|
||||
*
|
||||
* @param name The name of the post field containing emoji ID
|
||||
*/
|
||||
public async postEmojiID(name: string) : Promise<CustomEmoji> {
|
||||
const eomjiID = this.postInt(name);
|
||||
|
||||
const info = await CustomEmojisHelper.GetSingle(eomjiID);
|
||||
|
||||
if(info.userID != this.getUserId())
|
||||
this.error(401, "You are not allowed to modify this emoji!");
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user