Regression: Add missing return to afterSaveMessage callbacks (#17715)

pull/17605/head
Diego Sampaio 6 years ago committed by GitHub
parent fb0cc0d6c2
commit 35ebde396e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/lib/server/lib/sendNotificationsOnMessage.js
  2. 2
      app/search/server/events/events.js
  3. 6
      app/threads/server/hooks/aftersavemessage.js
  4. 2
      ee/app/engagement-dashboard/server/lib/messages.js
  5. 6
      ee/app/livechat-enterprise/server/hooks/setPredictedVisitorAbandonmentTime.js
  6. 2
      imports/message-read-receipt/server/hooks.js
  7. 2
      packages/rocketchat-google-natural-language/server/index.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

@ -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');
/**

@ -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() {

@ -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),

@ -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) {

@ -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 }) => {

@ -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) => {

Loading…
Cancel
Save