Browse Source

Improved forwards and signature text

master
Igor Zhukov 6 years ago
parent
commit
f62ff6b161
  1. 25
      app/js/directives.js
  2. 2
      app/js/locales/en-us.json
  3. 3
      app/js/messages_manager.js
  4. 7
      app/js/services.js
  5. 3
      app/less/desktop.less
  6. 9
      app/partials/desktop/channel_modal.html
  7. 2
      app/partials/desktop/message.html
  8. 2
      app/partials/desktop/peer_select.html
  9. 9
      app/partials/mobile/channel_modal.html
  10. 2
      app/partials/mobile/message.html
  11. 2
      app/partials/mobile/peer_select.html

25
app/js/directives.js

@ -212,16 +212,14 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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('<span class="im_message_sign_link">' + html.valueOf() + '</span>')
}
function updateMessageKeyboard ($scope, element, message) {
@ -3004,7 +3002,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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']) @@ -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']) @@ -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)
}
}
})
}

2
app/js/locales/en-us.json

@ -609,7 +609,7 @@ @@ -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",

3
app/js/messages_manager.js

@ -1322,13 +1322,12 @@ angular.module('myApp.services') @@ -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

7
app/js/services.js

@ -617,7 +617,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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

3
app/less/desktop.less

@ -1109,7 +1109,8 @@ a.peer_select_modal_share_link { @@ -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;
}
}

9
app/partials/desktop/channel_modal.html

@ -21,10 +21,15 @@ @@ -21,10 +21,15 @@
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-peer-link="-chatFull.chat.id" verified="true"></div>
<div class="peer_modal_profile_description" ng-if="chatFull.participants_count > 0">
<ng-pluralize count="chatFull.participants_count"
<div class="peer_modal_profile_description" ng-if="chatFull.participants_count > 0" ng-switch="isMegagroup">
<ng-pluralize ng-switch-when="true"
count="chatFull.participants_count"
when="group_modal_pluralize_participants">
</ng-pluralize>
<ng-pluralize ng-switch-default
count="chatFull.participants_count"
when="group_modal_pluralize_subscribers">
</ng-pluralize>
</div>
</div>
</div>

2
app/partials/desktop/message.html

@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
<span class="copyonly"><span my-i18n="message_forwarded_message"></span>:&nbsp;</span>
<a class="im_message_fwd_photo pull-left" my-peer-photolink="::historyMessage.fwdFromID" img-class="im_message_fwd_photo"></a>
<div class="im_message_fwd_author_wrap">
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><a ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><span class="copyonly">&nbsp;</span><span my-i18n="message_via_bot"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></span></a><span class="copyonly">&nbsp;[</span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_from.date | dateOrTime"></span><span class="copyonly">]&nbsp;</span>
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID" post-id="historyMessage.fwdPostID"></a><a ng-if="::historyMessage.viaBotID" class="im_message_fwd_via" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><span class="copyonly">&nbsp;</span><span my-i18n="message_via_bot"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></span></a><span class="copyonly">&nbsp;[</span><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_from.date | dateOrTime"></span><span class="copyonly">]&nbsp;</span>
<span class="im_message_views_inline" ng-if="::historyMessage.views > 0">
<i class="icon-message-views"></i><span class="im_message_views_cnt" my-message-views="historyMessage.mid"></span>
</span>

2
app/partials/desktop/peer_select.html

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
<li class="im_dialog_wrap" my-dialog dialog-message="dialogMessage" ng-repeat="dialogMessage in dialogs track by dialogMessage.peerID" ng-class="{active: selectedPeers[dialogMessage.peerID] !== undefined}"></li>
</ul>
<div class="im_dialogs_contacts_wrap" ng-show="myResults.length > 0">
<h5 my-i18n="conversation_select_modal_contacts"></h5>
<h5 my-i18n="conversation_select_modal_chats_contacts"></h5>
<ul class="nav nav-pills nav-stacked">
<li class="im_dialog_wrap" ng-repeat="myResult in myResults track by myResult.id" ng-class="{active: selectedPeers[myResult.id] !== undefined}">
<a class="im_dialog" ng-click="dialogSelect(myResult.peerString)">

9
app/partials/mobile/channel_modal.html

@ -53,10 +53,15 @@ @@ -53,10 +53,15 @@
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-peer-link="-chatFull.chat.id"></h4>
<p class="mobile_user_modal_status" ng-if="chatFull.participants_count > 0">
<ng-pluralize count="chatFull.participants_count"
<p class="mobile_user_modal_status" ng-if="chatFull.participants_count > 0" ng-switch="isMegagroup">
<ng-pluralize ng-switch-when="true"
count="chatFull.participants_count"
when="group_modal_pluralize_participants">
</ng-pluralize>
<ng-pluralize ng-switch-default
count="chatFull.participants_count"
when="group_modal_pluralize_subscribers">
</ng-pluralize>
</p>
</div>

2
app/partials/mobile/message.html

@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
<div ng-if="::!!historyMessage.fwdFromID &amp;&amp; !historyMessage.media" class="im_message_fwd_header" ng-switch="!!historyMessage.viaBotID" my-i18n>
<span ng-switch-when="true" my-i18n-format="message_forwarded_via_message_mobile"></span>
<span ng-switch-default my-i18n-format="message_forwarded_message_mobile"></span>
<my-i18n-param name="from"><a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID" no-watch="true"></a></my-i18n-param>
<my-i18n-param name="from"><a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID" no-watch="true" post-id="historyMessage.fwdPostID"></a></my-i18n-param>
<my-i18n-param name="bot"><a class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></a></my-i18n-param>
</div>

2
app/partials/mobile/peer_select.html

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
<li class="im_dialog_wrap" my-dialog dialog-message="dialogMessage" ng-repeat="dialogMessage in dialogs track by dialogMessage.peerID"></li>
</ul>
<div class="im_dialogs_contacts_wrap" ng-show="myResults.length > 0">
<h5 my-i18n="conversation_select_modal_contacts"></h5>
<h5 my-i18n="conversation_select_modal_chats_contacts"></h5>
<ul class="nav nav-pills nav-stacked">
<li class="im_dialog_wrap" ng-repeat="myResult in myResults track by myResult.id" ng-class="{active: curDialog.peerID == myResult.id}">
<a class="im_dialog" ng-click="dialogSelect(myResult.peerString)">

Loading…
Cancel
Save