From af7479df28215d8c2aef8ad265742f384da122ec Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Fri, 20 Nov 2020 17:32:21 -0300 Subject: [PATCH] add missing file --- .../server/modifiers/addGroupChatMsg.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/addGroupChatMsg.js b/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/addGroupChatMsg.js index 4fa84748e9..78db92cfa4 100644 --- a/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/addGroupChatMsg.js +++ b/bigbluebutton-html5/imports/api/group-chat-msg/server/modifiers/addGroupChatMsg.js @@ -46,19 +46,15 @@ export default function addGroupChatMsg(meetingId, chatId, msg) { $set: msgDocument, }; - const cb = (err, numChanged) => { - if (err) { - return Logger.error(`Adding group-chat-msg to collection: ${err}`); - } - - const { insertedId } = numChanged; + try { + const { insertedId } = GroupChatMsg.upsert(selector, modifier); if (insertedId) { - return Logger.info(`Added group-chat-msg msgId=${msg.id} chatId=${chatId} meetingId=${meetingId}`); + Logger.info(`Added group-chat-msg msgId=${msg.id} chatId=${chatId} meetingId=${meetingId}`); + } else { + Logger.info(`Upserted group-chat-msg msgId=${msg.id} chatId=${chatId} meetingId=${meetingId}`); } - - return Logger.info(`Upserted group-chat-msg msgId=${msg.id} chatId=${chatId} meetingId=${meetingId}`); - }; - - return GroupChatMsg.upsert(selector, modifier, cb); + } catch (err) { + Logger.error(`Adding group-chat-msg to collection: ${err}`); + } }