fix #1003
This commit is contained in:
parent
5b0e6642c2
commit
4843003749
|
@ -150,7 +150,7 @@
|
||||||
(dispatch [:prepare-message data]))))))
|
(dispatch [:prepare-message data]))))))
|
||||||
|
|
||||||
(handlers/register-handler
|
(handlers/register-handler
|
||||||
::proceed-command
|
:proceed-command
|
||||||
(handlers/side-effect!
|
(handlers/side-effect!
|
||||||
(fn [db [_ command chat-id]]
|
(fn [db [_ command chat-id]]
|
||||||
(let [after-validation #(dispatch [::request-command-data
|
(let [after-validation #(dispatch [::request-command-data
|
||||||
|
@ -249,7 +249,7 @@
|
||||||
(if (:command chat-command)
|
(if (:command chat-command)
|
||||||
(if (= :complete (input-model/command-completion chat-command))
|
(if (= :complete (input-model/command-completion chat-command))
|
||||||
(do
|
(do
|
||||||
(dispatch [::proceed-command chat-command chat-id])
|
(dispatch [:proceed-command chat-command chat-id])
|
||||||
(dispatch [:clear-seq-arguments chat-id]))
|
(dispatch [:clear-seq-arguments chat-id]))
|
||||||
(let [text (get-in db [:chats chat-id :input-text])]
|
(let [text (get-in db [:chats chat-id :input-text])]
|
||||||
(dispatch [:set-chat-ui-props :sending-in-progress? false])
|
(dispatch [:set-chat-ui-props :sending-in-progress? false])
|
||||||
|
@ -315,4 +315,4 @@
|
||||||
:set-chat-seq-arg-input-text
|
:set-chat-seq-arg-input-text
|
||||||
(fn [{:keys [current-chat-id] :as db} [_ text chat-id]]
|
(fn [{:keys [current-chat-id] :as db} [_ text chat-id]]
|
||||||
(let [chat-id (or chat-id current-chat-id)]
|
(let [chat-id (or chat-id current-chat-id)]
|
||||||
(assoc-in db [:chats chat-id :seq-argument-input-text] text))))
|
(assoc-in db [:chats chat-id :seq-argument-input-text] text))))
|
||||||
|
|
|
@ -58,9 +58,26 @@
|
||||||
(dispatch [:chat-with-command whisper-identity action params]))))
|
(dispatch [:chat-with-command whisper-identity action params]))))
|
||||||
|
|
||||||
|
|
||||||
|
(register-handler ::send-command
|
||||||
|
(u/side-effect!
|
||||||
|
(fn [{:keys [current-chat-id] :as db} [_ command-key params]]
|
||||||
|
(let [command (get-in db [:chats current-chat-id :commands command-key])
|
||||||
|
command-input {:content "0"
|
||||||
|
:command command
|
||||||
|
:parameter-idx 0
|
||||||
|
:params {"amount" (:amount params)}
|
||||||
|
:to-message-id nil}]
|
||||||
|
(dispatch [:proceed-command
|
||||||
|
{:command command,
|
||||||
|
:metadata nil,
|
||||||
|
:args [(str (:amount params))]}
|
||||||
|
current-chat-id])))))
|
||||||
|
|
||||||
(defn chat-with-command
|
(defn chat-with-command
|
||||||
[_ [_ whisper-identity command-key params]]
|
[_ [_ whisper-identity command-key params]]
|
||||||
(dispatch [:remove-contacts-click-handler])
|
(dispatch [:remove-contacts-click-handler])
|
||||||
|
(dispatch [:add-chat-loaded-callback whisper-identity
|
||||||
|
#(dispatch [::send-command command-key params])])
|
||||||
(dispatch [:start-chat whisper-identity]))
|
(dispatch [:start-chat whisper-identity]))
|
||||||
|
|
||||||
(register-handler :chat-with-command
|
(register-handler :chat-with-command
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
(register-sub
|
(register-sub
|
||||||
:chat-ui-props
|
:chat-ui-props
|
||||||
(fn [db [_ ui-element chat-id]]
|
(fn [db [_ ui-element chat-id]]
|
||||||
(let [chat-id (or chat-id (:current-chat-id @db))]
|
(let [current-chat-id (subscribe [:get-current-chat-id])]
|
||||||
(reaction (get-in @db [:chat-ui-props chat-id ui-element])))))
|
(reaction (get-in @db [:chat-ui-props (or chat-id @current-chat-id) ui-element])))))
|
||||||
|
|
||||||
(register-sub
|
(register-sub
|
||||||
:chat-input-margin
|
:chat-input-margin
|
||||||
|
|
Loading…
Reference in New Issue