mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Can send image in conversation messages
This commit is contained in:
parent
2181e17245
commit
af97216c13
@ -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!");
|
||||
|
Loading…
Reference in New Issue
Block a user