diff --git a/app/lib/server/lib/sendNotificationsOnMessage.js b/app/lib/server/lib/sendNotificationsOnMessage.js index f8db60fc1e77..0ebf3c2501cb 100644 --- a/app/lib/server/lib/sendNotificationsOnMessage.js +++ b/app/lib/server/lib/sendNotificationsOnMessage.js @@ -312,7 +312,7 @@ export async function sendMessageNotifications(message, room, usersInThread = [] export async function sendAllNotifications(message, room) { if (TroubleshootDisableNotifications === true) { - return; + return message; } // threads diff --git a/app/search/server/events/events.js b/app/search/server/events/events.js index 79e3c8aa8142..7f0f5032a1d7 100644 --- a/app/search/server/events/events.js +++ b/app/search/server/events/events.js @@ -24,10 +24,12 @@ const eventService = new EventService(); */ callbacks.add('afterSaveMessage', function(m) { eventService.promoteEvent('message.save', m._id, m); + return m; }, callbacks.priority.MEDIUM, 'search-events'); callbacks.add('afterDeleteMessage', function(m) { eventService.promoteEvent('message.delete', m._id); + return m; }, callbacks.priority.MEDIUM, 'search-events-delete'); /** diff --git a/app/threads/server/hooks/aftersavemessage.js b/app/threads/server/hooks/aftersavemessage.js index a9348619caeb..8de27cafba64 100644 --- a/app/threads/server/hooks/aftersavemessage.js +++ b/app/threads/server/hooks/aftersavemessage.js @@ -38,12 +38,12 @@ const notification = (message, room, replies) => { const processThreads = (message, room) => { if (!message.tmid) { - return; + return message; } const parentMessage = Messages.findOneById(message.tmid); if (!parentMessage) { - return; + return message; } const replies = [ @@ -53,6 +53,8 @@ const processThreads = (message, room) => { notifyUsersOnReply(message, replies, room); metaData(message, parentMessage); notification(message, room, replies); + + return message; }; Meteor.startup(function() { diff --git a/ee/app/engagement-dashboard/server/lib/messages.js b/ee/app/engagement-dashboard/server/lib/messages.js index 8bfb9fe95f4c..7c6bc3fa45a3 100644 --- a/ee/app/engagement-dashboard/server/lib/messages.js +++ b/ee/app/engagement-dashboard/server/lib/messages.js @@ -9,7 +9,7 @@ import { convertDateToInt, diffBetweenDaysInclusive, convertIntToDate, getTotalO export const handleMessagesSent = (message, room) => { const roomTypesToShow = roomTypes.getTypesToShowOnDashboard(); if (!roomTypesToShow.includes(room.t)) { - return; + return message; } Promise.await(AnalyticsRaw.saveMessageSent({ date: convertDateToInt(message.ts), diff --git a/ee/app/livechat-enterprise/server/hooks/setPredictedVisitorAbandonmentTime.js b/ee/app/livechat-enterprise/server/hooks/setPredictedVisitorAbandonmentTime.js index 111e73fbccdf..a5b6f9cde7bb 100644 --- a/ee/app/livechat-enterprise/server/hooks/setPredictedVisitorAbandonmentTime.js +++ b/ee/app/livechat-enterprise/server/hooks/setPredictedVisitorAbandonmentTime.js @@ -8,15 +8,15 @@ callbacks.add('afterSaveMessage', function(message, room) { } // skips this callback if the message was edited if (message.editedAt) { - return false; + return message; } // message valid only if it is a livechat room if (!(typeof room.t !== 'undefined' && room.t === 'l' && room.v && room.v.token)) { - return false; + return message; } // if the message has a type means it is a special message (like the closing comment), so skips if (message.t) { - return false; + return message; } const sentByAgent = !message.token; if (sentByAgent) { diff --git a/imports/message-read-receipt/server/hooks.js b/imports/message-read-receipt/server/hooks.js index 6d2242a59cf0..0c5dc467abda 100644 --- a/imports/message-read-receipt/server/hooks.js +++ b/imports/message-read-receipt/server/hooks.js @@ -15,6 +15,8 @@ callbacks.add('afterSaveMessage', (message, room) => { // mark message as read as well ReadReceipt.markMessageAsReadBySender(message, room._id, message.u._id); + + return message; }, callbacks.priority.MEDIUM, 'message-read-receipt-afterSaveMessage'); callbacks.add('afterReadMessages', (rid, { userId, lastSeen }) => { diff --git a/packages/rocketchat-google-natural-language/server/index.js b/packages/rocketchat-google-natural-language/server/index.js index 36ddc43dbb20..274d6d4b3ed2 100644 --- a/packages/rocketchat-google-natural-language/server/index.js +++ b/packages/rocketchat-google-natural-language/server/index.js @@ -22,7 +22,7 @@ settings.get('GoogleNaturalLanguage_ServiceAccount', (key, value) => { const setRoomSentiment = function(message) { if (!languageClient) { - return; + return message; } languageClient.detectSentiment(message.msg, Meteor.bindEnvironment((error, result) => {