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