prevent unecessary :preview calls to jail
This commit is contained in:
parent
30ef161afa
commit
45a08d7643
|
@ -45,3 +45,10 @@
|
|||
[:read-external-storage]
|
||||
#(dispatch [:initialize-geth])])
|
||||
(log/debug "ignoring command: " command)))))
|
||||
|
||||
(handlers/register-handler :request-command-preview
|
||||
(handlers/side-effect!
|
||||
(fn [db [_ {:keys [message-id] :as message}]]
|
||||
(let [previews (get-in db [:message-data :preview])]
|
||||
(when-not (contains? previews message-id)
|
||||
(dispatch [:request-command-data message :preview]))))))
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
(dispatch [:upsert-chat! {:chat-id chat-id'
|
||||
:group-chat group-chat?}])
|
||||
(when (get-in message [:content :command])
|
||||
(dispatch [:request-command-data message :preview]))
|
||||
(dispatch [:request-command-preview message]))
|
||||
(dispatch [::add-message chat-id' message'])
|
||||
(dispatch [::set-last-message message'])
|
||||
(when (= (:content-type message') content-type-command-request)
|
||||
|
|
|
@ -383,10 +383,10 @@
|
|||
(r/create-class
|
||||
{:component-will-mount
|
||||
(fn []
|
||||
(let [{:keys [bot] :as command} (get-in message [:content])
|
||||
(let [{:keys [bot command] :as content} (get-in message [:content])
|
||||
message' (assoc message :jail-id bot)]
|
||||
(when (and command (not @preview))
|
||||
(dispatch [:request-command-data message' :preview]))))
|
||||
(dispatch [:request-command-preview message']))))
|
||||
|
||||
:component-did-mount
|
||||
(fn []
|
||||
|
|
Loading…
Reference in New Issue