parent
aa89c0f85d
commit
158e4738bb
|
@ -218,6 +218,11 @@
|
||||||
(fn [db [_ {:keys [chat-id msg-id]}]]
|
(fn [db [_ {:keys [chat-id msg-id]}]]
|
||||||
(set-message-shown db chat-id msg-id)))
|
(set-message-shown db chat-id msg-id)))
|
||||||
|
|
||||||
|
(defn default-delivery-status [chat-id]
|
||||||
|
(if (console? chat-id)
|
||||||
|
:seen
|
||||||
|
:pending))
|
||||||
|
|
||||||
(defn prepare-message
|
(defn prepare-message
|
||||||
[{:keys [identity current-chat-id] :as db} _]
|
[{:keys [identity current-chat-id] :as db} _]
|
||||||
(let [text (get-in db [:chats current-chat-id :input-text])
|
(let [text (get-in db [:chats current-chat-id :input-text])
|
||||||
|
@ -230,7 +235,7 @@
|
||||||
:to current-chat-id
|
:to current-chat-id
|
||||||
:from identity
|
:from identity
|
||||||
:content-type text-content-type
|
:content-type text-content-type
|
||||||
:delivery-status :pending
|
:delivery-status (default-delivery-status current-chat-id)
|
||||||
:outgoing true
|
:outgoing true
|
||||||
:timestamp (time/now-ms)})]
|
:timestamp (time/now-ms)})]
|
||||||
(if command
|
(if command
|
||||||
|
@ -246,6 +251,7 @@
|
||||||
:to chat-id
|
:to chat-id
|
||||||
:content content
|
:content content
|
||||||
:content-type content-type-command
|
:content-type content-type-command
|
||||||
|
:delivery-status (default-delivery-status chat-id)
|
||||||
:outgoing true
|
:outgoing true
|
||||||
:preview preview-string
|
:preview preview-string
|
||||||
:rendered-preview preview
|
:rendered-preview preview
|
||||||
|
@ -588,9 +594,9 @@
|
||||||
|
|
||||||
(register-handler :send-seen!
|
(register-handler :send-seen!
|
||||||
(after (fn [_ [_ chat-id message-id]]
|
(after (fn [_ [_ chat-id message-id]]
|
||||||
(when-not (= "console" chat-id))
|
(when-not (console? chat-id))
|
||||||
(dispatch [:msg-seen chat-id message-id])))
|
(dispatch [:msg-seen chat-id message-id])))
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [_ [_ chat-id message-id]]
|
(fn [_ [_ chat-id message-id]]
|
||||||
(when-not (= "console" chat-id)
|
(when-not (console? chat-id)
|
||||||
(api/send-seen chat-id message-id)))))
|
(api/send-seen chat-id message-id)))))
|
||||||
|
|
Loading…
Reference in New Issue