makes highlight words trully case insensitive

pull/2267/head
Diego Sampaio 10 years ago
parent f5125d5f79
commit b3bce91c1f
  1. 8
      packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js
  2. 19
      packages/rocketchat-lib/server/lib/sendNotificationsOnMessage.js

@ -16,8 +16,12 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (! highlights || highlights.length == 0) { return false; }
var has = false;
highlights.forEach(function (highlight) {
if (message.msg.includes(highlight)) { has = true; }
highlights.some(function (highlight) {
var regexp = new RegExp(s.escapeRegExp(highlight),'i');
if (regexp.test(message.msg)) {
has = true;
return true;
}
});
return has;

@ -42,8 +42,12 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
if (! highlights || highlights.length == 0) { return false; }
var has = false;
highlights.forEach(function (highlight) {
if (message.msg.includes(highlight)) { has = true; }
highlights.some(function (highlight) {
var regexp = new RegExp(s.escapeRegExp(highlight),'i');
if (regexp.test(message.msg)) {
has = true;
return true;
}
});
return has;
@ -259,6 +263,17 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
});
}
}
// if (mentionIds > 0) {
// /*
// Update all other subscriptions of mentioned users to alert their owners and incrementing
// the unread counter for mentions and direct messages
// */
// if (toAll) {
// RocketChat.models.Subscriptions.incUnreadForRoomIdExcludingUserId(message.rid, user._id, 1);
// } else {
// RocketChat.models.Subscriptions.incUnreadForRoomIdAndUserIds(message.rid, mentionIds, 1);
// }
// }
}
return message;

Loading…
Cancel
Save