parent
a504c1b861
commit
d0f882d8a7
|
@ -99,7 +99,7 @@
|
|||
(log/debug action "msg" msg)
|
||||
(save-message chat-id msg)
|
||||
(-> db
|
||||
(create-chat chat-id [chat-id])
|
||||
(create-chat chat-id [chat-id] false)
|
||||
(signal-chat-updated chat-id))))
|
||||
|
||||
(register-handler :acked-msg
|
||||
|
@ -225,11 +225,15 @@
|
|||
(log/debug action)
|
||||
(let [identities (-> (new-group-selection db)
|
||||
(vec))
|
||||
group-id (api/start-group-chat identities)
|
||||
db (create-chat db group-id identities group-name)]
|
||||
group-id (api/start-group-chat identities group-name)
|
||||
db (create-chat db group-id identities true group-name)]
|
||||
(dispatch [:show-chat group-id navigator])
|
||||
db)))
|
||||
|
||||
(register-handler :group-chat-invite-received
|
||||
(fn [db [action from group-id identities group-name]]
|
||||
(log/debug action from group-id identities)
|
||||
(create-chat db group-id identities true group-name)))
|
||||
|
||||
(comment
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
chat-id))
|
||||
|
||||
(defn create-chat
|
||||
([db chat-id identities]
|
||||
(create-chat db chat-id identities nil))
|
||||
([db chat-id identities chat-name]
|
||||
([db chat-id identities group-chat?]
|
||||
(create-chat db chat-id identities group-chat? nil))
|
||||
([db chat-id identities group-chat? chat-name]
|
||||
(if (r/exists? :chats :chat-id chat-id)
|
||||
db
|
||||
(let [chat-name (or chat-name
|
||||
|
@ -40,8 +40,7 @@
|
|||
_ (log/debug "creating chat" chat-name)]
|
||||
(r/write
|
||||
(fn []
|
||||
(let [group-chat? (> (count identities) 1)
|
||||
contacts (mapv (fn [ident]
|
||||
(let [contacts (mapv (fn [ident]
|
||||
{:identity ident}) identities)]
|
||||
(r/create :chats {:chat-id chat-id
|
||||
:name chat-name
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
(dispatch [:acked-msg from msg-id]))
|
||||
:delivery-failed (let [{:keys [msg-id]} event]
|
||||
(dispatch [:msg-delivery-failed msg-id]))
|
||||
;:new-group-chat (let [{:keys [from group-id identities]} event]
|
||||
; (set-group-id! group-id)
|
||||
; (set-group-identities identities)
|
||||
; (add-to-chat "group-chat" ":" (str "Received group chat invitation from " from " for group-id: " group-id)))
|
||||
:new-group-chat (let [{:keys [from group-id identities group-name]} event]
|
||||
(dispatch [:group-chat-invite-received from group-id identities group-name]))
|
||||
;:group-chat-invite-acked (let [{:keys [from group-id]} event]
|
||||
; (add-to-chat "group-chat" ":" (str "Received ACK for group chat invitation from " from " for group-id: " group-id)))
|
||||
;:new-group-msg (let [{from :from
|
||||
|
|
Loading…
Reference in New Issue