Przeglądaj źródła

Set modifications of model attributes only if the item received from the rosterHandler has different options

ichim-david 12 lat temu
rodzic
commit
447c3a8d41
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      converse.js

+ 5 - 1
converse.js

@@ -1414,7 +1414,11 @@
                 if (!model) {
                     this.addRosterItem(item.jid, item.subscription, item.ask, item.name);
                 } else {
-                    model.set({'subscription': item.subscription, 'ask': item.ask});
+                    // only modify model attributes if they are different from the
+                    // ones that were already set when the rosterItem was added
+                    if (model.get('subscription') !== item.subscription || model.get('ask') !== item.ask) {
+                        model.set({'subscription': item.subscription, 'ask': item.ask});
+                    }
                 }
             }
         },