From 158e4738bb0be3598fc63716634b44ee2d32be78 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 7 Jul 2016 11:16:09 +0300 Subject: [PATCH] statuses fro console chat Former-commit-id: 0ddc4608ee800fa38886b12069a88b60c30e3f45 --- src/status_im/chat/handlers.cljs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index 72eb4734f3..5d745fae7b 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -218,6 +218,11 @@ (fn [db [_ {:keys [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 [{:keys [identity current-chat-id] :as db} _] (let [text (get-in db [:chats current-chat-id :input-text]) @@ -230,7 +235,7 @@ :to current-chat-id :from identity :content-type text-content-type - :delivery-status :pending + :delivery-status (default-delivery-status current-chat-id) :outgoing true :timestamp (time/now-ms)})] (if command @@ -246,6 +251,7 @@ :to chat-id :content content :content-type content-type-command + :delivery-status (default-delivery-status chat-id) :outgoing true :preview preview-string :rendered-preview preview @@ -588,9 +594,9 @@ (register-handler :send-seen! (after (fn [_ [_ chat-id message-id]] - (when-not (= "console" chat-id)) + (when-not (console? chat-id)) (dispatch [:msg-seen chat-id message-id]))) (u/side-effect! (fn [_ [_ chat-id message-id]] - (when-not (= "console" chat-id) + (when-not (console? chat-id) (api/send-seen chat-id message-id)))))