parent
7d2371afec
commit
ec1439943d
|
@ -285,13 +285,15 @@
|
||||||
|
|
||||||
(defmethod nav/preload-data! :chat
|
(defmethod nav/preload-data! :chat
|
||||||
[{:keys [current-chat-id] :as db} [_ _ id]]
|
[{:keys [current-chat-id] :as db} [_ _ id]]
|
||||||
(let [messages (get-in db [:chats current-chat-id :messages])]
|
(let [chat-id (or id current-chat-id)
|
||||||
|
messages (get-in db [:chats chat-id :messages])
|
||||||
|
db' (assoc db :current-chat-id chat-id)]
|
||||||
|
(println "wuuut..." chat-id messages)
|
||||||
(if (seq messages)
|
(if (seq messages)
|
||||||
(-> db
|
db'
|
||||||
(assoc :current-chat-id (or id current-chat-id))
|
(-> db'
|
||||||
load-messages!
|
load-messages!
|
||||||
init-chat)
|
init-chat))))
|
||||||
db)))
|
|
||||||
|
|
||||||
(defn prepare-chat
|
(defn prepare-chat
|
||||||
[{:keys [contacts] :as db} [_ contcat-id]]
|
[{:keys [contacts] :as db} [_ contcat-id]]
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
(:require [re-frame.core :refer [register-sub]]))
|
(:require [re-frame.core :refer [register-sub]]))
|
||||||
|
|
||||||
(register-sub :selected-participant
|
(register-sub :selected-participant
|
||||||
(fn [db [_]]
|
(fn [db _]
|
||||||
(let [participants (:selected-participants @db)]
|
|
||||||
(reaction
|
(reaction
|
||||||
(when (seq participants)
|
(let [identity (first (:selected-participants @db))]
|
||||||
(let [identity (first participants)]
|
(get-in @db [:contacts identity])))))
|
||||||
(get-in @db [:contacts identity])))))))
|
|
||||||
|
|
||||||
(register-sub :group-settings
|
(register-sub :group-settings
|
||||||
(fn [db [_ k]]
|
(fn [db [_ k]]
|
||||||
|
|
Loading…
Reference in New Issue