mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 18:54:52 +00:00
[BUG #2242]: Quickfix to make phone command reanswerable again
This commit is contained in:
parent
070c8bd91a
commit
0f97f16a38
@ -26,7 +26,7 @@
|
||||
[{:keys [current-chat-id] :as db} [_ chat-id]]
|
||||
(let [chat-id' (or chat-id current-chat-id)
|
||||
;; todo maybe limit is needed
|
||||
requests (requests/get-open-by-chat-id chat-id')
|
||||
requests (requests/get-available-by-chat-id chat-id')
|
||||
requests' (map #(update % :type keyword) requests)]
|
||||
(assoc-in db [:chats chat-id' :requests] requests')))
|
||||
|
||||
|
@ -16,6 +16,22 @@
|
||||
(realm/sorted :added :desc)
|
||||
(realm/realm-collection->list)))
|
||||
|
||||
;; NOTE(oskarth): phone command in Console can be answered again, so we want to list this
|
||||
;; TODO(oskarth): Refactor this, either by extending and/or query or changing status of message
|
||||
(defn- get-reanswerable-by-chat-id
|
||||
[chat-id]
|
||||
(-> (realm/get-by-fields @realm/account-realm :request :and [[:chat-id chat-id]
|
||||
[:type "phone"]
|
||||
[:status "answered"]])
|
||||
(realm/sorted :added :desc)
|
||||
(realm/realm-collection->list)))
|
||||
|
||||
(defn get-available-by-chat-id
|
||||
[chat-id]
|
||||
(-> ((juxt get-open-by-chat-id get-reanswerable-by-chat-id) chat-id)
|
||||
flatten
|
||||
vec))
|
||||
|
||||
(defn save
|
||||
[request]
|
||||
(realm/save @realm/account-realm :request request true))
|
||||
|
@ -9,6 +9,10 @@
|
||||
[chat-id]
|
||||
(data-store/get-open-by-chat-id chat-id))
|
||||
|
||||
(defn get-available-by-chat-id
|
||||
[chat-id]
|
||||
(data-store/get-available-by-chat-id chat-id))
|
||||
|
||||
(defn save
|
||||
[request]
|
||||
(data-store/save request))
|
||||
|
Loading…
x
Reference in New Issue
Block a user