diff --git a/app/js/controllers.js b/app/js/controllers.js index fd9ea8cc..6267b605 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1156,8 +1156,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) data: peerData }); - MtpApiManager.getUserID().then(function (id) { - $scope.ownID = id; + MtpApiManager.getUserID().then(function (myID) { + $scope.ownID = myID; }); if (preload) { @@ -2147,6 +2147,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) { // console.log('Restore draft', 'draft' + $scope.curDialog.peerID, draftText); $scope.draftMessage.text = draftText || ''; + $scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID); // console.log('send broadcast', $scope.draftMessage); $scope.$broadcast('ui_peer_draft'); }); diff --git a/app/js/directives.js b/app/js/directives.js index 754c4960..b723cad3 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1395,7 +1395,7 @@ angular.module('myApp.directives', ['myApp.filters']) }) - .directive('mySendForm', function ($timeout, $compile, $modalStack, $http, $interpolate, Storage, AppStickersManager, AppDocsManager, ErrorService) { + .directive('mySendForm', function (_, $timeout, $compile, $modalStack, $http, $interpolate, Storage, AppStickersManager, AppDocsManager, ErrorService) { return { link: link, @@ -1495,9 +1495,7 @@ angular.module('myApp.directives', ['myApp.filters']) var richTextarea = composer.richTextareaEl[0]; if (richTextarea) { - $(richTextarea) - .attr('placeholder', $interpolate($(messageField).attr('placeholder'))($scope)) - .on('keydown keyup', updateHeight); + $(richTextarea).on('keydown keyup', updateHeight); } fileSelects.on('change', function () { @@ -1571,6 +1569,9 @@ angular.module('myApp.directives', ['myApp.filters']) $scope.$on('ui_peer_change', composer.resetTyping.bind(composer)); $scope.$on('ui_peer_draft', function () { + var isBroadcast = $scope.draftMessage.isBroadcast; + composer.setPlaceholder(_(isBroadcast ? 'im_broadcast_field_placeholder_raw' : 'im_message_field_placeholder_raw')); + if (richTextarea) { composer.setValue($scope.draftMessage.text || ''); updateHeight(); diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 98fccd05..582d6afb 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -442,6 +442,7 @@ "im_reply_loading": "Loading{dots}", "im_photos_drop_text": "Drop photos here to send", "im_message_field_placeholder": "Write a message...", + "im_broadcast_field_placeholder": "Broadcast a message...", "im_media_attach_title": "Send media", "im_attach_file_title": "Send file", "im_emoji_btn_title": "Insert emoticon", diff --git a/app/js/message_composer.js b/app/js/message_composer.js index 33993658..e4ee73f1 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -1174,6 +1174,11 @@ MessageComposer.prototype.resetTyping = function () { this.lastLength = 0; } +MessageComposer.prototype.setPlaceholder = function (newPlaceholder) { + (this.richTextareaEl || this.textareaEl).attr('placeholder', newPlaceholder); +} + + function Scroller(content, options) { diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index 60a0b2f3..2982af55 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -170,10 +170,10 @@
- + - +
@@ -188,7 +188,7 @@
- +
diff --git a/app/partials/mobile/im.html b/app/partials/mobile/im.html index 2cf69d32..6a0bec1a 100644 --- a/app/partials/mobile/im.html +++ b/app/partials/mobile/im.html @@ -151,7 +151,7 @@
- +