Invalid phone number error is shown for valid phone number (#1087)
This commit is contained in:
parent
d9ecb20cad
commit
145e3ba1d4
|
@ -186,7 +186,7 @@
|
||||||
(handlers/register-handler
|
(handlers/register-handler
|
||||||
::proceed-validation-messages
|
::proceed-validation-messages
|
||||||
(handlers/side-effect!
|
(handlers/side-effect!
|
||||||
(fn [db [_ command chat-id {:keys [markup validationHandler parameters] :as errors} proceed-fn]]
|
(fn [db [_ command chat-id {:keys [markup validationHandler parameters]} proceed-fn]]
|
||||||
(let [set-errors #(do (dispatch [:set-chat-ui-props {:validation-messages %
|
(let [set-errors #(do (dispatch [:set-chat-ui-props {:validation-messages %
|
||||||
:sending-in-progress? false}]))]
|
:sending-in-progress? false}]))]
|
||||||
(cond
|
(cond
|
||||||
|
@ -321,9 +321,8 @@
|
||||||
{:command command
|
{:command command
|
||||||
:chat-id chat-id
|
:chat-id chat-id
|
||||||
:data-type :validator
|
:data-type :validator
|
||||||
:after #(do
|
:after #(dispatch [::proceed-validation-messages
|
||||||
(dispatch [::proceed-validation-messages
|
command chat-id %2 after-validation])}])))))
|
||||||
command chat-id %2 after-validation]))}])))))
|
|
||||||
|
|
||||||
(handlers/register-handler
|
(handlers/register-handler
|
||||||
:set-chat-seq-arg-input-text
|
:set-chat-seq-arg-input-text
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
(defn valid-mobile-number? [number]
|
(defn valid-mobile-number? [number]
|
||||||
(when (string? number)
|
(when (string? number)
|
||||||
(let [number-obj (awesome-phonenumber. number country-code)]
|
(let [{:keys [valid type]} (-> (awesome-phonenumber. number country-code)
|
||||||
(and (.isValid number-obj)
|
(.toJSON)
|
||||||
(.isMobile number-obj)))))
|
(js->clj :keywordize-keys true))]
|
||||||
|
(and valid
|
||||||
|
(some #{(keyword type)} '(:mobile :fixed-line-or-mobile :pager))))))
|
||||||
|
|
Loading…
Reference in New Issue