Browse Source

Updated schema

Minor channel improvements
master
Igor Zhukov 9 years ago
parent
commit
0bc85c4231
  1. 4
      app/js/controllers.js
  2. 173
      app/js/directives.js
  3. 4
      app/js/lib/config.js
  4. 120
      app/js/lib/schema.tl.txt
  5. 5
      app/js/lib/utils.js
  6. 16
      app/js/locales/README.md
  7. 3
      app/js/locales/en-us.json
  8. 234
      app/js/services.js
  9. 4
      app/partials/desktop/chat_modal.html
  10. 5
      app/partials/desktop/confirm_modal.html
  11. 2
      app/partials/desktop/contacts_modal.html
  12. 13
      app/partials/desktop/dialog.html
  13. 2
      app/partials/desktop/document_modal.html
  14. 15
      app/partials/desktop/head.html
  15. 8
      app/partials/desktop/im.html
  16. 16
      app/partials/desktop/message.html
  17. 2
      app/partials/desktop/message_attach_contact.html
  18. 14
      app/partials/desktop/message_service.html
  19. 2
      app/partials/desktop/peer_select.html
  20. 2
      app/partials/desktop/photo_modal.html
  21. 6
      app/partials/desktop/reply_message.html
  22. 2
      app/partials/desktop/settings_modal.html
  23. 2
      app/partials/desktop/user_modal.html
  24. 2
      app/partials/desktop/video_modal.html
  25. 4
      app/partials/mobile/chat_modal.html
  26. 2
      app/partials/mobile/contacts_modal.html
  27. 13
      app/partials/mobile/dialog.html
  28. 8
      app/partials/mobile/head.html
  29. 4
      app/partials/mobile/im.html
  30. 6
      app/partials/mobile/message.html
  31. 2
      app/partials/mobile/message_attach_contact.html
  32. 15
      app/partials/mobile/message_service.html
  33. 2
      app/partials/mobile/peer_select.html
  34. 2
      app/partials/mobile/photo_modal.html
  35. 2
      app/partials/mobile/settings_modal.html
  36. 2
      app/partials/mobile/video_modal.html

4
app/js/controllers.js

