소스 검색

Ignore messages without a body

JC Brand 9 년 전
부모
커밋
d2933b896e
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      src/converse-notification.js

+ 5 - 2
src/converse-notification.js

@@ -63,8 +63,11 @@
                     return false;
                 }
                 var room = converse.chatboxes.get(room_jid);
-                var body = $message.children('body').text();
-                var mentioned = (new RegExp("\\b"+room.get('nick')+"\\b")).test(body);
+                var $body = $message.children('body');
+                if (!$body.length) {
+                    return false;
+                }
+                var mentioned = (new RegExp("\\b"+room.get('nick')+"\\b")).test($body.text());
                 notify_all = notify_all === true || (_.isArray(notify_all) && _.contains(notify_all, room_jid));
                 if (sender === room.get('nick') || (!notify_all && !mentioned)) {
                     return false;