another attempt to fix #1088

This commit is contained in:
Roman Volosovskyi 2017-05-08 15:19:09 +03:00
parent 07c247be93
commit 34b77022f7
3 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,17 @@
function browse(params, context) { function browse(params, context) {
var url; var url;
if (params.metadata && params.metadata.url
&& params.metadata.url !== "undefined" && params.metadata.url != "") {
url = params.metadata.url;
}
if (params.url && params.url !== "undefined" && params.url != "") { if (params.url && params.url !== "undefined" && params.url != "") {
url = params.url; url = params.url;
if (!/^[a-zA-Z-_]+:/.test(url)) { }
url = 'http://' + url;
} if (url && !/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url;
} }
return { return {

View File

@ -164,7 +164,8 @@
;:check-and-load-commands! ;:check-and-load-commands!
(let [params (let [params
{:command command {:command command
:chat-id jail-id} :chat-id chat-id
:jail-id jail-id}
on-send-params on-send-params
(merge params (merge params
@ -230,7 +231,7 @@
(handlers/side-effect! (handlers/side-effect!
(fn [{:keys [contacts] :as db} (fn [{:keys [contacts] :as db}
[_ {{:keys [command metadata args] :as c} :command [_ {{:keys [command metadata args] :as c} :command
:keys [message-id chat-id data-type after]}]] :keys [message-id chat-id jail-id data-type after]}]]
(let [{:keys [dapp? dapp-url name]} (get contacts chat-id) (let [{:keys [dapp? dapp-url name]} (get contacts chat-id)
message-id (random/id) message-id (random/id)
metadata (merge metadata metadata (merge metadata
@ -244,9 +245,10 @@
:created-at (time/now-ms) :created-at (time/now-ms)
:id message-id :id message-id
:chat-id chat-id :chat-id chat-id
:jail-id (or (:bot command) chat-id)} :jail-id jail-id}
request-data {:message-id message-id request-data {:message-id message-id
:chat-id chat-id :chat-id chat-id
:jail-id jail-id
:content {:command (:name command) :content {:command (:name command)
:params (assoc params :metadata metadata) :params (assoc params :metadata metadata)
:type (:type command)} :type (:type command)}

View File

@ -199,7 +199,6 @@
(reg-handler ::add-commands (reg-handler ::add-commands
[(after save-commands-js!) [(after save-commands-js!)
(after save-commands!) (after save-commands!)
(after #(dispatch [:check-and-open-dapp!]))
(after #(dispatch [:update-suggestions])) (after #(dispatch [:update-suggestions]))
(after (fn [_ [id]] (after (fn [_ [id]]
(dispatch [:invoke-commands-loading-callbacks id]) (dispatch [:invoke-commands-loading-callbacks id])