aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Kavlie <akavlie@gmail.com>2011-11-04 22:42:42 -0700
committerAaron Kavlie <akavlie@gmail.com>2011-11-04 22:42:42 -0700
commit5d0e8b93e16261cfa4d2d4c5bddd99a38a9fa0cc (patch)
tree963d6875b0661a9553ccd5fc44fe4007593d8b3f
parent8fdc3c197369793dc52a989e8000e7493d5ca038 (diff)
downloadreevo-webirc-5d0e8b93e16261cfa4d2d4c5bddd99a38a9fa0cc.tar.gz
reevo-webirc-5d0e8b93e16261cfa4d2d4c5bddd99a38a9fa0cc.zip
Replace add with destroy on channel part.
-rw-r--r--app.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app.js b/app.js
index 5f2dc94..820d8ff 100644
--- a/app.js
+++ b/app.js
@@ -42,7 +42,12 @@ $(function() {
42 }); 42 });
43 43
44 var Participants = Backbone.Collection.extend({ 44 var Participants = Backbone.Collection.extend({
45 model: Person 45 model: Person,
46 getByNick: function(nick) {
47 return this.detect(function(person) {
48 return person.get('nick') == nick;
49 });
50 }
46 }); 51 });
47 52
48 var Frame = Backbone.Model.extend({ 53 var Frame = Backbone.Model.extend({
@@ -397,7 +402,7 @@ $(function() {
397 frames.getByName(data.channel).part(); 402 frames.getByName(data.channel).part();
398 } else { 403 } else {
399 channel = frames.getByName(data.channel); 404 channel = frames.getByName(data.channel);
400 channel.participants.add({nick: data.nick}); 405 channel.participants.getByNick(data.nick).destroy();
401 var partMessage = new Message({type: 'part', nick: data.nick}); 406 var partMessage = new Message({type: 'part', nick: data.nick});
402 partMessage.setText(); 407 partMessage.setText();
403 channel.stream.add(partMessage); 408 channel.stream.add(partMessage);