From 7f21ab2d3cbf9704e52c91d185fbaba3adec5403 Mon Sep 17 00:00:00 2001 From: alwxndr Date: Thu, 8 Sep 2016 08:52:34 +0300 Subject: [PATCH] checking pending messages when user appears online (#210) --- project.clj | 5 +++-- src/status_im/contacts/handlers.cljs | 3 ++- src/status_im/models/pending_messages.cljs | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index 09c6246364..282e5b8ebd 100644 --- a/project.clj +++ b/project.clj @@ -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"] diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index 16e8e3a4dc..882ac7fe04 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -179,7 +179,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}])))))) diff --git a/src/status_im/models/pending_messages.cljs b/src/status_im/models/pending_messages.cljs index 6333f066eb..2f3d21af22 100644 --- a/src/status_im/models/pending_messages.cljs +++ b/src/status_im/models/pending_messages.cljs @@ -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