Kaynağa Gözat

Remove getItem.

It's a relic from a time before the class subclassed a Backbone.Collection
JC Brand 11 yıl önce
ebeveyn
işleme
8a2e4e83e7
1 değiştirilmiş dosya ile 6 ekleme ve 10 silme
  1. 6 10
      converse.js

+ 6 - 10
converse.js

@@ -2098,12 +2098,8 @@
                 return (Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(converse.connection.jid));
             },
 
-            getItem: function (id) {
-                return Backbone.Collection.prototype.get.call(this, id);
-            },
-
             addResource: function (bare_jid, resource) {
-                var item = this.getItem(bare_jid),
+                var item = this.get(bare_jid),
                     resources;
                 if (item) {
                     resources = item.get('resources');
@@ -2119,7 +2115,7 @@
             },
 
             removeResource: function (bare_jid, resource) {
-                var item = this.getItem(bare_jid),
+                var item = this.get(bare_jid),
                     resources,
                     idx;
                 if (item) {
@@ -2188,7 +2184,7 @@
                 for (i=0; i < this.models.length; ++i) {
                     id = this.models[i].get('id');
                     if (_.indexOf(roster_ids, id) === -1) {
-                        this.getItem(id).destroy();
+                        this.get(id).destroy();
                     }
                 }
             },
@@ -2197,7 +2193,7 @@
                 this.cleanCache(items);
                 _.each(items, function (item, index, items) {
                     if (this.isSelf(item.jid)) { return; }
-                    var model = this.getItem(item.jid);
+                    var model = this.get(item.jid);
                     if (!model) {
                         is_last = false;
                         if (index === (items.length-1)) { is_last = true; }
@@ -2224,7 +2220,7 @@
 
             handleIncomingSubscription: function (jid) {
                 var bare_jid = Strophe.getBareJidFromJid(jid);
-                var item = this.getItem(bare_jid);
+                var item = this.get(bare_jid);
 
                 if (!converse.allow_contact_requests) {
                     converse.connection.roster.unauthorize(bare_jid);
@@ -2298,7 +2294,7 @@
                 } else if (($presence.find('x').attr('xmlns') || '').indexOf(Strophe.NS.MUC) === 0) {
                     return true; // Ignore MUC
                 }
-                item = this.getItem(bare_jid);
+                item = this.get(bare_jid);
                 if (item && (status_message.text() != item.get('status'))) {
                     item.save({'status': status_message.text()});
                 }