@ -597,9 +597,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -597,9 +597,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
if ($scope.curDialog === undefined) {
$scope.curDialog = {};
}
AppUsersManager.resolveUsername($routeParams.p.substr(1)).then(function (userID) {
AppPeersManager.resolveUsername($routeParams.p.substr(1)).then(function (peerID) {
$scope.curDialog = angular.extend({
peer: AppUsersManager.getUserString(userID)
peer: AppPeersManager.getPeerString(peerID)
}, addParams);
});
} else {

173
app/js/directives.js

@ -420,7 +420,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -420,7 +420,7 @@ angular.module('myApp.directives', ['myApp.filters'])
})
.directive('myMessageText', function(AppMessagesManager, AppUsersManager, RichTextProcessor) {
.directive('myMessageText', function(AppPeersManager, AppMessagesManager, AppUsersManager, RichTextProcessor) {
return {
link: link,
scope: {
@ -430,14 +430,12 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -430,14 +430,12 @@ angular.module('myApp.directives', ['myApp.filters'])
function updateHtml (message, element) {
var entities = message.totalEntities;
var fromUser = AppUsersManager.getUser(message.from_id);
var fromBot = fromUser.pFlags.bot && fromUser.username || false;
var fromUser = message.from_id && AppUsersManager.getUser(message.from_id);
var fromBot = fromUser && fromUser.pFlags.bot && fromUser.username || false;
var toPeerID = AppPeersManager.getPeerID(message.to_id);
var withBot = (fromBot ||
message.to_id && (
message.to_id.chat_id ||
message.to_id.user_id && AppUsersManager.isBot(message.to_id.user_id)
)
);
toPeerID < 0 ||
toPeerID > 0 && AppUsersManager.isBot(toPeerID));
var options = {
noCommands: !withBot,
@ -2457,56 +2455,6 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2457,56 +2455,6 @@ angular.module('myApp.directives', ['myApp.filters'])
})
.directive('myUserLink', function ($timeout, AppUsersManager) {
return {
link: link
};
function link($scope, element, attrs) {
var override = attrs.userOverride && $scope.$eval(attrs.userOverride) || {};
var short = attrs.short && $scope.$eval(attrs.short);
var userID;
var update = function () {
var user = AppUsersManager.getUser(userID);
var key = short ? 'rFirstName' : 'rFullName';
element.html(
(override[key] || user[key] || '').valueOf()
);
if (attrs.color && $scope.$eval(attrs.color)) {
element.addClass('user_color_' + user.num);
}
};
if (element[0].tagName == 'A') {
element.on('click', function () {
AppUsersManager.openUser(userID, override);
});
}
if (attrs.userWatch) {
$scope.$watch(attrs.myUserLink, function (newUserID) {
userID = newUserID;
update();
});
} else {
userID = $scope.$eval(attrs.myUserLink);
update();
}
if (!attrs.noWatch) {
$scope.$on('user_update', function (e, updUserID) {
if (userID == updUserID) {
update();
}
});
}
}
})
.directive('myUserStatus', function ($filter, AppUsersManager) {
var statusFilter = $filter('userStatus'),
@ -2551,46 +2499,6 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2551,46 +2499,6 @@ angular.module('myApp.directives', ['myApp.filters'])
}
})
.directive('myChatLink', function ($timeout, AppChatsManager) {
return {
link: link
};
function link($scope, element, attrs) {
var chatID;
var update = function () {
var chat = AppChatsManager.getChat(chatID);
element.html(
(chat.rTitle || '').valueOf()
)
};
if (element[0].tagName == 'A') {
element.on('click', function () {
AppChatsManager.openChat(chatID);
});
}
if (attrs.chatWatch) {
$scope.$watch(attrs.myChatLink, function (newChatID) {
chatID = newChatID;
update();
});
} else {
chatID = $scope.$eval(attrs.myChatLink);
update();
}
$scope.$on('chat_update', function (e, updChatID) {
if (chatID == updChatID) {
update();
}
});
}
})
.directive('myChatStatus', function ($rootScope, _, MtpApiManager, AppChatsManager, AppUsersManager) {
var ind = 0;
@ -2715,6 +2623,75 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -2715,6 +2623,75 @@ angular.module('myApp.directives', ['myApp.filters'])
}
})
.directive('myPeerLink', function (AppChatsManager, AppUsersManager) {
return {
link: link
};
function link($scope, element, attrs) {
var override = attrs.userOverride && $scope.$eval(attrs.userOverride) || {};
var short = attrs.short && $scope.$eval(attrs.short);
var peerID;
var update = function () {
if (element[0].className.indexOf('user_color_') != -1) {
element[0].className = element[0].className.replace(/user_color_\d+/g, '');
}
if (peerID > 0) {
var user = AppUsersManager.getUser(peerID);
var key = short ? 'rFirstName' : 'rFullName';
element.html(
(override[key] || user[key] || '').valueOf()
);
if (attrs.color && $scope.$eval(attrs.color)) {
element.addClass('user_color_' + user.num);
}
} else {
var chat = AppChatsManager.getChat(-peerID);
element.html(
(chat.rTitle || '').valueOf()
);
}
};
if (element[0].tagName == 'A') {
element.on('click', function () {
if (peerID > 0) {
AppUsersManager.openUser(peerID, override);
} else {
AppChatsManager.openChat(-peerID);
}
});
}
if (attrs.peerWatch) { // userWatch, chatWatch
$scope.$watch(attrs.myPeerLink, function (newPeerID) {
peerID = newPeerID;
update();
});
} else {
peerID = $scope.$eval(attrs.myPeerLink);
update();
}
if (!attrs.noWatch) {
$scope.$on('user_update', function (e, updUserID) {
if (peerID == updUserID) {
update();
}
});
$scope.$on('chat_update', function (e, updChatID) {
if (peerID == -updChatID) {
update();
}
});
}
}
})
.directive('myPeerPhotolink', function (AppPeersManager, AppUsersManager, AppChatsManager, MtpApiFileManager, FileManager) {
return {

4
app/js/lib/config.js

File diff suppressed because one or more lines are too long

120
app/js/lib/schema.tl.txt

@ -93,23 +93,24 @@ userStatusLastWeek#7bf09fc = UserStatus; @@ -93,23 +93,24 @@ userStatusLastWeek#7bf09fc = UserStatus;
userStatusLastMonth#77ebc742 = UserStatus;
chatEmpty#9ba2d800 id:int = Chat;
chat#6e9c9bc7 id:int title:string photo:ChatPhoto participants_count:int date:int left:Bool version:int = Chat;
chatForbidden#fb0ccc41 id:int title:string date:int = Chat;
channel#8dbb1461 flags:# id:int access_hash:long title:string photo:ChatPhoto date:int version:int = Chat;
chat#7312bc48 flags:# id:int title:string photo:ChatPhoto participants_count:int date:int version:int = Chat;
chatForbidden#7328bdb id:int title:string = Chat;
channel#678e9587 flags:# id:int access_hash:long title:string username:flags.6?string photo:ChatPhoto date:int version:int = Chat;
channelForbidden#2d85832c id:int access_hash:long title:string = Chat;
chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull;
channelFull#eb8a0d68 id:int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull;
channelFull#fab31aa3 flags:# id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull;
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
chatParticipantsForbidden#fd2bb8a chat_id:int = ChatParticipants;
chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?ChatParticipant = ChatParticipants;
chatParticipants#7841b415 chat_id:int admin_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
chatPhotoEmpty#37c1011c = ChatPhoto;
chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto;
messageEmpty#83e5de54 id:int = Message;
message#ab406723 flags:# id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> = Message;
message#5ba66c13 flags:# id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int = Message;
messageService#c06b9607 flags:# id:int from_id:flags.8?int to_id:Peer date:int action:MessageAction = Message;
messageMediaEmpty#3ded6320 = MessageMedia;
@ -240,7 +241,7 @@ updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; @@ -240,7 +241,7 @@ updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update;
updateEncryptedChatTyping#1710f156 chat_id:int = Update;
updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update;
updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update;
updateChatParticipantAdd#3a0eeb22 chat_id:int user_id:int inviter_id:int version:int = Update;
updateChatParticipantAdd#ea4b0e5c chat_id:int user_id:int inviter_id:int date:int version:int = Update;
updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update;
updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
updateUserBlocked#80ece81a user_id:int blocked:Bool = Update;
@ -250,12 +251,15 @@ updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update; @@ -250,12 +251,15 @@ updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
updateUserPhone#12b9417b user_id:int phone:string = Update;
updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update;
updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update;
updateWebPage#2cc36971 webpage:WebPage = Update;
updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update;
updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
updateChannelTooLong#60946422 channel_id:int = Update;
updateChannel#b6d45656 channel_id:int = Update;
updateChannelGroup#c36c1e3c channel_id:int group:MessageGroup = Update;
updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update;
updateReadChannelInbox#87b87b7d peer:Peer max_id:int = Update;
updateDeleteChannelMessages#11da3046 peer:Peer messages:Vector<int> pts:int pts_count:int = Update;
updateReadChannelInbox#4214f37f channel_id:int max_id:int = Update;
updateDeleteChannelMessages#c37521c9 channel_id:int messages:Vector<int> pts:int pts_count:int = Update;
updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -264,8 +268,8 @@ updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Ve @@ -264,8 +268,8 @@ updates.difference#f49ca0 new_messages:Vector<Message> new_encrypted_messages:Ve
updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_messages:Vector<EncryptedMessage> other_updates:Vector<Update> chats:Vector<Chat> users:Vector<User> intermediate_state:updates.State = updates.Difference;
updatesTooLong#e317af7e = Updates;
updateShortMessage#3f32d858 flags:# id:int user_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
updateShortChatMessage#f9409b3d flags:# id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
updateShortMessage#f7d91a46 flags:# id:int user_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
updateShortChatMessage#cac7fdd2 flags:# id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from_id:flags.2?Peer fwd_date:flags.2?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
updateShort#78d4dec1 update:Update date:int = Updates;
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
@ -344,9 +348,7 @@ sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; @@ -344,9 +348,7 @@ sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
sendMessageChooseContactAction#628cbc6f = SendMessageAction;
contactFound#ea879f95 user_id:int = ContactFound;
contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contacts.Found;
contacts.found#1aa1f784 results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found;
inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey;
@ -419,7 +421,7 @@ chatInviteEmpty#69df3769 = ExportedChatInvite; @@ -419,7 +421,7 @@ chatInviteEmpty#69df3769 = ExportedChatInvite;
chatInviteExported#fc2e05bc link:string = ExportedChatInvite;
chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
chatInvite#ce917dcd title:string = ChatInvite;
chatInvite#93e99b60 flags:# title:string = ChatInvite;
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
@ -457,9 +459,10 @@ messageEntityCode#28a20571 offset:int length:int = MessageEntity; @@ -457,9 +459,10 @@ messageEntityCode#28a20571 offset:int length:int = MessageEntity;
messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity;
messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity;
inputChatEmpty#d9ff343c = InputChat;
inputChat#43a5b9c3 chat_id:int = InputChat;
inputChannel#30c6ce73 channel_id:int access_hash:long = InputChat;
inputChannelEmpty#ee8c1e86 = InputChannel;
inputChannel#afeb712e channel_id:int access_hash:long = InputChannel;
contacts.resolvedPeer#7f077ad9 peer:Peer chats:Vector<Chat> users:Vector<User> = contacts.ResolvedPeer;
messageRange#ae30253 min_id:int max_id:int = MessageRange;
@ -471,6 +474,26 @@ updates.channelDifference#2064674e flags:# pts:int timeout:flags.1?int new_messa @@ -471,6 +474,26 @@ updates.channelDifference#2064674e flags:# pts:int timeout:flags.1?int new_messa
channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter;
channelMessagesFilter#cd77d957 flags:# ranges:Vector<MessageRange> = ChannelMessagesFilter;
channelMessagesFilterCollapsed#fa01232e = ChannelMessagesFilter;
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
channelParticipantModerator#91057fef user_id:int inviter_id:int date:int = ChannelParticipant;
channelParticipantEditor#98192d61 user_id:int inviter_id:int date:int = ChannelParticipant;
channelParticipantKicked#8cc5e69a user_id:int kicked_by:int date:int = ChannelParticipant;
channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant;
channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
channelParticipantsAdmins#b4608969 = ChannelParticipantsFilter;
channelParticipantsKicked#3c37bb7a = ChannelParticipantsFilter;
channelRoleEmpty#b285a0c6 = ChannelParticipantRole;
channelRoleModerator#9618d975 = ChannelParticipantRole;
channelRoleEditor#820bfe8c = ChannelParticipantRole;
channels.channelParticipants#f56ee2a8 count:int participants:Vector<ChannelParticipant> users:Vector<User> = channels.ChannelParticipants;
channels.channelParticipant#d0d9b163 participant:ChannelParticipant users:Vector<User> = channels.ChannelParticipant;
---functions---
@ -536,12 +559,12 @@ contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; @@ -536,12 +559,12 @@ contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
contacts.exportCard#84e53737 = Vector<int>;
contacts.importCard#4fe196fe export_card:Vector<int> = User;
contacts.search#11f812d8 q:string limit:int = contacts.Found;
contacts.resolveUsername#bf0131c username:string = User;
contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer;
messages.getMessages#4222fa74 id:Vector<int> = messages.Messages;
messages.getDialogs#859b3d3c offset:int limit:int = messages.Dialogs;
messages.getHistory#e1ded325 peer:InputPeer offset:int max_id:int min_id:int limit:int = messages.Messages;
messages.search#7e9f2ab peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
messages.getHistory#8a8ec2da peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory;
messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory;
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
@ -549,13 +572,14 @@ messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>; @@ -549,13 +572,14 @@ messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
messages.sendMessage#fa88427a flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates;
messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates;
messages.forwardMessages#55e1728d peer:InputPeer id:Vector<int> random_id:Vector<long> = Updates;
messages.getChats#27ae65b id:Vector<InputChat> = messages.Chats;
messages.getFullChat#36a4dfe chat_id:InputChat = messages.ChatFull;
messages.editChatTitle#6699d506 chat_id:InputChat title:string = Updates;
messages.editChatPhoto#dd75758d chat_id:InputChat photo:InputChatPhoto = Updates;
messages.addChatUser#819183f4 chat_id:InputChat user_id:InputUser fwd_limit:int = Updates;
messages.deleteChatUser#9392c06f chat_id:InputChat user_id:InputUser = Updates;
messages.forwardMessages#708e0195 flags:# from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer = Updates;
messages.reportSpam#cf1592db peer:InputPeer = Bool;
messages.getChats#3c6aa187 id:Vector<int> = messages.Chats;
messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull;
messages.editChatTitle#dc452855 chat_id:int title:string = Updates;
messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates;
messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates;
messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates;
messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates;
messages.sendBroadcast#bf73f4da contacts:Vector<InputUser> random_id:Vector<long> message:string media:InputMedia = Updates;
@ -573,22 +597,18 @@ messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages @@ -573,22 +597,18 @@ messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages
messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers;
messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers;
messages.getWebPagePreview#25223e24 message:string = MessageMedia;
messages.exportChatInvite#c26902ba chat_id:InputChat = ExportedChatInvite;
messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
messages.importChatInvite#6c50051c hash:string = Updates;
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool;
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
messages.startBot#f4cc052d bot:InputUser chat_id:InputChat random_id:long start_param:string = Updates;
messages.getChannelDialogs#92689583 offset:int limit:int = messages.Dialogs;
messages.getImportantHistory#25b7f3b2 peer:InputPeer max_id:int min_id:int limit:int = messages.Messages;
messages.readChannelHistory#36a1210e peer:InputPeer max_id:int = Bool;
messages.createChannel#d9bc5fd2 title:string = Updates;
messages.deleteChannelMessages#9995a84f peer:InputPeer id:Vector<int> = messages.AffectedMessages;
messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates;
messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector<int> increment:Bool = Vector<int>;
updates.getState#edd4882a = updates.State;
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;
updates.getChannelDifference#248af4f5 peer:InputPeer filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
updates.getChannelDifference#bb32d7c0 channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference;
photos.updateProfilePhoto#eef579a0 id:InputPhoto crop:InputPhotoCrop = UserProfilePhoto;
photos.uploadProfilePhoto#d50f9c88 file:InputFile caption:string geo_point:InputGeoPoint crop:InputPhotoCrop = photos.Photo;
@ -606,3 +626,29 @@ help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool; @@ -606,3 +626,29 @@ help.saveAppLog#6f02f748 events:Vector<InputAppEvent> = Bool;
help.getInviteText#a4a95186 lang_code:string = help.InviteText;
help.getSupport#9cdf08cd = help.Support;
help.getAppChangelog#5bab7fb2 device_model:string system_version:string app_version:string lang_code:string = help.AppChangelog;
channels.getDialogs#a9d3d249 offset:int limit:int = messages.Dialogs;
channels.getImportantHistory#ddb929cb channel:InputChannel offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
channels.deleteUserHistory#d10dd71b channel:InputChannel user_id:InputUser = messages.AffectedHistory;
channels.reportSpam#fe087810 channel:InputChannel user_id:InputUser id:Vector<int> = Bool;
channels.getMessages#93d7b347 channel:InputChannel id:Vector<int> = messages.Messages;
channels.getParticipants#24d98f92 channel:InputChannel filter:ChannelParticipantsFilter offset:int limit:int = channels.ChannelParticipants;
channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channels.ChannelParticipant;
channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
channels.createChannel#5521d844 flags:# title:string about:string users:Vector<InputUser> = Updates;
channels.editAbout#13e27f1e channel:InputChannel about:string = Bool;
channels.editAdmin#52b16962 channel:InputChannel user_id:InputUser role:ChannelParticipantRole = Bool;
channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
channels.toggleComments#aaa29e88 channel:InputChannel enabled:Bool = Updates;
channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
channels.updateUsername#3514b3de channel:InputChannel username:string = Bool;
channels.joinChannel#24b524c5 channel:InputChannel = Updates;
channels.leaveChannel#f836aa95 channel:InputChannel = Updates;
channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
channels.kickFromChannel#a672de14 channel:InputChannel user_id:InputUser kicked:Bool = Updates;
channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite;
channels.deleteChannel#c0111fe3 channel:InputChannel = Updates;

5
app/js/lib/utils.js

@ -420,6 +420,10 @@ function versionCompare (ver1, ver2) { @@ -420,6 +420,10 @@ function versionCompare (ver1, ver2) {
return text;
}
function cleanUsername (username) {
return username && username.toLowerCase() || '';
}
function indexObject (id, searchText, searchIndex) {
if (searchIndex.fullTexts[id] !== undefined) {
return false;
@ -493,6 +497,7 @@ function versionCompare (ver1, ver2) { @@ -493,6 +497,7 @@ function versionCompare (ver1, ver2) {
createIndex: createIndex,
indexObject: indexObject,
cleanSearchText: cleanSearchText,
cleanUsername: cleanUsername,
search: search
};

16
app/js/locales/README.md

@ -182,7 +182,7 @@ Finally, if there is no message key passed to the `my-i18n` directive it looks f @@ -182,7 +182,7 @@ Finally, if there is no message key passed to the `my-i18n` directive it looks f
```html
<div class="im_history_typing" my-i18n>
<span ng-switch-when="1" my-i18n-format="im_one_typing"></span>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</div>
```
@ -198,8 +198,8 @@ This way it is even possible to group together several formats which take (mostl @@ -198,8 +198,8 @@ This way it is even possible to group together several formats which take (mostl
<span ng-switch-when="1" my-i18n-format="im_one_typing"></span>
<span ng-switch-when="2" my-i18n-format="im_two_typing"></span>
<span ng-switch-default my-i18n-format="im_many_typing"></span>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name2"><a class="im_history_typing_author" my-user-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name2"><a class="im_history_typing_author" my-peer-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="count">{{historyState.typing.length - 2}}</my-i18n-param>
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</div>
@ -208,20 +208,20 @@ will evaluate to (whitespace added for readability): @@ -208,20 +208,20 @@ will evaluate to (whitespace added for readability):
<div class="im_history_typing" my-i18n>
<span ng-switch-when="1" my-i18n-format="im_one_typing">
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>
is typing
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</span>
<span ng-switch-when="2" my-i18n-format="im_two_typing">
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>
and
<my-i18n-param name="name2"><a class="im_history_typing_author" my-user-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="name2"><a class="im_history_typing_author" my-peer-link="historyState.typing[1]"></a></my-i18n-param>
are typing
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</span>
<span ng-switch-default my-i18n-format="im_many_typing">
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>,
<my-i18n-param name="name2"><a class="im_history_typing_author" my-user-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>,
<my-i18n-param name="name2"><a class="im_history_typing_author" my-peer-link="historyState.typing[1]"></a></my-i18n-param>
and
<my-i18n-param name="count">{{historyState.typing.length - 2}}</my-i18n-param>
more are typing

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

@ -284,6 +284,9 @@ @@ -284,6 +284,9 @@
"message_service_joined_by_link": "joined group via invite link",
"message_service_unsupported_action": "unsupported action {action}",
"message_service_bot_intro_header": "What can this bot do?",
"message_service_created_channel": "Channel {channel-name} created",
"message_service_changed_channel_photo": "Channel photo updated",
"message_service_removed_channel_photo": "Channel photo removed",
"message_action_reply": "Reply",
"message_action_delete": "Delete",

234
app/js/services.js

@ -78,21 +78,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -78,21 +78,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
});
};
function userNameClean (username) {
return username && username.toLowerCase() || '';
}
function resolveUsername (username) {
var searchUserName = userNameClean(username);
var foundUserID = usernames[searchUserName];
if (foundUserID &&
userNameClean(users[foundUserID].username) == searchUserName) {
return qSync.when(foundUserID);
}
return MtpApiManager.invokeApi('contacts.resolveUsername', {username: username}).then(function (resolveResult) {
saveApiUser(resolveResult);
return resolveResult.id;
});
return usernames[username] || 0;
}
function saveApiUsers (apiUsers) {
@ -122,7 +109,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -122,7 +109,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
if (apiUser.username) {
usernames[userNameClean(apiUser.username)] = userID;
var searchUsername = SearchIndexManager.cleanUsername(apiUser.username);
usernames[searchUsername] = userID;
}
apiUser.sortName = SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
@ -562,6 +550,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -562,6 +550,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
.service('AppChatsManager', function ($q, $rootScope, $modal, _, MtpApiFileManager, MtpApiManager, AppUsersManager, AppPhotosManager, RichTextProcessor) {
var chats = {},
usernames = {},
chatsFull = {},
chatFullPromises = {},
cachedPhotoLocations = {};
@ -583,6 +572,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -583,6 +572,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiChat.num = (Math.abs(apiChat.id >> 1) % (Config.Mobile ? 4 : 8)) + 1;
if (apiChat.username) {
var searchUsername = SearchIndexManager.cleanUsername(apiChat.username);
usernames[searchUsername] = apiChat.id;
}
if (chats[apiChat.id] === undefined) {
chats[apiChat.id] = apiChat;
} else {
@ -599,23 +593,28 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -599,23 +593,28 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return chats[id] || {id: id, deleted: true};
}
function resolveUsername (username) {
return usernames[username] || 0;
}
function isChannel (id) {
return (chats[id] || {})._ == 'channel';
}
function getChatInput (id) {
return id || 0;
}
function getChannelInput (id) {
if (!id) {
return {_: 'inputChatEmpty'};
return {_: 'inputChannelEmpty'};
}
if (isChannel(id)) {
return {
_: 'inputChannel',
channel_id: id,
access_hash: getChat(id).access_hash || 0
}
}
return {_: 'inputChat', chat_id: id};
}
function getChatFull(id) {
if (chatsFull[id] !== undefined) {
@ -781,19 +780,23 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -781,19 +780,23 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
getChat: getChat,
isChannel: isChannel,
getChatInput: getChatInput,
getChannelInput: getChannelInput,
getChatFull: getChatFull,
getChatPhoto: getChatPhoto,
getChatString: getChatString,
getChatInviteLink: getChatInviteLink,
resolveUsername: resolveUsername,
hasChat: hasChat,
wrapForFull: wrapForFull,
openChat: openChat
}
})
.service('AppPeersManager', function (AppUsersManager, AppChatsManager, MtpApiManager) {
return {
getInputPeer: function (peerString) {
.service('AppPeersManager', function (qSync, AppUsersManager, AppChatsManager, MtpApiManager) {
var usernames = {};
function getInputPeer (peerString) {
var firstChar = peerString.charAt(0),
peerParams = peerString.substr(1).split('_');
@ -817,30 +820,32 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -817,30 +820,32 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
chat_id: peerParams[0]
}
}
},
getInputPeerByID: function (peerID) {
if (peerID > 0) {
return {
_: 'inputPeerUser',
user_id: peerID,
access_hash: AppUsersManager.getUser(peerID).access_hash || 0
};
} else if (peerID < 0) {
}
function getInputPeerByID (peerID) {
if (peerID < 0) {
var chatID = -peerID;
if (!AppChatsManager.isChannel(chatID)) {
return {
_: 'inputPeerChat',
chat_id: chatID
};
}
} else {
return {
_: 'inputPeerChannel',
channel_id: chatID,
access_hash: AppChatsManager.getChat(chatID).access_hash || 0
}
}
},
getPeerSearchText: function (peerID) {
}
return {
_: 'inputPeerUser',
user_id: peerID,
access_hash: AppUsersManager.getUser(peerID).access_hash || 0
};
}
function getPeerSearchText (peerID) {
var text;
if (peerID > 0) {
text = '%pu ' + AppUsersManager.getUserSearchText(peerID);
@ -849,14 +854,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -849,14 +854,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
text = '%pg ' + (chat.title || '');
}
return text;
},
getPeerString: function (peerID) {
}
function getPeerString (peerID) {
if (peerID > 0) {
return AppUsersManager.getUserString(peerID);
}
return AppChatsManager.getChatString(-peerID);
},
getOutputPeer: function (peerID) {
}
function getOutputPeer (peerID) {
if (peerID > 0) {
return {_: 'peerUser', user_id: peerID};
}
@ -865,28 +872,66 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -865,28 +872,66 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return {_: 'peerChannel', channel_id: chatID}
}
return {_: 'peerChat', chat_id: chatID}
},
getPeerID: function (peerString) {
}
function resolveUsername (username) {
var searchUserName = SearchIndexManager.cleanUsername(username);
var foundUserID, foundChatID, foundPeerID, foundUsername;
if (foundUserID == AppUsersManager.resolveUsername(searchUserName)) {
foundUsername = AppUsersManager.getUser(foundUserID).username;
if (SearchIndexManager.cleanUsername(foundUsername) == searchUserName) {
return qSync.when(foundUserID);
}
}
if (foundChatID == AppChatsManager.resolveUsername(searchUserName)) {
foundUsername = AppChatsManager.getChat(foundChatID).username;
if (SearchIndexManager.cleanUsername(foundUsername) == searchUserName) {
return qSync.when(-foundChatID);
}
}
return MtpApiManager.invokeApi('contacts.resolveUsername', {username: username}).then(function (resolveResult) {
AppUsersManager.saveApiUsers(resolveResult.users);
AppChatsManager.saveApiChats(resolveResult.chats);
return getPeerID(resolveResult.peer);
});
}
function getPeerID (peerString) {
if (angular.isObject(peerString)) {
return peerString.user_id
? peerString.user_id
: -peerString.chat_id;
: -(peerString.channel_id || peerString.chat_id);
}
var isUser = peerString.charAt(0) == 'u',
peerParams = peerString.substr(1).split('_');
return isUser ? peerParams[0] : -peerParams[0] || 0;
},
getPeer: function (peerID) {
}
function getPeer (peerID) {
return peerID > 0
? AppUsersManager.getUser(peerID)
: AppChatsManager.getChat(-peerID);
},
getPeerPhoto: function (peerID, userPlaceholder, chatPlaceholder) {
}
function getPeerPhoto (peerID, userPlaceholder, chatPlaceholder) {
return peerID > 0
? AppUsersManager.getUserPhoto(peerID, userPlaceholder)
: AppChatsManager.getChatPhoto(-peerID, chatPlaceholder)
}
return {
getInputPeer: getInputPeer,
getInputPeerByID: getInputPeerByID,
getPeerSearchText: getPeerSearchText,
getPeerString: getPeerString,
getOutputPeer: getOutputPeer,
getPeerID: getPeerID,
getPeer: getPeer,
getPeerPhoto: getPeerPhoto,
resolveUsername: resolveUsername,
usernames: usernames
}
})
@ -1147,9 +1192,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1147,9 +1192,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function requestHistory (inputPeer, maxID, limit, offset) {
return MtpApiManager.invokeApi('messages.getHistory', {
peer: inputPeer,
offset: offset || 0,
add_offset: offset || 0,
limit: limit || 0,
max_id: maxID || 0
offset_id: maxID || 0
}, {noErrorBox: true}).then(function (historyResult) {
AppUsersManager.saveApiUsers(historyResult.users);
AppChatsManager.saveApiChats(historyResult.chats);
@ -1503,6 +1548,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1503,6 +1548,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
return MtpApiManager.invokeApi('messages.search', {
flags: 0,
peer: inputPeer,
q: query || '',
filter: inputFilter || {_: 'inputMessagesFilterEmpty'},
@ -1699,6 +1745,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1699,6 +1745,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiMessage.date -= serverTimeOffset;
var toPeerID = AppPeersManager.getPeerID(apiMessage.to_id);
var isChannel = apiMessage.to_id._ == 'peerChannel';
apiMessage.toID = toPeerID;
apiMessage.fromID = apiMessage.from_id || toPeerID;
if (apiMessage.fwd_from_id) {
apiMessage.fwdFromID = AppPeersManager.getPeerID(apiMessage.fwd_from_id);
}
var mediaContext = {
user_id: apiMessage.from_id,
date: apiMessage.date
@ -1726,8 +1780,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1726,8 +1780,16 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
break;
}
}
if (apiMessage.action && apiMessage.action._ == 'messageActionChatEditPhoto') {
if (apiMessage.action) {
if (apiMessage.action._ == 'messageActionChatEditPhoto') {
AppPhotosManager.savePhoto(apiMessage.action.photo, mediaContext);
if (isChannel) {
apiMessage.action._ = 'messageActionChannelEditPhoto';
}
}
if (apiMessage.action._ == 'messageActionChatEditTitle' && isChannel) {
apiMessage.action._ = 'messageActionChannelEditTitle';
}
}
if (apiMessage.reply_markup) {
apiMessage.reply_markup.pFlags = {
@ -1819,7 +1881,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1819,7 +1881,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
if (entities.length) {
flags |= 8;
}
console.log(flags, entities);
// console.log(flags, entities);
MtpApiManager.invokeApi('messages.sendMessage', {
flags: flags,
peer: inputPeer,
@ -2379,8 +2441,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2379,8 +2441,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
message.media.progress = messagesStorage[msgID].media.progress;
}
var fromUser = AppUsersManager.getUser(message.from_id);
var fromBot = fromUser.pFlags.bot && fromUser.username || false;
var fromUser = message.from_id && AppUsersManager.getUser(message.from_id);
var fromBot = fromUser && fromUser.pFlags.bot && fromUser.username || false;
var withBot = (fromBot ||
message.to_id && (
message.to_id.chat_id ||
@ -2451,11 +2513,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2451,11 +2513,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
else if (message.action) {
switch (message.action._) {
case 'messageActionChatEditPhoto':
case 'messageActionChannelEditPhoto':
message.action.photo = AppPhotosManager.wrapForHistory(message.action.photo.id);
break;
case 'messageActionChatCreate':
case 'messageActionChatEditTitle':
case 'messageActionChannelCreate':
case 'messageActionChannelEditTitle':
message.action.rTitle = RichTextProcessor.wrapRichText(message.action.title, {noLinks: true, noLinebreaks: true}) || _('chat_title_deleted');
break;
@ -2568,29 +2633,29 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2568,29 +2633,29 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
}
if (curMessage.fwd_from_id &&
if (curMessage.fwdFromID &&
curMessage.media &&
curMessage.media.document &&
curMessage.media.document.sticker &&
(curMessage.from_id != (prevMessage || {}).from_id || !(prevMessage || {}).fwd_from_id)) {
delete curMessage.fwd_from_id;
(curMessage.from_id != (prevMessage || {}).from_id || !(prevMessage || {}).fwdFromID)) {
delete curMessage.fwdFromID;
curMessage._ = 'message';
}
if (prevMessage &&
curMessage.from_id == prevMessage.from_id &&
!prevMessage.fwd_from_id == !curMessage.fwd_from_id &&
!prevMessage.fwdFromID == !curMessage.fwdFromID &&
!prevMessage.action &&
!curMessage.action &&
curMessage.date < prevMessage.date + 900) {
var singleLine = curMessage.message && curMessage.message.length < 70 && curMessage.message.indexOf("\n") == -1 && !curMessage.reply_to_msg_id;
if (groupFwd && curMessage.fwd_from_id && curMessage.fwd_from_id == prevMessage.fwd_from_id) {
if (groupFwd && curMessage.fwdFromID && curMessage.fwdFromID == prevMessage.fwdFromID) {
curMessage.grouped = singleLine ? 'im_grouped_fwd_short' : 'im_grouped_fwd';
} else {
curMessage.grouped = !curMessage.fwd_from_id && singleLine ? 'im_grouped_short' : 'im_grouped';
curMessage.grouped = !curMessage.fwdFromID && singleLine ? 'im_grouped_short' : 'im_grouped';
}
if (groupFwd && curMessage.fwd_from_id) {
if (groupFwd && curMessage.fwdFromID) {
if (!prevMessage.grouped) {
prevMessage.grouped = 'im_grouped_fwd_start';
}
@ -2601,7 +2666,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2601,7 +2666,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} else if (prevMessage || !i) {
delete curMessage.grouped;
if (groupFwd && prevMessage && prevMessage.grouped && prevMessage.fwd_from_id) {
if (groupFwd && prevMessage && prevMessage.grouped && prevMessage.fwdFromID) {
prevMessage.grouped += ' im_grouped_fwd_end';
}
}
@ -2649,7 +2714,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2649,7 +2714,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var notifySettings = NotificationsManager.getNotifySettings();
if (message.fwd_from_id && options.fwd_count) {
if (message.fwdFromID && options.fwd_count) {
notificationMessage = fwdMessagesPluralize(options.fwd_count);
} else if (message.message) {
if (notifySettings.nopreview) {
@ -2924,7 +2989,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2924,7 +2989,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
notifyPeerToHandle.from_id = message.from_id;
notifyPeerToHandle.fwd_count = 0;
}
if (message.fwd_from_id) {
if (message.fwdFromID) {
notifyPeerToHandle.fwd_count++;
}
@ -3132,6 +3197,22 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3132,6 +3197,22 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
})
.service('AppChannelsManager', function () {
var AppMessagesManager = {};
function getDialogs () {
}
function setMessagesManager (messagesManager) {
AppMessagesManager = messagesManager;
}
return {
setMessagesManager: setMessagesManager
}
})
.service('AppPhotosManager', function ($modal, $window, $rootScope, MtpApiManager, MtpApiFileManager, AppUsersManager, FileManager) {
var photos = {},
windowW = $(window).width(),
@ -4473,10 +4554,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4473,10 +4554,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
if (update._ == 'updateNewMessage') {
var message = update.message;
var fwdPeerID = message.fwd_from_id ? AppPeersManager.getPeerID(message.fwd_from_id) : 0;
var toPeerID = AppPeersManager.getPeerID(message.to_id);
if (message.from_id && !AppUsersManager.hasUser(message.from_id) ||
message.fwd_from_id && !AppUsersManager.hasUser(message.fwd_from_id) ||
message.to_id.user_id && !AppUsersManager.hasUser(message.to_id.user_id) ||
message.to_id.chat_id && !AppChatsManager.hasChat(message.to_id.chat_id)) {
fwdPeerID > 0 && !AppUsersManager.hasUser(fwdPeerID) ||
fwdPeerID < 0 && !AppChatsManager.hasChat(-fwdPeerID) ||
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) ||
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID)) {
console.warn(dT(), 'Short update not enough data', message);
forceGetDifference();
return false;
@ -4820,9 +4904,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4820,9 +4904,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
rawOffset += match.index + match[0].length;
}
if (entities.length) {
console.log('parse entities', text, entities.slice());
}
// if (entities.length) {
// console.log('parse entities', text, entities.slice());
// }
return entities;
}
@ -6091,24 +6175,24 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -6091,24 +6175,24 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var matches;
if (matches = url.match(/^resolve\?domain=(.+?)(?:&(start|startgroup)=(.+))?$/)) {
AppUsersManager.resolveUsername(matches[1]).then(function (userID) {
AppPeersManager.resolveUsername(matches[1]).then(function (peerID) {
if (matches[2] == 'startgroup') {
if (peerID > 0 && AppUsersManager.isBot(peerID) && matches[2] == 'startgroup') {
PeersSelectService.selectPeer({
confirm_type: 'INVITE_TO_GROUP',
noUsers: true
}).then(function (peerString) {
var peerID = AppPeersManager.getPeerID(peerString);
var chatID = peerID < 0 ? -peerID : 0;
AppMessagesManager.startBot(userID, chatID, matches[3]).then(function () {
$rootScope.$broadcast('history_focus', {peerString: peerString});
}).then(function (toPeerString) {
var toPeerID = AppPeersManager.getPeerID(toPeerString);
var toChatID = toPeerID < 0 ? -toPeerID : 0;
AppMessagesManager.startBot(peerID, toChatID, matches[3]).then(function () {
$rootScope.$broadcast('history_focus', {toPeerString: toPeerString});
});
});
return true;
}
$rootScope.$broadcast('history_focus', {
peerString: AppUsersManager.getUserString(userID),
peerString: AppPeersManager.getPeerString(peerID),
startParam: matches[3]
});
});

4
app/partials/desktop/chat_modal.html

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<a ng-switch-default ng-click="openPhoto(chatFull.chat_photo.id, {p: -chatFull.chat.id})" class="peer_modal_photo" my-peer-photolink="::-chatFull.chat.id" img-class="peer_modal_photo" no-open="true" watch="true" ng-class="{disabled: !chatFull.chat.photo.photo_small}" ng-disabled="!chatFull.chat.photo.photo_small"></a>
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-chat-link="chatFull.chat.id"></div>
<div class="peer_modal_profile_name" my-peer-link="-chatFull.chat.id"></div>
<div class="peer_modal_profile_description" ng-if="chatFull.chat.participants_count > 0">
<ng-pluralize count="chatFull.chat.participants_count"
when="group_modal_pluralize_participants">
@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
<a class="md_modal_list_peer_photo pull-left" my-peer-photolink="::participant.user_id" img-class="md_modal_list_peer_photo"></a>
<div class="md_modal_list_peer_name">
<a class="md_modal_list_peer_name" my-user-link="participant.user_id"></a>
<a class="md_modal_list_peer_name" my-peer-link="participant.user_id"></a>
</div>
<div class="md_modal_list_peer_description" my-user-status="::participant.user_id" bot-chat-privacy="true"></div>
</div>

5
app/partials/desktop/confirm_modal.html

@ -35,10 +35,7 @@ @@ -35,10 +35,7 @@
<span ng-switch-when="EXT_SHARE_PEER" my-i18n-format="confirm_modal_share_file_peer"></span>
<span ng-switch-when="INVITE_TO_GROUP" my-i18n-format="confirm_modal_invite_peer"></span>
<my-i18n-param name="peer">
<strong ng-switch="peer_id > 0">
<span ng-switch-when="true" my-user-link="peer_id"></span>
<span ng-switch-default my-chat-link="-peer_id"></span>
</strong>
<strong my-peer-link="peer_id"></strong>
</my-i18n-param>
</my-i18n>
<div ng-switch-when="APPLY_LANG_WITH_RELOAD" my-i18n="confirm_modal_apply_lang_with_reload_md"></div>

2
app/partials/desktop/contacts_modal.html

@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
<a class="contacts_modal_contact" ng-click="contactSelect(contact.userID)">
<div class="md_modal_list_peer_photo pull-left" my-peer-photolink="::contact.userID" img-class="md_modal_list_peer_photo"></div>
<div class="md_modal_list_peer_name" my-user-link="contact.userID"></div>
<div class="md_modal_list_peer_name" my-peer-link="contact.userID"></div>
<div class="md_modal_list_peer_description" ng-switch="contact.found">
<span ng-switch-when="true" ng-bind="'@' + contact.user.username"></span>
<span ng-switch-default my-user-status="::contact.userID"></span>

13
app/partials/desktop/dialog.html

@ -17,14 +17,13 @@ @@ -17,14 +17,13 @@
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer" ng-switch="::dialogMessage.peerID > 0">
<span class="im_dialog_user" ng-switch-when="true" my-user-link="dialogMessage.peerID"></span>
<span class="im_dialog_chat" ng-switch-default my-chat-link="-dialogMessage.peerID"></span>
<div class="im_dialog_peer">
<span my-peer-link="dialogMessage.peerID"></span>
</div>
<div ng-if="dialogMessage.typing > 0" class="im_dialog_message">
<span class="im_dialog_message_service" my-i18n="im_conversation_group_typing">
<my-i18n-param name="name"><span my-user-link="dialogMessage.typing" short="true" class="im_dialog_chat_from_wrap"></span></my-i18n-param><my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
<my-i18n-param name="name"><span my-peer-link="dialogMessage.typing" short="true" class="im_dialog_chat_from_wrap"></span></my-i18n-param><my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</span>
</div>
@ -47,7 +46,7 @@ @@ -47,7 +46,7 @@
<span
ng-switch-when="false"
class="im_dialog_chat_from"
my-user-link="dialogMessage.from_id" short="true" user-watch="true"
my-peer-link="dialogMessage.from_id" short="true" peer-watch="true"
></span><span
ng-switch-when="true"
class="im_dialog_chat_from"
@ -83,14 +82,14 @@ @@ -83,14 +82,14 @@
<span ng-switch-when="messageActionChatAddUser" ng-switch="dialogMessage.from_id == dialogMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_returned_to_group"></span>
<span ng-switch-default my-i18n="conversation_invited_user">
<my-i18n-param name="user"><span my-user-link="dialogMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="dialogMessage.action.user_id"></span></my-i18n-param>
</span>
</span>
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="dialogMessage.from_id == dialogMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_left_group"></span>
<span ng-switch-default my-i18n="conversation_kicked_user">
<my-i18n-param name="user"><span my-user-link="dialogMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="dialogMessage.action.user_id"></span></my-i18n-param>
</span>
</span>

2
app/partials/desktop/document_modal.html

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
<div class="media_modal_info_wrap pull-left" ng-if="document.user_id > 0" ng-switch="messageID > 0">
<a class="media_modal_author_photo pull-left" my-peer-photolink="document.user_id" img-class="media_modal_author_photo" watch="true"></a>
<div class="media_modal_author_name">
<a class="media_modal_author" my-user-link="document.user_id" user-watch="true"></a>
<a class="media_modal_author" my-peer-link="document.user_id" peer-watch="true"></a>
</div>
<div class="media_modal_date" ng-if="document.date > 0">
<a ng-switch-when="true" class="media_modal_date" ng-click="goToMessage()" ng-bind="document.date | dateOrTime :true"></a>

15
app/partials/desktop/head.html

@ -72,14 +72,13 @@ @@ -72,14 +72,13 @@
<i class="icon icon-filter-audio"></i><span my-i18n="im_media_audio"></span>
</div>
<a class="tg_head_btn" ng-switch-default ng-switch="historyPeer.id > 0" ng-click="showPeerInfo()">
<div class="tg_head_peer_info" ng-switch-when="true">
<span class="tg_head_peer_title" my-user-link="historyPeer.id" user-watch="true" dir="auto"></span>
<span class="tg_head_peer_status" my-user-status="historyPeer.id"></span>
</div>
<div class="tg_head_peer_info" ng-switch-default>
<span class="tg_head_peer_title" my-chat-link="-historyPeer.id" chat-watch="true" dir="auto"></span>
<span class="tg_head_peer_status" my-chat-status="-historyPeer.id"></span>
<a class="tg_head_btn" ng-switch-default ng-click="showPeerInfo()">
<div class="tg_head_peer_info">
<span class="tg_head_peer_title" my-peer-link="historyPeer.id" peer-watch="true" dir="auto"></span>
<span class="tg_head_peer_status" ng-switch="historyPeer.id > 0">
<span ng-switch-when="true" my-user-status="historyPeer.id"></span>
<span ng-switch-default my-chat-status="-historyPeer.id"></span>
</span>
</div>
</a>

8
app/partials/desktop/im.html

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
<div class="im_dialog_photo pull-left" my-peer-photolink="contact.userID" img-class="im_dialog_photo" watch="true"></div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="contact.userID"></span>
<span class="im_dialog_user" my-peer-link="contact.userID"></span>
</div>
<div class="im_dialog_message">
<span class="im_dialog_message_text" my-user-status="::contact.userID"></span>
@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
<div class="im_dialog_photo pull-left" my-peer-photolink="foundUser.userID" img-class="im_dialog_photo" watch="true"></div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="foundUser.userID"></span>
<span class="im_dialog_user" my-peer-link="foundUser.userID"></span>
</div>
<div class="im_dialog_message" ng-switch="foundUser.user.username.length > 0">
<span ng-switch-when="true" class="im_dialog_message_text" ng-bind="::'@' + foundUser.user.username"></span>
@ -125,8 +125,8 @@ @@ -125,8 +125,8 @@
<span ng-switch-when="1" my-i18n-format="im_one_typing"></span>
<span ng-switch-when="2" my-i18n-format="im_two_typing"></span>
<span ng-switch-default my-i18n-format="im_many_typing"></span>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-user-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name2"><a class="im_history_typing_author" my-user-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="name1"><a class="im_history_typing_author" my-peer-link="historyState.typing[0]"></a></my-i18n-param>
<my-i18n-param name="name2"><a class="im_history_typing_author" my-peer-link="historyState.typing[1]"></a></my-i18n-param>
<my-i18n-param name="count">{{historyState.typing.length - 2}}</my-i18n-param>
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</div>

16
app/partials/desktop/message.html

@ -9,11 +9,11 @@ @@ -9,11 +9,11 @@
<div class="im_bot_intro_message" ng-bind-html="::historyMessage.action.rDescription"></div>
</div>
<div ng-switch-default class="im_service_message">
<a class="im_message_author" my-user-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<a class="im_message_author" ng-if="::historyMessage.fromID > 0" my-peer-link="historyMessage.fromID" short="historyMessage.toID > 0" color="historyMessage.toID < 0" no-watch="true"></a>
<span class="im_message_service" my-service-message></span>
</div>
<a ng-if="::historyMessage.action._ == 'messageActionChatEditPhoto'" class="im_service_message_photo_thumb" href="" ng-click="openPhoto(historyMessage.action.photo.id)">
<a ng-if="::historyMessage.action._ == 'messageActionChatEditPhoto' || historyMessage.action._ == 'messageActionChannelEditPhoto'" class="im_service_message_photo_thumb" href="" ng-click="openPhoto(historyMessage.action.photo.id)">
<img
class="im_service_message_photo_thumb"
my-load-thumb
@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
</div>
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.out ? 'im_message_out' : 'im_message_in', historyMessage.fwd_from_id > 0 ? 'im_message_fwd' : '']">
<div ng-switch-default class="im_content_message_wrap" ng-class="::[historyMessage.out ? 'im_message_out' : 'im_message_in', historyMessage.fwdFromID ? 'im_message_fwd' : '']">
<i class="icon icon-select-tick"></i>
<a class="im_message_error_btn" ng-if="::historyMessage.pending || historyMessage.error || false" ng-click="historyMessage.send()">
@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
<i ng-if="::historyMessage.unread &amp;&amp; historyMessage.out || historyMessage.pending || false" class="icon-message-status" ng-class="{'icon-message-status-unread': historyMessage.unread, 'icon-message-status-pending': historyMessage.pending}" ng-show="!historyMessage.error"></i>
<a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.from_id" img-class="im_message_from_photo"></a>
<a class="im_message_from_photo pull-left" my-peer-photolink="::historyMessage.fromID" img-class="im_message_from_photo"></a>
<div class="im_message_meta pull-right text-right">
<i class="icon-message-status-tick"></i>
@ -41,14 +41,14 @@ @@ -41,14 +41,14 @@
<div class="im_message_body" ng-class="::{im_message_body_media: historyMessage._ == 'message' &amp;&amp; historyMessage.media ? true : false}">
<a class="im_message_author" my-user-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<a class="im_message_author" my-peer-link="historyMessage.fromID" short="historyMessage.toID > 0" color="historyMessage.toID < 0" no-watch="true"></a>
<a class="im_message_reply_wrap" my-reply-message="historyMessage.reply_to_msg" ng-if="::historyMessage.reply_to_msg_id"></a>
<div ng-if="::historyMessage.fwd_from_id > 0" class="im_message_fwd_from">
<a class="im_message_fwd_photo pull-left" my-user-photolink="historyMessage.fwd_from_id" img-class="im_message_fwd_photo"></a>
<div ng-if="::historyMessage.fwdFromID || false" class="im_message_fwd_from">
<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-user-link="historyMessage.fwd_from_id" no-watch="true"></a><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span>
<a class="im_message_fwd_author" my-peer-link="historyMessage.fwdFromID"></a><span class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span>
</div>
</div>

2
app/partials/desktop/message_attach_contact.html

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<div>
<a ng-if="historyMessage.media.user_id > 0" class="im_message_contact_photo pull-left" my-peer-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo" user-override="historyMessage.media"></a>
<div class="im_message_contact_name" ng-switch="historyMessage.media.user_id > 0">
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<a ng-switch-when="true" my-peer-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<span ng-switch-default ng-bind-html="::historyMessage.media.rFullName"></span>
</div>
<div class="im_message_contact_phone" ng-bind="::historyMessage.media.phone_number | phoneNumber"></div>

14
app/partials/desktop/message_service.html

@ -6,20 +6,26 @@ @@ -6,20 +6,26 @@
</my-i18n>
<span ng-switch-when="messageActionChatEditPhoto" my-i18n="message_service_changed_group_photo"></span>
<span ng-switch-when="messageActionChatDeletePhoto" my-i18n="message_service_removed_group_photo"></span>
<span ng-switch-when="messageActionChatAddUser" ng-switch="::historyMessage.from_id != historyMessage.action.user_id">
<span ng-switch-when="messageActionChatAddUser" ng-switch="::historyMessage.fromID != historyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="message_service_invited_user">
<my-i18n-param name="user"><a my-user-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
<my-i18n-param name="user"><a my-peer-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
</span>
<span ng-switch-default my-i18n="message_service_returned_to_group"></span>
</span>
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="::historyMessage.from_id != historyMessage.action.user_id">
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="::historyMessage.fromID != historyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="message_service_kicked_user">
<my-i18n-param name="user"><a my-user-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
<my-i18n-param name="user"><a my-peer-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
</span>
<span ng-switch-default my-i18n="message_service_left_group"></span>
</span>
<span ng-switch-when="messageActionChatJoinedByLink" my-i18n="message_service_joined_by_link"></span>
<span ng-switch-when="messageActionChannelCreate" my-i18n="message_service_created_channel">
<my-i18n-param name="channel-name">&laquo;<strong ng-bind-html="::historyMessage.action.rTitle"></strong>&raquo;</my-i18n-param>
</span>
<span ng-switch-when="messageActionChannelEditPhoto" my-i18n="message_service_changed_channel_photo"></span>
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="message_service_removed_channel_photo"></span>
<span ng-switch-default my-i18n="message_service_unsupported_action">
<my-i18n-param name="action"><span ng-bind="historyMessage.action._"></span></my-i18n-param>
</span>

2
app/partials/desktop/peer_select.html

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
<div class="im_dialog_photo pull-left" my-peer-photolink="::contact.userID" img-class="im_dialog_photo"></div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="contact.userID"></span>
<span class="im_dialog_user" my-peer-link="contact.userID"></span>
</div>
<div class="im_dialog_message">
<span class="im_dialog_message_text" my-user-status="::contact.userID"></span>

2
app/partials/desktop/photo_modal.html

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
<div class="media_modal_info_wrap pull-left" ng-if="!webpageID && photo.user_id">
<a class="media_modal_author_photo pull-left" my-peer-photolink="photo.user_id" img-class="media_modal_author_photo" watch="true"></a>
<div class="media_modal_author_name">
<a class="media_modal_author" my-user-link="photo.user_id" user-watch="true"></a>
<a class="media_modal_author" my-peer-link="photo.user_id" peer-watch="true"></a>
</div>
<div class="media_modal_date" ng-if="photo.date > 0" ng-switch="messageID > 0">
<a ng-switch-when="true" class="media_modal_date" ng-click="goToMessage()" ng-bind="photo.date | dateOrTime :true"></a>

6
app/partials/desktop/reply_message.html

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
/>
</div>
<div class="im_message_reply_author" ng-switch-default>
<span my-user-link="replyMessage.from_id"></span>
<span my-peer-link="replyMessage.from_id"></span>
</div>
<div class="im_message_reply_body" ng-switch-default>
<span class="im_reply_message_media" ng-if="replyMessage.media" ng-switch="replyMessage.media._">
@ -40,14 +40,14 @@ @@ -40,14 +40,14 @@
<span ng-switch-when="messageActionChatAddUser" ng-switch="replyMessage.from_id == replyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_returned_to_group"></span>
<span ng-switch-default my-i18n="conversation_invited_user">
<my-i18n-param name="user"><span my-user-link="replyMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="replyMessage.action.user_id"></span></my-i18n-param>
</span>
</span>
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="replyMessage.from_id == replyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_left_group"></span>
<span ng-switch-default my-i18n="conversation_kicked_user">
<my-i18n-param name="user"><span my-user-link="replyMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="replyMessage.action.user_id"></span></my-i18n-param>
</span>
</span>

2
app/partials/desktop/settings_modal.html

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<a ng-switch-default ng-click="openPhoto(profile.photo.photo_id, {p: profile.id})" class="peer_modal_photo" my-peer-photolink="::profile.id" img-class="peer_modal_photo" watch="true" no-open="true" ng-class="{disabled: !profile.photo.photo_id}" ng-disabled="!profile.photo.photo_id"></a>
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-user-link="profile.id"></div>
<div class="peer_modal_profile_name" my-peer-link="profile.id"></div>
<div class="peer_modal_profile_description" my-user-status="::profile.id"></div>
</div>
</div>

2
app/partials/desktop/user_modal.html

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<a ng-click="openPhoto(user.photo.photo_id, {p: user.id})" class="peer_modal_photo" ng-class="{disabled: !user.photo.photo_id}" ng-disabled="!user.photo.photo_id" my-peer-photolink="::user.id" img-class="peer_modal_photo" no-open="true"></a>
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-user-link="user.id"></div>
<div class="peer_modal_profile_name" my-peer-link="user.id"></div>
<div class="peer_modal_profile_description" my-user-status="::user.id"></div>
</div>
</div>

2
app/partials/desktop/video_modal.html

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
<div class="media_modal_info_wrap pull-left" ng-if="video.user_id > 0" ng-switch="messageID > 0">
<a class="media_modal_author_photo pull-left" my-peer-photolink="video.user_id" img-class="media_modal_author_photo" watch="true"></a>
<div class="media_modal_author_name">
<a class="media_modal_author" my-user-link="video.user_id" user-watch="true"></a>
<a class="media_modal_author" my-peer-link="video.user_id" peer-watch="true"></a>
</div>
<div class="media_modal_date" ng-if="video.date > 0">
<a ng-switch-when="true" class="media_modal_date" ng-click="goToMessage()" ng-bind="video.date | dateOrTime :true"></a>

4
app/partials/mobile/chat_modal.html

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
</a>
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-chat-link="chatFull.chat.id"></h4>
<h4 class="mobile_user_modal_header" my-peer-link="-chatFull.chat.id"></h4>
<p class="mobile_user_modal_status" ng-if="chatFull.chat.participants_count > 0">
<ng-pluralize count="chatFull.chat.participants_count"
when="group_modal_pluralize_participants">
@ -112,7 +112,7 @@ @@ -112,7 +112,7 @@
<a class="chat_modal_participant_photo pull-left" my-user-photolink="participant.user_id" img-class="chat_modal_participant_photo" status="true"></a>
<div class="chat_modal_participant_name">
<a my-user-link="participant.user_id"></a>
<a my-peer-link="participant.user_id"></a>
</div>
<div class="chat_modal_participant_status" my-user-status="::participant.user_id" bot-chat-privacy="true"></div>
</div>

2
app/partials/mobile/contacts_modal.html

@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
<i ng-if="multiSelect" class="icon icon-contact-tick"></i>
<div class="contacts_modal_contact_photo pull-left" my-user-photolink="contact.userID" status="true" img-class="contacts_modal_contact_photo"></div>
<div class="contacts_modal_contact_name" my-user-link="contact.userID"></div>
<div class="contacts_modal_contact_name" my-peer-link="contact.userID"></div>
<div class="contacts_modal_contact_status" ng-switch="contact.found">
<span ng-switch-when="true" ng-bind="'@' + contact.user.username"></span>
<span ng-switch-default my-user-status="::contact.userID"></span>

13
app/partials/mobile/dialog.html

@ -24,14 +24,13 @@ @@ -24,14 +24,13 @@
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer" ng-switch="::dialogMessage.peerID > 0">
<span class="im_dialog_user" ng-switch-when="true" my-user-link="dialogMessage.peerID"></span>
<span class="im_dialog_chat" ng-switch-default my-chat-link="-dialogMessage.peerID"></span>
<div class="im_dialog_peer">
<span my-peer-link="dialogMessage.peerID"></span>
</div>
<div ng-if="dialogMessage.typing > 0" class="im_dialog_message">
<span class="im_dialog_message_service" my-i18n="im_conversation_group_typing">
<my-i18n-param name="name"><span my-user-link="dialogMessage.typing" short="true" class="im_dialog_chat_from_wrap"></span></my-i18n-param><my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
<my-i18n-param name="name"><span my-peer-link="dialogMessage.typing" short="true" class="im_dialog_chat_from_wrap"></span></my-i18n-param><my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</span>
</div>
@ -54,7 +53,7 @@ @@ -54,7 +53,7 @@
<span
ng-switch-when="false"
class="im_dialog_chat_from"
my-user-link="dialogMessage.from_id" short="true" user-watch="true"
my-peer-link="dialogMessage.from_id" short="true" peer-watch="true"
></span><span
ng-switch-when="true"
class="im_dialog_chat_from"
@ -90,14 +89,14 @@ @@ -90,14 +89,14 @@
<span ng-switch-when="messageActionChatAddUser" ng-switch="dialogMessage.from_id == dialogMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_returned_to_group"></span>
<span ng-switch-default my-i18n="conversation_invited_user">
<my-i18n-param name="user"><span my-user-link="dialogMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="dialogMessage.action.user_id"></span></my-i18n-param>
</span>
</span>
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="dialogMessage.from_id == dialogMessage.action.user_id">
<span ng-switch-when="true" my-i18n="conversation_left_group"></span>
<span ng-switch-default my-i18n="conversation_kicked_user">
<my-i18n-param name="user"><span my-user-link="dialogMessage.action.user_id"></span></my-i18n-param>
<my-i18n-param name="user"><span my-peer-link="dialogMessage.action.user_id"></span></my-i18n-param>
</span>
</span>
</span>

8
app/partials/mobile/head.html

@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
<a href="#/im" class="navbar-quick-profile-back">
<i class="icon icon-back"></i>
<div class="navbar-quick-back-title">
<h4 my-user-link="historyPeer.id" user-watch="true"></h4>
<h4 my-peer-link="historyPeer.id" peer-watch="true"></h4>
<small ng-switch="historyState.typing.length">
<span ng-switch-when="1" class="status_online">
<my-i18n msgid="head_typing"></my-i18n><span my-loading-dots></span>
@ -86,15 +86,15 @@ @@ -86,15 +86,15 @@
<a href="#/im" class="navbar-quick-group-back">
<i class="icon icon-back"></i>
<div class="navbar-quick-back-title">
<h4 my-chat-link="-historyPeer.id" chat-watch="true"></h4>
<h4 my-peer-link="historyPeer.id"></h4>
<small ng-switch="historyState.typing.length">
<span ng-switch-when="0" class="tg_head_peer_status" my-chat-status="-historyPeer.id"></span>
<my-i18n>
<span ng-switch-when="1" class="status_online" my-i18n-format="head_one_typing"></span>
<span ng-switch-when="2" class="status_online" my-i18n-format="head_two_typing"></span>
<span ng-switch-default class="status_online" my-i18n-format="head_many_typing"></span>
<my-i18n-param name="name1"><span my-user-link="historyState.typing[0]" short="true"></span></my-i18n-param>
<my-i18n-param name="name2"><span my-user-link="historyState.typing[1]" short="true"></span></my-i18n-param>
<my-i18n-param name="name1"><span my-peer-link="historyState.typing[0]" short="true"></span></my-i18n-param>
<my-i18n-param name="name2"><span my-peer-link="historyState.typing[1]" short="true"></span></my-i18n-param>
<my-i18n-param name="names" ng-bind="historyState.typing.length - 1"></my-i18n-param>
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
</my-i18n>

4
app/partials/mobile/im.html

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
<div class="im_dialog_photo pull-left" my-user-photolink="contact.userID" img-class="im_dialog_photo" watch="true"></div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="contact.userID"></span>
<span class="im_dialog_user" my-peer-link="contact.userID"></span>
</div>
<div class="im_dialog_message">
<span class="im_dialog_message_text" my-user-status="::contact.userID"></span>
@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
<div class="im_dialog_photo pull-left" my-user-photolink="foundUser.userID" img-class="im_dialog_photo" watch="true"></div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="foundUser.userID"></span>
<span class="im_dialog_user" my-peer-link="foundUser.userID"></span>
</div>
<div class="im_dialog_message" ng-switch="foundUser.user.username.length > 0">
<span ng-switch-when="true" class="im_dialog_message_text" ng-bind="::'@' + foundUser.user.username"></span>

6
app/partials/mobile/message.html

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<div class="im_bot_intro_message" ng-bind-html="::historyMessage.action.rDescription"></div>
</div>
<div ng-switch-default class="im_service_message">
<a class="im_message_author" my-user-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<a class="im_message_author" my-peer-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<span class="im_message_service" my-service-message></span>
</div>
@ -35,12 +35,12 @@ @@ -35,12 +35,12 @@
<div class="im_message_body" ng-class="::{im_message_body_media: !!historyMessage.media && !historyMessage.media.rCaption}">
<a class="im_message_author" my-user-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<a class="im_message_author" my-peer-link="historyMessage.from_id" short="!historyMessage.to_id.chat_id" color="historyMessage.to_id.chat_id > 0" no-watch="true"></a>
<a class="im_message_reply_wrap" my-reply-message="historyMessage.reply_to_msg" ng-if="::historyMessage.reply_to_msg_id"></a>
<div ng-if="::historyMessage.fwd_from_id > 0 &amp;&amp; !historyMessage.media" class="im_message_fwd_header" my-i18n="message_forwarded_message_mobile">
<a my-i18n-param="from" class="im_message_fwd_author" my-user-link="historyMessage.fwd_from_id" no-watch="true"></a>
<a my-i18n-param="from" class="im_message_fwd_author" my-peer-link="historyMessage.fwd_from_id" no-watch="true"></a>
<span my-i18n-param="date" class="im_message_fwd_date" ng-bind="::historyMessage.fwd_date | dateOrTime"></span>
</div>

2
app/partials/mobile/message_attach_contact.html

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<div>
<a ng-if="historyMessage.media.user_id > 0" class="im_message_contact_photo pull-left" my-user-photolink="historyMessage.media.user_id" img-class="im_message_contact_photo" user-override="historyMessage.media"></a>
<div class="im_message_contact_name" ng-switch="historyMessage.media.user_id > 0">
<a ng-switch-when="true" my-user-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<a ng-switch-when="true" my-peer-link="historyMessage.media.user_id" user-override="historyMessage.media"></a>
<span ng-switch-default ng-bind-html="::historyMessage.media.rFullName"></span>
</div>
<div class="im_message_contact_phone" ng-bind="::historyMessage.media.phone_number | phoneNumber"></div>

15
app/partials/mobile/message_service.html

@ -6,21 +6,26 @@ @@ -6,21 +6,26 @@
</my-i18n>
<span ng-switch-when="messageActionChatEditPhoto" my-i18n="message_service_changed_group_photo"></span>
<span ng-switch-when="messageActionChatDeletePhoto" my-i18n="message_service_removed_group_photo"></span>
<span ng-switch-when="messageActionChatAddUser" ng-switch="::historyMessage.from_id != historyMessage.action.user_id">
<span ng-switch-when="messageActionChatAddUser" ng-switch="::historyMessage.fromID != historyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="message_service_invited_user">
<my-i18n-param name="user"><a my-user-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
<my-i18n-param name="user"><a my-peer-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
</span>
<span ng-switch-default my-i18n="message_service_returned_to_group"></span>
</span>
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="::historyMessage.from_id != historyMessage.action.user_id">
<span ng-switch-when="messageActionChatDeleteUser" ng-switch="::historyMessage.fromID != historyMessage.action.user_id">
<span ng-switch-when="true" my-i18n="message_service_kicked_user">
<my-i18n-param name="user"><a my-user-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
<my-i18n-param name="user"><a my-peer-link="historyMessage.action.user_id" color="true"></a></my-i18n-param>
</span>
<span ng-switch-default my-i18n="message_service_left_group"></span>
</span>
<span ng-switch-when="messageActionChatJoinedByLink" my-i18n="message_service_joined_by_link"></span>
<span ng-switch-when="messageActionChannelCreate" my-i18n="message_service_created_channel">
<my-i18n-param name="channel-name">&laquo;<strong ng-bind-html="::historyMessage.action.rTitle"></strong>&raquo;</my-i18n-param>
</span>
<span ng-switch-when="messageActionChannelEditPhoto" my-i18n="message_service_changed_channel_photo"></span>
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="message_service_removed_channel_photo"></span>
<span ng-switch-default my-i18n="message_service_unsupported_action">
<my-i18n-param name="action"><span ng-bind="historyMessage.action._"></span></my-i18n-param>
</span>

2
app/partials/mobile/peer_select.html

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
</div>
<div class="im_dialog_message_wrap">
<div class="im_dialog_peer">
<span class="im_dialog_user" my-user-link="contact.userID"></span>
<span class="im_dialog_user" my-peer-link="contact.userID"></span>
</div>
<div class="im_dialog_message">
<span class="im_dialog_message_text" my-user-status="::contact.userID"></span>

2
app/partials/mobile/photo_modal.html

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
</div>
<div class="media_modal_info_wrap" ng-if="photo.user_id > 0">
<a class="media_modal_author" my-user-link="photo.user_id" user-watch="true"></a>
<a class="media_modal_author" my-peer-link="photo.user_id" peer-watch="true"></a>
<br/>
<span class="media_modal_date" ng-bind="photo.date | dateOrTime :true"></span>
</div>

2
app/partials/mobile/settings_modal.html

@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
</a>
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-user-link="profile.id"></h4>
<h4 class="mobile_user_modal_header" my-peer-link="profile.id"></h4>
<p class="mobile_user_modal_status" my-user-status="::profile.id"></p>
</div>

2
app/partials/mobile/video_modal.html

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
</div>
<div class="media_modal_info_wrap" ng-if="video.user_id > 0">
<a class="media_modal_author" my-user-link="video.user_id" user-watch="true"></a>
<a class="media_modal_author" my-peer-link="video.user_id" peer-watch="true"></a>
<br/>
<span class="media_modal_date" ng-bind="video.date | dateOrTime :true"></span>
</div>

Loading…
Cancel
Save