From 82786e91ceb0f7c1324d9f7667269a9b53db2fa2 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 20 Dec 2016 18:42:21 +0300 Subject: [PATCH] Fixed confirm for opening URL from verified bots --- app/js/directives.js | 2 +- app/js/messages_manager.js | 6 ++++-- app/js/services.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/js/directives.js b/app/js/directives.js index 00518dc7..211200e8 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -232,7 +232,7 @@ angular.module('myApp.directives', ['myApp.filters']) } var scope = $scope.$new(true) - scope.markup = AppMessagesManager.wrapReplyMarkup(message.reply_markup) + scope.markup = AppMessagesManager.wrapReplyMarkup(message.reply_markup, message.fromID) scope.messageId = message.mid messageKeyboardCompiled(scope, function (clonedElement) { $('.im_message_keyboard', element).replaceWith(clonedElement) diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index 49742a61..ec90d13a 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -2319,7 +2319,7 @@ angular.module('myApp.services') return messagesForHistory[msgID] = message } - function wrapReplyMarkup (replyMarkup) { + function wrapReplyMarkup (replyMarkup, fromID) { if (!replyMarkup || replyMarkup._ == 'replyKeyboardHide') { return false @@ -2340,7 +2340,9 @@ angular.module('myApp.services') angular.forEach(markupRow.buttons, function (markupButton) { markupButton.rText = RichTextProcessor.wrapRichText(markupButton.text, {noLinks: true, noLinebreaks: true}) if (markupButton._ == 'keyboardButtonUrl') { - markupButton.pUrl = RichTextProcessor.wrapUrl(markupButton.url, 1) + var from = AppUsersManager.getUser(fromID) + var unsafe = !(from && from.pFlags && from.pFlags.verified) + markupButton.pUrl = RichTextProcessor.wrapUrl(markupButton.url, unsafe) } }) }) diff --git a/app/js/services.js b/app/js/services.js index c80c4567..d6a0b62a 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -2800,13 +2800,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) showCallbackMessage(callbackAnswer.message, callbackAnswer.pFlags.alert) } else if (typeof callbackAnswer.url === 'string') { - LocationParamsService.openUrl(callbackAnswer.url) + var url = RichTextProcessor.wrapUrl(callbackAnswer.url, true) + LocationParamsService.openUrl(url) } }) } function gameButtonClick (id) { - console.trace() var message = AppMessagesManager.getMessage(id) var peerID = AppMessagesManager.getMessagePeer(message)