diff --git a/app/js/controllers.js b/app/js/controllers.js
index de436f76..ae8e79e6 100644
--- a/app/js/controllers.js
+++ b/app/js/controllers.js
@@ -1241,7 +1241,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
AppPeersManager.isChannel(peerID) &&
(channel = AppChatsManager.getChat(-peerID))) {
- var canSend = channel.pFlags.creator || channel.pFlags.editor;
+ var canSend = AppChatsManager.hasRights(-peerID, 'send');
if (!canSend) {
if (channel.pFlags.left) {
$scope.historyState.channelActions = 'join';
@@ -2217,7 +2217,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
// console.log(dT(), 'reset draft', $scope.curDialog.peer, forceDraft);
if (forceDraft) {
if (forceDraft == $scope.curDialog.peer) {
- $scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID);
+ $scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID) && !AppPeersManager.isMegagroup($scope.curDialog.peerID);
$scope.$broadcast('ui_peer_draft');
return;
} else {
@@ -2231,7 +2231,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
Storage.get('draft' + $scope.curDialog.peerID).then(function (draftText) {
// console.log('Restore draft', 'draft' + $scope.curDialog.peerID, draftText);
$scope.draftMessage.text = draftText || '';
- $scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID);
+ $scope.draftMessage.isBroadcast = AppPeersManager.isChannel($scope.curDialog.peerID) && !AppPeersManager.isMegagroup($scope.curDialog.peerID);
// console.log('send broadcast', $scope.draftMessage);
$scope.$broadcast('ui_peer_draft');
});
diff --git a/app/js/directives.js b/app/js/directives.js
index 662dbc71..4bcfa5d4 100755
--- a/app/js/directives.js
+++ b/app/js/directives.js
@@ -2519,7 +2519,7 @@ angular.module('myApp.directives', ['myApp.filters'])
})
- .directive('myUserStatus', function ($filter, AppUsersManager) {
+ .directive('myUserStatus', function ($filter, $rootScope, AppUsersManager) {
var statusFilter = $filter('userStatus'),
ind = 0,
@@ -2527,6 +2527,13 @@ angular.module('myApp.directives', ['myApp.filters'])
setInterval(updateAll, 90000);
+ $rootScope.$on('stateSynchronized', function () {
+ setTimeout(function () {
+ updateAll();
+ }, 100);
+ });
+
+
return {
link: link
};
@@ -2545,6 +2552,7 @@ angular.module('myApp.directives', ['myApp.filters'])
element
.html(statusFilter(user, attrs.botChatPrivacy))
.toggleClass('status_online', user.status && user.status._ == 'userStatusOnline' || false);
+ // console.log(dT(), 'update status', element[0], user.status && user.status, tsNow(true), element.html());
};
$scope.$watch(attrs.myUserStatus, function (newUserID) {
diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json
index 1a2c1250..6037e0b7 100644
--- a/app/js/locales/en-us.json
+++ b/app/js/locales/en-us.json
@@ -283,11 +283,13 @@
"conversation_group_photo_removed": "removed group photo",
"conversation_returned_to_group": "returned to group",
"conversation_invited_user": "invited {user}",
+ "conversation_invited_users": "{'one': 'invited {} user', 'other': 'invited {} users'}",
"conversation_left_group": "left group",
"conversation_kicked_user": "removed {user}",
"conversation_invited_user_message": "invited user",
"conversation_kicked_user_message": "removed user",
"conversation_joined_by_link": "joined group",
+ "conversation_converted_to_supergroup": "upgraded to a supergroup",
"conversation_created_channel": "Channel created",
"conversation_changed_channel_name": "Channel renamed",
"conversation_changed_channel_photo": "Channel photo updated",
@@ -304,12 +306,14 @@
"message_service_changed_group_photo": "changed group photo",
"message_service_removed_group_photo": "removed group photo",
"message_service_invited_user": "invited {user}",
+ "message_service_invited_users": "invited {user} and {num-more} more",
"message_service_returned_to_group": "returned to group",
"message_service_kicked_user": "removed {user}",
"message_service_left_group": "left group",
"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_converted_to_supergroup": "upgraded the group to a supergroup",
"message_service_created_channel": "Channel created",
"message_service_changed_channel_name": "Channel renamed to {channel-name}",
"message_service_changed_channel_photo": "Channel photo updated",
diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js
index 923b757d..9671e107 100644
--- a/app/js/messages_manager.js
+++ b/app/js/messages_manager.js
@@ -152,9 +152,9 @@ angular.module('myApp.services')
var mid = getFullMessageID(dialog.top_message, channelID);
} else {
var mid = getFullMessageID(dialog.top_important_message, channelID);
- dialog.top_message = mid;
+ dialog.unread_count = dialog.unread_important_count;
}
- dialog.unread_count = dialog.unread_important_count;
+ dialog.top_message = mid;
dialog.read_inbox_max_id = getFullMessageID(dialog.read_inbox_max_id, channelID);
var message = getMessage(dialog.top_message);
@@ -207,7 +207,6 @@ angular.module('myApp.services')
}, {
timeout: 300
}).then(function (dialogsResult) {
- console.log('dialogs result', dialogsResult);
if (!offsetDate) {
TelegramMeWebService.setAuthorized(true);
}
@@ -315,8 +314,10 @@ angular.module('myApp.services')
function requestHistory (inputPeer, maxID, limit, offset) {
var peerID = AppPeersManager.getPeerID(inputPeer);
var isChannel = AppPeersManager.isChannel(peerID);
+ var isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID);
+
var promise;
- if (isChannel) {
+ if (isChannel && !isMegagroup) {
promise = MtpApiManager.invokeApi('channels.getImportantHistory', {
channel: AppChatsManager.getChannelInput(-peerID),
offset_id: maxID ? getMessageLocalID(maxID) : 0,
@@ -1070,6 +1071,7 @@ angular.module('myApp.services')
var toPeerID = AppPeersManager.getPeerID(apiMessage.to_id);
var isChannel = apiMessage.to_id._ == 'peerChannel';
var channelID = isChannel ? -toPeerID : 0;
+ var isBroadcast = isChannel && !AppChatsManager.isMegagroup(channelID);
var mid = getFullMessageID(apiMessage.id, channelID);
apiMessage.mid = mid;
@@ -1124,19 +1126,43 @@ angular.module('myApp.services')
}
}
if (apiMessage.action) {
- if (apiMessage.action._ == 'messageActionChatEditPhoto') {
- AppPhotosManager.savePhoto(apiMessage.action.photo, mediaContext);
- if (isChannel) {
- apiMessage.action._ = 'messageActionChannelEditPhoto';
- }
- }
- else if (isChannel) {
- if (apiMessage.action._ == 'messageActionChatEditTitle') {
- apiMessage.action._ = 'messageActionChannelEditTitle';
- }
- if (apiMessage.action._ == 'messageActionChatDeletePhoto') {
- apiMessage.action._ = 'messageActionChannelDeletePhoto';
- }
+ switch (apiMessage.action._) {
+ case 'messageActionChatEditPhoto':
+ AppPhotosManager.savePhoto(apiMessage.action.photo, mediaContext);
+ if (isBroadcast) {
+ apiMessage.action._ = 'messageActionChannelEditPhoto';
+ }
+ break;
+
+ case 'messageActionChatEditTitle':
+ if (isBroadcast) {
+ apiMessage.action._ = 'messageActionChannelEditTitle';
+ }
+ break;
+
+ case 'messageActionChatDeletePhoto':
+ if (isBroadcast) {
+ apiMessage.action._ = 'messageActionChannelDeletePhoto';
+ }
+ break;
+
+ case 'messageActionChatAddUser':
+ if (apiMessage.action.users.length == 1) {
+ apiMessage.action.user_id = apiMessage.action.users[0];
+ if (apiMessage.fromID == apiMessage.action.user_id) {
+ apiMessage.action._ = 'messageActionChatReturn';
+ }
+ }
+ else if (apiMessage.action.users.length > 1) {
+ apiMessage.action._ = 'messageActionChatAddUsers';
+ }
+ break;
+
+ case 'messageActionChatDeleteUser':
+ if (apiMessage.fromID == apiMessage.action.user_id) {
+ apiMessage.action._ = 'messageActionChatLeave';
+ }
+ break;
}
}
@@ -1162,7 +1188,8 @@ angular.module('myApp.services')
pFlags = {},
replyToMsgID = options.replyToMsgID,
isChannel = AppPeersManager.isChannel(peerID),
- asChannel = isChannel ? true : false,
+ isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID),
+ asChannel = isChannel && !isMegagroup ? true : false,
entities = [],
message;
@@ -1303,7 +1330,8 @@ angular.module('myApp.services')
pFlags = {},
replyToMsgID = options.replyToMsgID,
isChannel = AppPeersManager.isChannel(peerID),
- asChannel = isChannel ? true : false,
+ isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID),
+ asChannel = isChannel && !isMegagroup ? true : false,
attachType, apiFileName, realFileName;
if (!options.isMedia) {
@@ -1489,7 +1517,8 @@ angular.module('myApp.services')
inputPeer = AppPeersManager.getInputPeerByID(peerID),
replyToMsgID = options.replyToMsgID,
isChannel = AppPeersManager.isChannel(peerID),
- asChannel = isChannel ? true : false;
+ isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID),
+ asChannel = isChannel && !isMegagroup ? true : false;
if (historyStorage === undefined) {
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []};
@@ -1622,7 +1651,8 @@ angular.module('myApp.services')
var i, mid, msgID;
var fromChannel = getMessageIDInfo(mids[0])[1];
var isChannel = AppPeersManager.isChannel(peerID);
- var asChannel = isChannel ? true : false;
+ var isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID);
+ var asChannel = isChannel && !isMegagroup ? true : false;
if (asChannel) {
flags |= 16;
diff --git a/app/js/services.js b/app/js/services.js
index 59437d3a..1a367287 100755
--- a/app/js/services.js
+++ b/app/js/services.js
@@ -442,6 +442,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
setInterval(updateUsersStatuses, 60000);
+ $rootScope.$on('stateSynchronized', updateUsersStatuses);
return {
getContacts: getContacts,
@@ -556,6 +557,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var chats = {},
usernames = {},
channelAccess = {},
+ megagroups = {},
cachedPhotoLocations = {};
function saveApiChats (apiChats) {
@@ -612,7 +614,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return false;
}
if (isChannel(id) && action == 'send') {
- if (!chat.pFlags.creator && !chat.pFlags.editor) {
+ if (!chat.pFlags.megagroup &&
+ !chat.pFlags.creator &&
+ !chat.pFlags.editor) {
return false;
}
}
@@ -627,6 +631,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
channelAccess[id] = accessHash;
}
+ function saveIsMegagroup (id) {
+ megagroups[id] = true;
+ }
+
function isChannel (id) {
var chat = chats[id];
if (chat && (chat._ == 'channel' || chat._ == 'channelForbidden') ||
@@ -637,6 +645,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
function isMegagroup (id) {
+ if (megagroups[id]) {
+ return true;
+ }
var chat = chats[id];
if (chat && chat._ == 'channel' && chat.pFlags.megagroup) {
return true;
@@ -679,7 +690,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function getChatString (id) {
var chat = getChat(id);
if (isChannel(id)) {
- return 'c' + id + '_' + chat.access_hash;
+ return (isMegagroup(id) ? 's' : 'c') + id + '_' + chat.access_hash;
}
return 'g' + id;
}
@@ -763,6 +774,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
isMegagroup: isMegagroup,
hasRights: hasRights,
saveChannelAccess: saveChannelAccess,
+ saveIsMegagroup: saveIsMegagroup,
getChatInput: getChatInput,
getChannelInput: getChannelInput,
getChatPhoto: getChatPhoto,
@@ -787,8 +799,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
access_hash: peerParams[1]
};
}
- else if (firstChar == 'c') {
+ else if (firstChar == 'c' || firstChar == 's') {
AppChatsManager.saveChannelAccess(peerParams[0], peerParams[1]);
+ if (firstChar == 's') {
+ AppChatsManager.saveIsMegagroup(peerParams[0]);
+ }
return {
_: 'inputPeerChannel',
channel_id: peerParams[0],
diff --git a/app/less/app.less b/app/less/app.less
index de1fa9ef..2c85314e 100644
--- a/app/less/app.less
+++ b/app/less/app.less
@@ -3012,6 +3012,7 @@ _:-ms-lang(x), .composer_rich_textarea:empty:focus:before {
padding: 20px 0;
font-size: 14px;
line-height: 160%;
+ word-break: break-all;
}
.confirm_phone_number {
font-weight: bold;
diff --git a/app/partials/desktop/dialog_service.html b/app/partials/desktop/dialog_service.html
index 42423772..ef702bf3 100644
--- a/app/partials/desktop/dialog_service.html
+++ b/app/partials/desktop/dialog_service.html
@@ -3,20 +3,22 @@
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
diff --git a/app/partials/desktop/message_service.html b/app/partials/desktop/message_service.html
index d98a8cd8..1cff08ca 100644
--- a/app/partials/desktop/message_service.html
+++ b/app/partials/desktop/message_service.html
@@ -6,20 +6,22 @@
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
«»
diff --git a/app/partials/mobile/message_service.html b/app/partials/mobile/message_service.html
index d98a8cd8..1cff08ca 100644
--- a/app/partials/mobile/message_service.html
+++ b/app/partials/mobile/message_service.html
@@ -6,20 +6,22 @@
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
«»