1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Can send image in conversation messages

This commit is contained in:
Pierre HUBERT 2019-11-30 19:58:00 +01:00
parent 2181e17245
commit af97216c13

View File

@ -210,8 +210,15 @@ export class ConversationsController {
public static async SendMessage(h: RequestHandler) {
const convID = await this.GetPostConversationId("conversationID", h);
const message = removeHTMLNodes(h.postString("message", 0));
let imagePath = "";
if(message.length < 3)
// Check for image
if(h.hasFile("image")){
// Try to save image
imagePath = await h.savePostImage("image", "conversations", 1200, 1200);
}
else if(message.length < 3)
h.error(401, "Message is empty!");
// Send message
@ -219,7 +226,7 @@ export class ConversationsController {
userID: h.getUserId(),
convID: convID,
message: message,
imagePath: ""
imagePath: imagePath
});
h.success("Conversation message was sent!");