Merge pull request #219 from status-im/bug/get-time-#196

fixes #196

Former-commit-id: 0e9f91026d
This commit is contained in:
Roman Volosovskyi 2016-09-07 14:15:36 +03:00 committed by GitHub
commit 00d431e69c
1 changed files with 11 additions and 7 deletions

View File

@ -25,7 +25,8 @@
[status-im.i18n :refer [label label-pluralize]]
[status-im.components.animation :as anim]
[reagent.core :as r]
[clojure.string :as str]))
[clojure.string :as str]
[cljs-time.core :as t]))
(defn contacts-by-identity [contacts]
@ -195,18 +196,21 @@
(defn online-text [contact chat-id]
(if contact
(if (> (get contact :last-online) 0)
(time/time-ago (time/to-date (get contact :last-online)))
(label :t/active-unknown))
(let [last-online (get contact :last-online)
last-online-date (time/to-date last-online)
now-date (t/now)]
(if (and (> last-online 0)
(<= last-online-date now-date))
(time/time-ago last-online-date)
(label :t/active-unknown)))
(if (= chat-id "console")
(label :t/active-online)
(label :t/active-unknown))))
(defn toolbar-content [platform-specific]
(let [{:keys [group-chat name contacts chat-id]}
(subscribe [:chat-properties [:group-chat :name :contacts :chat-id]])
(let [{:keys [group-chat name contacts chat-id]} (subscribe [:chat-properties [:group-chat :name :contacts :chat-id]])
show-actions (subscribe [:show-actions])
contact (subscribe [:get-in [:contacts @chat-id]])]
contact (subscribe [:get-in [:contacts @chat-id]])]
(fn [platform-specific]
[view (st/chat-name-view @show-actions)
[text {:style st/chat-name-text