Merge pull request #222 from status-im/feature/improved-pending-messages

Checking pending messages when user appears online (#210)
This commit is contained in:
Roman Volosovskyi 2016-09-11 13:27:27 +03:00 committed by GitHub
commit 5ea0d270fe
3 changed files with 7 additions and 4 deletions

View File

@ -8,8 +8,9 @@
[reagent "0.5.1" :exclusions [cljsjs/react]]
[re-frame "0.7.0"]
[prismatic/schema "1.0.4"]
^{:voom {:repo "git@github.com:status-im/status-lib.git" :branch "master"}}
[status-im/protocol "0.2.1-20160908_061908-geefb360"]
^{:voom {:repo "git@github.com:status-im/status-lib.git"
:branch "master"}}
[status-im/protocol "0.2.2-20160909_082306-gcfbb92b"]
[natal-shell "0.3.0"]
[com.andrewmcveigh/cljs-time "0.4.0"]
[tailrecursion/cljs-priority-map "1.2.0"]

View File

@ -195,7 +195,8 @@
(u/side-effect!
(fn [db [_ from {last-online :at :as payload}]]
(let [prev-last-online (get-in db [:contacts from :last-online])]
(if (< prev-last-online last-online)
(when (< prev-last-online last-online)
(api/resend-pending-messages from)
(dispatch [:update-contact! {:whisper-identity from
:last-online last-online}]))))))

View File

@ -12,7 +12,8 @@
(defn get-pending-messages []
(let [collection (-> (r/get-by-fields :account :pending-message :or [[:status :sending]
[:status :sent]])
[:status :sent]
[:status :failed]])
(r/sorted :timestamp :desc)
(r/collection->map))]
(->> collection