Skip to content
Browse files

Tidy: Shortened code for contact loading with presence

  • Loading branch information...
1 parent 5c2030d commit 9379535ee0419d9c5e313b4f016e2fa626b2f71a Theo Cushion committed Mar 16, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/xeps/presence.js
View
14 src/xeps/presence.js
@@ -13,17 +13,17 @@ Frabjous.Presence = DS.Model.extend({
contact: DS.belongsTo('Frabjous.Contact'),
didLoad: function(){
var contact;
- var type = Frabjous.Contact;
- var contact_id = this.get('from').toString();
- var contact_client_id = Frabjous.Store.clientIdForId(type, contact_id);
+ var type = Frabjous.Contact;
+ var id = this.get('from').toString();
+ var client_id = Frabjous.Store.clientIdForId(type, id);
- if( Ember.none(contact_client_id) ){
+ if( Ember.none(client_id) ){
// No contact exists, so create one
- Frabjous.Store.load(type,{jid: this.get('from'), _presence_history:[this.get('id')]});
- contact = Frabjous.Store.find(type,contact_id);
+ Frabjous.Store.load(type,{jid: id, _presence_history:[this.get('id')]});
+ contact = Frabjous.Store.find(type,id);
}else{
// Update contact
- contact = Frabjous.Store.find(type,contact_id);
+ contact = Frabjous.Store.find(type,id);
contact.get('_presence_history').addObject(this);
}

0 comments on commit 9379535

Please sign in to comment.
Something went wrong with that request. Please try again.