Browse code

FIX: prijimanie sprav od ludi nie z rostera v multichate

Cinan Rakosnik authored on 12/05/2013 at 13:52:59
Showing 1 changed files
... ...
@@ -48,9 +48,13 @@ class Xmpp.Models.Chat extends Xmpp.Models.Model
48 48
     attendants = _.map(contactsWithoutMe, (jid) =>
49 49
       contact = App.Collections.contacts.findByJid(jid)
50 50
       if not contact
51
-        newTempContact = Xmpp.Collections.ChatsCollection.createTempContact(jid)
52
-        App.Collections.contacts.add(newTempContact)
53
-        contact = newTempContact
51
+        contact = new Xmpp.Models.Contact(
52
+          id: App.stripJid(jid)
53
+          jid: App.stripJid(jid)
54
+          belongsTo: [App.Models.me.get('jid')]
55
+          usingMyApp: true
56
+        )
57
+        App.Collections.contacts.add(contact)
54 58
 
55 59
       contact
56 60
     )
... ...
@@ -59,10 +63,6 @@ class Xmpp.Models.Chat extends Xmpp.Models.Model
59 59
 
60 60
     if owner
61 61
       ownerContact = App.Collections.contacts.findByJid(owner)
62
-      if not ownerContact
63
-        ownerContact = Xmpp.Collections.ChatsCollection.createTempContact(owner)
64
-        App.Collections.contacts.add(ownerContact)
65
-
66 62
       @set('who', ownerContact)
67 63
 
68 64
     App.debug ['importing contacts to chat', this, this.get('chatId')]