Fixes #4309: Do not allow empty command to be sent
This commit is contained in:
parent
750b95afd6
commit
71867a9674
|
@ -15,6 +15,10 @@
|
||||||
(animation/timing spin-value {:toValue to-spin-value
|
(animation/timing spin-value {:toValue to-spin-value
|
||||||
:duration 300})))))
|
:duration 300})))))
|
||||||
|
|
||||||
|
(defn sendable? [input-text]
|
||||||
|
(let [trimmed (string/trim input-text)]
|
||||||
|
(not (or (string/blank? trimmed) (= trimmed "/")))))
|
||||||
|
|
||||||
(defview send-button-view []
|
(defview send-button-view []
|
||||||
(letsubs [command-completion [:command-completion]
|
(letsubs [command-completion [:command-completion]
|
||||||
selected-command [:selected-chat-command]
|
selected-command [:selected-chat-command]
|
||||||
|
@ -24,7 +28,8 @@
|
||||||
:command-completion command-completion})]
|
:command-completion command-completion})]
|
||||||
{:component-did-update on-update}
|
{:component-did-update on-update}
|
||||||
(let [{:keys [hide-send-button sequential-params]} (:command selected-command)]
|
(let [{:keys [hide-send-button sequential-params]} (:command selected-command)]
|
||||||
(when (and (not (string/blank? input-text))
|
(when
|
||||||
|
(and (sendable? input-text)
|
||||||
(or (not selected-command)
|
(or (not selected-command)
|
||||||
(some #{:complete :less-than-needed} [command-completion]))
|
(some #{:complete :less-than-needed} [command-completion]))
|
||||||
(not hide-send-button))
|
(not hide-send-button))
|
||||||
|
|
Loading…
Reference in New Issue