mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-26 07:19:23 +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) {
|
public static async SendMessage(h: RequestHandler) {
|
||||||
const convID = await this.GetPostConversationId("conversationID", h);
|
const convID = await this.GetPostConversationId("conversationID", h);
|
||||||
const message = removeHTMLNodes(h.postString("message", 0));
|
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!");
|
h.error(401, "Message is empty!");
|
||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
@ -219,7 +226,7 @@ export class ConversationsController {
|
|||||||
userID: h.getUserId(),
|
userID: h.getUserId(),
|
||||||
convID: convID,
|
convID: convID,
|
||||||
message: message,
|
message: message,
|
||||||
imagePath: ""
|
imagePath: imagePath
|
||||||
});
|
});
|
||||||
|
|
||||||
h.success("Conversation message was sent!");
|
h.success("Conversation message was sent!");
|
||||||
|
Loading…
Reference in New Issue
Block a user