Browse Source

Fixed callback response in alert

Close #1163
master
Igor Zhukov 9 years ago
parent
commit
da3578fc06
  1. 10
      app/js/services.js
  2. 7
      app/less/app.less
  3. 11
      app/partials/desktop/error_modal.html

10
app/js/services.js

@ -2668,14 +2668,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
!callbackAnswer.message.length) { !callbackAnswer.message.length) {
return; return;
} }
var html = RichTextProcessor.wrapRichText(callbackAnswer.message, {noLinks: true, noLinebreaks: true});
if (callbackAnswer.pFlags.alert) { if (callbackAnswer.pFlags.alert) {
ErrorService.alert(callbackAnswer.message); ErrorService.show({
title_html: html,
alert: true
});
} else { } else {
var html = RichTextProcessor.wrapRichText(callbackAnswer.message, {noLinks: true, noLinebreaks: true}).valueOf();;
toaster.pop({ toaster.pop({
type: 'info', type: 'info',
// timeout: 100000, body: html.valueOf(),
body: html,
bodyOutputType: 'trustedHtml', bodyOutputType: 'trustedHtml',
showCloseButton: false showCloseButton: false
}); });

7
app/less/app.less

@ -3418,6 +3418,13 @@ li.inline_result_sticker.composer_autocomplete_option_active a {
line-height: 160%; line-height: 160%;
} }
.md_simple_modal_alert_body {
.md_simple_header,
.error_modal_description {
text-align: center;
}
}
.error_modal_details { .error_modal_details {
textarea { textarea {
display: block; display: block;

11
app/partials/desktop/error_modal.html

@ -1,6 +1,6 @@
<div class="error_modal_wrap md_simple_modal_wrap" my-modal-position> <div class="error_modal_wrap md_simple_modal_wrap" my-modal-position>
<div class="md_simple_modal_body"> <div class="md_simple_modal_body" ng-class="{md_simple_modal_alert_body: alert}">
<h4 ng-if="error" class="md_simple_header" ng-switch="error.type"> <h4 ng-if="error" class="md_simple_header" ng-switch="error.type">
<span ng-switch-when="MEDIA_TYPE_NOT_SUPPORTED" my-i18n="error_modal_media_not_supported_title"></span> <span ng-switch-when="MEDIA_TYPE_NOT_SUPPORTED" my-i18n="error_modal_media_not_supported_title"></span>
@ -15,9 +15,11 @@
<span ng-switch-when="420" my-i18n="error_modal_flood_title"></span> <span ng-switch-when="420" my-i18n="error_modal_flood_title"></span>
<span ng-switch-default my-i18n="error_modal_internal_title"></span> <span ng-switch-default my-i18n="error_modal_internal_title"></span>
</span> </span>
<span ng-switch-when="CALLBACK_RESPONSE"><!-- empty --></span>
</h4> </h4>
<h4 ng-if="!error" class="md_simple_header" ng-switch="title.length > 0"> <h4 ng-if="!error" class="md_simple_header" ng-switch="title_html !== undefined ? 'html' : (title.length > 0 ? 'text' : 'default')">
<span ng-switch-when="true" ng-bind="title"></span> <span ng-switch-when="html" ng-bind-html="title_html"></span>
<span ng-switch-when="text" ng-bind="title"></span>
<span ng-switch-default my-i18n="error_modal_alert"></span> <span ng-switch-default my-i18n="error_modal_alert"></span>
</h4> </h4>
@ -46,6 +48,7 @@
<span ng-switch-when="PEER_FLOOD" my-i18n="error_modal_not_contact_flood"> <span ng-switch-when="PEER_FLOOD" my-i18n="error_modal_not_contact_flood">
<my-i18n-param name="more-info-link"><a href="https://telegram.org/faq#can-39t-send-messages-to-non-contacts" target="_blank">{0}</a></my-i18n-param> <my-i18n-param name="more-info-link"><a href="https://telegram.org/faq#can-39t-send-messages-to-non-contacts" target="_blank">{0}</a></my-i18n-param>
</span> </span>
<span ng-switch-when="CALLBACK_RESPONSE" ng-bind-html="error.description_html"></span>
<div ng-switch-default ng-switch="error.code"> <div ng-switch-default ng-switch="error.code">
@ -71,7 +74,7 @@ Stack: {{error.originalError.stack || error.stack}}</textarea>
</div> </div>
</div> </div>
<div ng-if="!error" class="error_modal_description" ng-bind="description"></div> <div ng-if="!error && description.length > 0" class="error_modal_description" ng-bind="description"></div>
</div> </div>

Loading…
Cancel
Save