Explorar el Código

Use proper message handler. Fix typo

JC Brand hace 8 años
padre
commit
a4284e48f7
Se han modificado 2 ficheros con 6 adiciones y 6 borrados
  1. 5 5
      spec/chatroom.js
  2. 1 1
      src/converse-muc.js

+ 5 - 5
spec/chatroom.js

@@ -488,7 +488,7 @@
                         to: 'dummy@localhost',
                         to: 'dummy@localhost',
                         type: 'groupchat'
                         type: 'groupchat'
                     }).c('body').t(message).tree();
                     }).c('body').t(message).tree();
-                _converse.chatboxes.onMessage(msg);
+                view.handleMUCMessage(msg);
                 expect(view.$el.find('.chat-message').hasClass('mentioned')).toBeTruthy();
                 expect(view.$el.find('.chat-message').hasClass('mentioned')).toBeTruthy();
             }));
             }));
 
 
@@ -505,7 +505,7 @@
                         to: 'dummy@localhost',
                         to: 'dummy@localhost',
                         type: 'groupchat'
                         type: 'groupchat'
                     }).c('body').t(message).tree();
                     }).c('body').t(message).tree();
-                _converse.chatboxes.onMessage(msg);
+                view.handleMUCMessage(msg);
                 expect(_.includes(view.$el.find('.chat-msg-author').text(), '**Dyon van de Wege')).toBeTruthy();
                 expect(_.includes(view.$el.find('.chat-msg-author').text(), '**Dyon van de Wege')).toBeTruthy();
                 expect(view.$el.find('.chat-msg-content').text()).toBe(' is tired');
                 expect(view.$el.find('.chat-msg-content').text()).toBe(' is tired');
 
 
@@ -516,7 +516,7 @@
                     to: 'dummy@localhost',
                     to: 'dummy@localhost',
                     type: 'groupchat'
                     type: 'groupchat'
                 }).c('body').t(message).tree();
                 }).c('body').t(message).tree();
-                _converse.chatboxes.onMessage(msg);
+                view.handleMUCMessage(msg);
                 expect(_.includes(view.$el.find('.chat-msg-author:last').text(), '**Max Mustermann')).toBeTruthy();
                 expect(_.includes(view.$el.find('.chat-msg-author:last').text(), '**Max Mustermann')).toBeTruthy();
                 expect(view.$el.find('.chat-msg-content:last').text()).toBe(' is as well');
                 expect(view.$el.find('.chat-msg-content:last').text()).toBe(' is as well');
             }));
             }));
@@ -1077,7 +1077,7 @@
                  * scrollbar.
                  * scrollbar.
                  */
                  */
                 for (var i=0; i<20; i++) {
                 for (var i=0; i<20; i++) {
-                    _converse.chatboxes.onMessage(
+                    view.handleMUCMessage(
                         $msg({
                         $msg({
                             from: 'lounge@localhost/someone',
                             from: 'lounge@localhost/someone',
                             to: 'dummy@localhost.com',
                             to: 'dummy@localhost.com',
@@ -1088,7 +1088,7 @@
                 // Give enough time for `markScrolled` to have been called
                 // Give enough time for `markScrolled` to have been called
                 setTimeout(function () {
                 setTimeout(function () {
                     view.$content.scrollTop(0);
                     view.$content.scrollTop(0);
-                    _converse.chatboxes.onMessage(
+                    view.handleMUCMessage(
                         $msg({
                         $msg({
                             from: 'lounge@localhost/someone',
                             from: 'lounge@localhost/someone',
                             to: 'dummy@localhost.com',
                             to: 'dummy@localhost.com',

+ 1 - 1
src/converse-muc.js

@@ -544,7 +544,7 @@
                             .getExtraMessageClasses.apply(this, arguments);
                             .getExtraMessageClasses.apply(this, arguments);
 
 
                     if (this.is_chatroom && attrs.sender === 'them' &&
                     if (this.is_chatroom && attrs.sender === 'them' &&
-                            this.model.isUserMentioned(attrs.mentioned)) {
+                            this.model.isUserMentioned(attrs.message)) {
                         // Add special class to mark groupchat messages
                         // Add special class to mark groupchat messages
                         // in which we are mentioned.
                         // in which we are mentioned.
                         extra_classes += ' mentioned';
                         extra_classes += ' mentioned';