fix #1448 #1741 - workaround to identify a group chat by existence of group-id rather than unreliable group-chat flag

This commit is contained in:
Goran Jovic 2017-08-31 16:11:26 +02:00 committed by Roman Volosovskyi
parent a3700c19ac
commit 2fc6854543
1 changed files with 9 additions and 10 deletions

View File

@ -6,8 +6,6 @@
[status-im.data-store.messages :as msg-store] [status-im.data-store.messages :as msg-store]
[status-im.utils.handlers :refer [register-handler-fx]] [status-im.utils.handlers :refer [register-handler-fx]]
[status-im.components.status :as status] [status-im.components.status :as status]
[status-im.chat.constants :as const]
[status-im.commands.utils :as commands-utils]
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[status-im.utils.platform :as platform])) [status-im.utils.platform :as platform]))
@ -15,12 +13,13 @@
(defn generate-context (defn generate-context
"Generates context for jail call" "Generates context for jail call"
[{:keys [chats] :accounts/keys [current-account-id]} chat-id to] [{:keys [chats] :accounts/keys [current-account-id]} chat-id to group-id]
(merge {:platform platform/platform (merge {:platform platform/platform
:from current-account-id :from current-account-id
:to to :to to
:chat {:chat-id chat-id :chat {:chat-id chat-id
:group-chat (get-in chats [chat-id :group-chat])}} :group-chat (or (get-in chats [chat-id :group-chat])
(not (nil? group-id)))}}
i18n/delimeters)) i18n/delimeters))
;;;; Coeffects ;;;; Coeffects
@ -70,9 +69,9 @@
[trim-v] [trim-v]
(fn [{:keys [db]} (fn [{:keys [db]}
[{{:keys [command content-command params type]} :content [{{:keys [command content-command params type]} :content
:keys [chat-id jail-id] :as message} :keys [chat-id jail-id group-id] :as message}
data-type]] data-type]]
(let [{:keys [chats] (let [{:keys [chats]
:accounts/keys [current-account-id] :accounts/keys [current-account-id]
:contacts/keys [contacts]} db :contacts/keys [contacts]} db
jail-id (or jail-id chat-id) jail-id (or jail-id chat-id)
@ -85,10 +84,10 @@
data-type] data-type]
to (get-in contacts [chat-id :address]) to (get-in contacts [chat-id :address])
jail-params {:parameters params jail-params {:parameters params
:context (generate-context db chat-id to)}] :context (generate-context db chat-id to group-id)}]
{:chat-fx/call-jail {:jail-id jail-id {:chat-fx/call-jail {:jail-id jail-id
:path path :path path
:params jail-params :params jail-params
:callback-events-creator (fn [jail-response] :callback-events-creator (fn [jail-response]
[[::jail-command-data-response [[::jail-command-data-response
jail-response message data-type]])}}) jail-response message data-type]])}})