Преглед на файлове

muc: Make `defaults` a function

otherwise also the prototype's defaults gets overwritten.
JC Brand преди 8 години
родител
ревизия
f9fb13a71d
променени са 1 файла, в които са добавени 14 реда и са изтрити 13 реда
  1. 14 13
      src/converse-muc.js

+ 14 - 13
src/converse-muc.js

@@ -365,19 +365,20 @@
 
             _converse.ChatRoom = _converse.ChatBox.extend({
 
-                defaults: _.extend(_converse.ChatBox.prototype.defaults, {
-                    // For group chats, we distinguish between generally unread
-                    // messages and those ones that specifically mention the
-                    // user.
-                    //
-                    // To keep things simple, we reuse `num_unread` from
-                    // _converse.ChatBox to indicate unread messages which
-                    // mention the user and `num_unread_general` to indicate
-                    // generally unread messages (which *includes* mentions!).
-                    // FIXME: figure out why this breaks tests.
-                    // 'type': CHATROOMS_TYPE,
-                    'num_unread_general': 0
-                }),
+                defaults: function () {
+                    return _.extend(_converse.ChatBox.prototype.defaults, {
+                        'type': CHATROOMS_TYPE,
+                        // For group chats, we distinguish between generally unread
+                        // messages and those ones that specifically mention the
+                        // user.
+                        //
+                        // To keep things simple, we reuse `num_unread` from
+                        // _converse.ChatBox to indicate unread messages which
+                        // mention the user and `num_unread_general` to indicate
+                        // generally unread messages (which *includes* mentions!).
+                        'num_unread_general': 0
+                    });
+                },
 
                 isUserMentioned: function (message) {
                     /* Returns a boolean to indicate whether the current user