diff --git a/app/js/directives.js b/app/js/directives.js index 888a600f..bc56c10e 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -212,16 +212,14 @@ angular.module('myApp.directives', ['myApp.filters']) } function updateMessageSignature ($scope, element, message) { - if (!message.signID) { + var postAuthor = message.post_author || (message.fwd_from && message.fwd_from.post_author) + if (!postAuthor) { $('.im_message_sign', element).hide() return } - var scope = $scope.$new(true) - scope.signID = message.signID - messageSignCompiled(scope, function (clonedElement) { - $('.im_message_sign', element).replaceWith(clonedElement) - }) + var html = RichTextProcessor.wrapRichText(postAuthor, {noLinks: true, noLinebreaks: true}) + $('.im_message_sign', element).html('
') } function updateMessageKeyboard ($scope, element, message) { @@ -3004,7 +3002,7 @@ angular.module('myApp.directives', ['myApp.filters']) participantsCount = chat.participants_count } update() - if (!chatID) { + if (!chatID || AppChatsManager.isChannel(chatID) && participantsCount) { return } AppProfileManager.getChatFull(chatID).then(function (chatFull) { @@ -3104,7 +3102,7 @@ angular.module('myApp.directives', ['myApp.filters']) } }) - .directive('myPeerLink', function (AppChatsManager, AppUsersManager) { + .directive('myPeerLink', function ($rootScope, AppChatsManager, AppUsersManager, AppMessagesIDsManager) { return { link: link } @@ -3147,7 +3145,16 @@ angular.module('myApp.directives', ['myApp.filters']) if (peerID > 0) { AppUsersManager.openUser(peerID, override) } else { - AppChatsManager.openChat(-peerID) + var chatID = -peerID + var postID = $scope.$eval(attrs.postId) + if (postID) { + $rootScope.$broadcast('history_focus', { + peerString: AppChatsManager.getChatString(chatID), + messageID: AppMessagesIDsManager.getFullMessageID(parseInt(postID), chatID) + }) + } else { + AppChatsManager.openChat(chatID) + } } }) } diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 5ff726d8..fb917f70 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -609,7 +609,7 @@ "message_attach_unsupported": "The message is not supported on your version of Telegram Web. Update the app to view: {link}.", "conversation_select_modal_title": "Select conversation", - "conversation_select_modal_contacts": "Contacts", + "conversation_select_modal_chats_contacts": "Chats and contacts", "conversation_one_selected": "{name1}", "conversation_two_selected": "{name1} and {name2}", "conversation_many_selected": "{name1}, {name2} and {count} more", diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index c16164c8..dd359785 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -1322,13 +1322,12 @@ angular.module('myApp.services') var fwdHeader = apiMessage.fwd_from if (fwdHeader) { apiMessage.fwdFromID = fwdHeader.channel_id ? -fwdHeader.channel_id : fwdHeader.from_id + apiMessage.fwdPostID = fwdHeader.channel_post fwdHeader.date -= ServerTimeManager.serverTimeOffset } apiMessage.peerID = peerID apiMessage.fromID = apiMessage.pFlags.post ? peerID : apiMessage.from_id - apiMessage.signID = apiMessage.pFlags.post && apiMessage.from_id || - fwdHeader && fwdHeader.channel_id && fwdHeader.from_id if (apiMessage.via_bot_id > 0) { apiMessage.viaBotID = apiMessage.via_bot_id diff --git a/app/js/services.js b/app/js/services.js index c556597a..adbd7c81 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -617,7 +617,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) return } } - if (apiChat.pFlags.channel && + if (apiChat._ == 'channel' && apiChat.participants_count === undefined && result !== undefined && result.participants_count) { @@ -773,6 +773,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var chatFull = angular.copy(fullChat) var chat = getChat(id) + console.warn(chat, chatFull) + if (!chatFull.participants_count) { + chatFull.participants_count = chat.participants_count + } + if (chatFull.participants && chatFull.participants._ == 'chatParticipants') { MtpApiManager.getUserID().then(function (myID) { var isAdmin = chat.pFlags.creator || chat.pFlags.admins_enabled && chat.pFlags.admin diff --git a/app/less/desktop.less b/app/less/desktop.less index bc5ac39a..45341938 100644 --- a/app/less/desktop.less +++ b/app/less/desktop.less @@ -1109,7 +1109,8 @@ a.peer_select_modal_share_link { .im_message_fwd_author_wrap, .im_message_text, - .im_message_media { + .im_message_media, + .im_message_sign { margin-left: 52px; } } diff --git a/app/partials/desktop/channel_modal.html b/app/partials/desktop/channel_modal.html index bc86b76c..3d05bb8a 100644 --- a/app/partials/desktop/channel_modal.html +++ b/app/partials/desktop/channel_modal.html @@ -21,10 +21,15 @@