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

Call destroy on rejected contact

Rather than calling remove and triggering a custom event
JC Brand преди 12 години
родител
ревизия
a3b92ac321
променени са 1 файла, в които са добавени 2 реда и са изтрити 14 реда
  1. 2 14
      converse.js

+ 2 - 14
converse.js

@@ -1185,10 +1185,9 @@
         },
 
         declineRequest: function (ev) {
-            var that = this;
-            xmppchat.connection.roster.unauthorize(this.model.get('jid'));
-            that.trigger('decline-request', that.model);
             ev.preventDefault();
+            xmppchat.connection.roster.unauthorize(this.model.get('jid'));
+            this.model.destroy();
         },
 
         template: _.template(
@@ -1515,11 +1514,6 @@
             this.model.on("add", function (item) {
                 var view = new xmppchat.RosterItemView({model: item});
                 this.rosteritemviews[item.id] = view;
-                if (item.get('ask') === 'request') {
-                    view.on('decline-request', function (item) {
-                        this.model.remove(item.id);
-                    }, this);
-                }
                 this.render(item);
             }, this);
 
@@ -1531,12 +1525,6 @@
                 this.render(item);
             }, this);
 
-            this.model.on("remove", function (item) {
-                this.removeRosterItem(item);
-            }, this);
-
-            // XXX: Not completely sure if this is needed ('remove' might be
-            // enough).
             this.model.on("destroy", function (item) {
                 this.removeRosterItem(item);
             }, this);