Skip to content

Commit 4af2073

Browse files
committed
Revert "Fixed incorrect parameters provided to Command#yield-control"
This reverts commit ac1de8c. Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
1 parent ac1de8c commit 4af2073

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

src/status_im/chat/commands/core.cljs

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
[status-im.chat.constants :as chat.constants]
77
[status-im.chat.commands.protocol :as protocol]
88
[status-im.chat.commands.impl.transactions :as transactions]
9-
[status-im.contact.db :as db]
109
[status-im.utils.handlers :as handlers]
1110
[status-im.utils.fx :as fx]))
1211

@@ -35,16 +34,13 @@
3534
[type]
3635
(keyword (str (protocol/id type) "-button")))
3736

38-
(defn- contact->address [contact]
39-
(str "0x" (db/public-key->address contact)))
40-
4137
(defn add-chat-contacts
4238
"Enrich command-message by adding contact list of the current private or group chat"
4339
[contacts {:keys [public? group-chat] :as command-message}]
4440
(cond
4541
public? command-message
46-
group-chat (assoc command-message :contacts (map contact->address contacts))
47-
:else (assoc command-message :contact (contact->address (first contacts)))))
42+
group-chat (assoc command-message :contacts (map status-im.contact.db/public-key->address contacts))
43+
:else (assoc command-message :contact (status-im.contact.db/public-key->address (first contacts)))))
4844

4945
(defn enrich-command-message-for-events
5046
"adds new pairs to command-message to be consumed by extension events"

src/status_im/chat/commands/sending.cljs

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
;; errors during validation
3232
{:db (chat/set-chat-ui-props db {:validation-messages validation-error})}
3333
;; no errors
34-
(let [command-message (commands/enrich-command-message-for-events db (create-command-message chat-id type parameter-map cofx))]
35-
(if (satisfies? protocol/Yielding type)
36-
;; yield control implemented, don't send the message
37-
(protocol/yield-control type command-message cofx)
38-
;; no yield control, proceed with sending the command message
34+
(if (satisfies? protocol/Yielding type)
35+
;; yield control implemented, don't send the message
36+
(protocol/yield-control type parameter-map cofx)
37+
;; no yield control, proceed with sending the command message
38+
(let [command-message (create-command-message chat-id type parameter-map cofx)]
3939
(fx/merge cofx
40-
#(protocol/on-send type command-message %)
40+
#(protocol/on-send type (commands/enrich-command-message-for-events db command-message) %)
4141
(commands.input/set-command-reference nil)
4242
(chat.message/send-message command-message)))))))
4343

test/cljs/status_im/test/chat/commands/core.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@
111111
"0x04b790f2c3f4079f35a1fa396465ceb243cc446c9af211d0a1774f869eb9632a67a6e664e24075ec5c5a8a95a509a2a8173dbfeb88af372e784a37fecc1b5c0ba5"
112112
"0x04cc3cec3f88dc1a39e224388f0304023fc78c2a7d05e4ebd61638192cc592d2c13d8f081b5d9995dbfcbe45a4ca7eb80d5c505eee660e8fee0df2da222f047287"})
113113

114-
(def contacts_addresses '("0x5adf1b9e1fa4bd4889fecd598b45079045d98f0e"
115-
"0x21631d18d9681d4ffdd460fc45fa52159fcd95c8"
116-
"0x5541e3be81b76d76cdbf968516caa5a5b773763b"))
114+
(def contacts_addresses '("5adf1b9e1fa4bd4889fecd598b45079045d98f0e"
115+
"21631d18d9681d4ffdd460fc45fa52159fcd95c8"
116+
"5541e3be81b76d76cdbf968516caa5a5b773763b"))
117117

118118
(deftest enrich-command-message-for-events-test-public
119119
(let [db {:chats {"1" {:contacts nil :public? true :group-chat false}}}
@@ -137,4 +137,4 @@
137137
enriched-msg (core/enrich-command-message-for-events db msg)]
138138
(testing "command-message correctly enriched - 1on1 chat"
139139
(is (= enriched-msg
140-
(assoc msg :public? false :group-chat false :contact (first contacts_addresses)))))))
140+
(assoc msg :public? false :group-chat false :contact (first contacts_addresses)))))))

0 commit comments

Comments
 (0)