Skip to content

Commit

Permalink
another attempt to fix status-im#1088
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed May 8, 2017
1 parent 07c247b commit 34b7702
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions bots/browse/bot.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
function browse(params, context) {
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 != "") {
url = params.url;
if (!/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url;
}
}

if (url && !/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url;
}

return {
Expand Down
8 changes: 5 additions & 3 deletions src/status_im/chat/handlers/input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
;:check-and-load-commands!
(let [params
{:command command
:chat-id jail-id}
:chat-id chat-id
:jail-id jail-id}

on-send-params
(merge params
Expand Down Expand Up @@ -230,7 +231,7 @@
(handlers/side-effect!
(fn [{:keys [contacts] :as db}
[_ {{: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)
message-id (random/id)
metadata (merge metadata
Expand All @@ -244,9 +245,10 @@
:created-at (time/now-ms)
:id message-id
:chat-id chat-id
:jail-id (or (:bot command) chat-id)}
:jail-id jail-id}
request-data {:message-id message-id
:chat-id chat-id
:jail-id jail-id
:content {:command (:name command)
:params (assoc params :metadata metadata)
:type (:type command)}
Expand Down
1 change: 0 additions & 1 deletion src/status_im/commands/handlers/loading.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@
(reg-handler ::add-commands
[(after save-commands-js!)
(after save-commands!)
(after #(dispatch [:check-and-open-dapp!]))
(after #(dispatch [:update-suggestions]))
(after (fn [_ [id]]
(dispatch [:invoke-commands-loading-callbacks id])
Expand Down

0 comments on commit 34b7702

Please # to comment.