Browse code

FIX: nastavenie ucastnikov multichatu pri vykopnuti ludi

Premenoval som metodu na nastavenie ludi v multichate

Cinan Rakosnik authored on 08/05/2013 at 12:15:39
Showing 2 changed files
... ...
@@ -12,7 +12,7 @@ class WsChatController < WsController
12 12
                 elsif answer = message.first_element('synced_contacts')
13 13
                     # toto mozem prijat len ako ucastnik multichatu (nie admin)
14 14
                     contacts = xml_contacts_to_array(answer)
15
-                    # TODO: ulozit aj v datastore kontakty
15
+                    set_contacts_in_multichat(find_client(message.to.strip.to_s), answer.attribute('chat_id').to_s, message.from.to_s, contacts)
16 16
                     sync_contacts_frontend(message.from, message.to, answer.attribute('chat_id').to_s, contacts)
17 17
                 elsif answer = message.first_element('exported_chat')
18 18
                     contacts = xml_contacts_to_array(message.first_element('exported_chat'))
... ...
@@ -40,7 +40,7 @@ class WsChatController < WsController
40 40
     def import_people_in_chat(owner, me, chat_id, contacts)
41 41
         #Rails.logger.debug ['imported chat arrived', message.to_s, chat_id]
42 42
         client = find_client(me.strip.to_s)
43
-        create_opened_chat(client, chat_id, owner.to_s, contacts)
43
+        set_contacts_in_multichat(client, chat_id, owner.to_s, contacts)
44 44
 
45 45
         send_message 'app.chat.importChat',
46 46
                      owner:    owner.strip.to_s,
... ...
@@ -55,7 +55,7 @@ class WsChatController < WsController
55 55
         chat_id = hash + Time.now.to_f.to_s
56 56
         client = find_client(me)
57 57
 
58
-        create_opened_chat(client, chat_id, client.jid.to_s)
58
+        set_contacts_in_multichat(client, chat_id, client.jid.to_s)
59 59
 
60 60
         trigger_success id: chat_id
61 61
     end
... ...
@@ -2,7 +2,7 @@ class WsController < WebsocketRails::BaseController
2 2
 
3 3
     protected
4 4
 
5
-    def create_opened_chat(client, chat_id, owner = '', attendants = [])
5
+    def set_contacts_in_multichat(client, chat_id, owner, attendants = [])
6 6
         connection_store[:opened_chats] = {} if ! connection_store[:opened_chats]
7 7
         connection_store[:opened_chats][client] = {} if ! connection_store[:opened_chats][client]
8 8
         connection_store[:opened_chats][client][chat_id] = {owner: owner, attendants: attendants}