Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Add missing return to afterSaveMessage callbacks #17715

Merged
merged 1 commit into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/server/lib/sendNotificationsOnMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export async function sendMessageNotifications(message, room, usersInThread = []

export async function sendAllNotifications(message, room) {
if (TroubleshootDisableNotifications === true) {
return;
return message;
}

// threads
Expand Down
2 changes: 2 additions & 0 deletions app/search/server/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down
6 changes: 4 additions & 2 deletions app/threads/server/hooks/aftersavemessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -53,6 +53,8 @@ const processThreads = (message, room) => {
notifyUsersOnReply(message, replies, room);
metaData(message, parentMessage);
notification(message, room, replies);

return message;
};

Meteor.startup(function() {
Expand Down
2 changes: 1 addition & 1 deletion ee/app/engagement-dashboard/server/lib/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions imports/message-read-receipt/server/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down