Browse Source

Implemented proper delete chat / clear history

Close #461
Close #566
Close #1069
master
Igor Zhukov 9 years ago
parent
commit
3dcd26ad81
  1. 70
      app/js/controllers.js
  2. 16
      app/js/locales/en-us.json
  3. 100
      app/js/messages_manager.js
  4. 12
      app/partials/desktop/chat_modal.html
  5. 8
      app/partials/desktop/confirm_modal.html
  6. 2
      app/partials/desktop/dialog.html
  7. 1
      app/partials/desktop/message.html
  8. 4
      app/partials/desktop/user_modal.html
  9. 8
      app/partials/mobile/chat_modal.html
  10. 2
      app/partials/mobile/dialog.html

70
app/js/controllers.js

@ -746,8 +746,26 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
} }
$scope.$on('dialog_flush', function (e, dialog) { $scope.$on('dialog_top', function (e, dialog) {
deleteDialog(dialog.peerID); var curDialog, i;
for (i = 0; i < $scope.dialogs.length; i++) {
curDialog = $scope.dialogs[i];
if (curDialog.peerID == dialog.peerID) {
var wrappedDialog = AppMessagesManager.wrapForDialog(dialog.top_message, dialog);
$scope.dialogs.splice(i, 1, wrappedDialog);
break;
}
}
});
$scope.$on('dialog_flush', function (e, update) {
var curDialog, i;
for (i = 0; i < $scope.dialogs.length; i++) {
curDialog = $scope.dialogs[i];
if (curDialog.peerID == update.peerID) {
curDialog.deleted = true;
break;
}
}
}); });
$scope.$on('dialog_drop', function (e, dialog) { $scope.$on('dialog_drop', function (e, dialog) {
deleteDialog(dialog.peerID); deleteDialog(dialog.peerID);
@ -1695,7 +1713,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function selectedFlush () { function selectedFlush () {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () {
AppMessagesManager.flushHistory($scope.curDialog.peerID).then(function () { AppMessagesManager.flushHistory($scope.curDialog.peerID, true).then(function () {
selectedCancel(); selectedCancel();
}); });
}) })
@ -2645,6 +2663,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
MtpApiManager.invokeApi('messages.setTyping', { MtpApiManager.invokeApi('messages.setTyping', {
peer: AppPeersManager.getInputPeerByID($scope.curDialog.peerID), peer: AppPeersManager.getInputPeerByID($scope.curDialog.peerID),
action: {_: 'sendMessageTypingAction'} action: {_: 'sendMessageTypingAction'}
})['catch'](function (error) {
error.handled = true;
}); });
} }
@ -3324,7 +3344,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}) })
.controller('UserModalController', function ($scope, $location, $rootScope, AppProfileManager, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) { .controller('UserModalController', function ($scope, $location, $rootScope, $modalInstance, AppProfileManager, $modal, AppUsersManager, MtpApiManager, NotificationsManager, AppPhotosManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) {
var peerString = AppUsersManager.getUserString($scope.userID); var peerString = AppUsersManager.getUserString($scope.userID);
@ -3358,10 +3378,15 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$rootScope.$broadcast('history_focus', {peerString: peerString}); $rootScope.$broadcast('history_focus', {peerString: peerString});
}; };
$scope.flushHistory = function () { $scope.flushHistory = function (justClear) {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: justClear ? 'HISTORY_FLUSH' : 'HISTORY_FLUSH_AND_DELETE'}).then(function () {
AppMessagesManager.flushHistory($scope.userID).then(function () { AppMessagesManager.flushHistory($scope.userID, justClear).then(function () {
if (justClear) {
$scope.goToHistory(); $scope.goToHistory();
} else {
$modalInstance.close();
$location.url('/im');
}
}); });
}); });
}; };
@ -3436,7 +3461,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}) })
.controller('ChatModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppProfileManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) { .controller('ChatModalController', function ($scope, $modalInstance, $location, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppProfileManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {}); $scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
$scope.settings = {notifications: true}; $scope.settings = {notifications: true};
@ -3485,20 +3510,20 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.leaveGroup = function () { $scope.leaveGroup = function () {
ErrorService.confirm({type: 'HISTORY_LEAVE_AND_FLUSH'}).then(function () {
MtpApiManager.invokeApi('messages.deleteChatUser', { MtpApiManager.invokeApi('messages.deleteChatUser', {
chat_id: AppChatsManager.getChatInput($scope.chatID), chat_id: AppChatsManager.getChatInput($scope.chatID),
user_id: {_: 'inputUserSelf'} user_id: {_: 'inputUserSelf'}
}).then(onChatUpdated); }).then(function (updates) {
}; ApiUpdatesManager.processUpdateMessage(updates);
AppMessagesManager.flushHistory(-$scope.chatID).then(function () {
$scope.returnToGroup = function () { $modalInstance.close();
MtpApiManager.invokeApi('messages.addChatUser', { $location.url('/im');
chat_id: AppChatsManager.getChatInput($scope.chatID), });
user_id: {_: 'inputUserSelf'} });
}).then(onChatUpdated); });
}; };
$scope.inviteToGroup = function () { $scope.inviteToGroup = function () {
var disabled = []; var disabled = [];
angular.forEach($scope.chatFull.participants.participants, function(participant){ angular.forEach($scope.chatFull.participants.participants, function(participant){
@ -3537,10 +3562,15 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.flushHistory = function () { $scope.flushHistory = function (justClear) {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: justClear ? 'HISTORY_FLUSH' : 'HISTORY_FLUSH_AND_DELETE'}).then(function () {
AppMessagesManager.flushHistory(-$scope.chatID).then(function () { AppMessagesManager.flushHistory(-$scope.chatID, justClear).then(function () {
if (justClear) {
$rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString}); $rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString});
} else {
$modalInstance.close();
$location.url('/im');
}
}); });
}); });
}; };

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

@ -20,7 +20,9 @@
"group_modal_menu_delete_photo": "Delete photo", "group_modal_menu_delete_photo": "Delete photo",
"group_modal_menu_edit_group": "Edit group", "group_modal_menu_edit_group": "Edit group",
"group_modal_menu_leave": "Leave", "group_modal_menu_leave": "Leave",
"group_modal_menu_delete_chat": "Delete chat", "group_modal_menu_delete_group": "Delete and exit",
"group_modal_menu_clear_history": "Clear history",
"group_modal_delete_group": "Delete group",
"group_modal_settings": "Settings", "group_modal_settings": "Settings",
"group_modal_notifications": "Notifications", "group_modal_notifications": "Notifications",
"group_modal_menu_share_link": "Invite to group via link", "group_modal_menu_share_link": "Invite to group via link",
@ -33,7 +35,6 @@
"group_modal_migrate_item2": "New members see the entire chat history", "group_modal_migrate_item2": "New members see the entire chat history",
"group_modal_migrate_item3": "Admins delete messages for everyone", "group_modal_migrate_item3": "Admins delete messages for everyone",
"group_modal_migrate_item4": "Notifications are muted by default", "group_modal_migrate_item4": "Notifications are muted by default",
"group_modal_delete_group": "Delete group",
"channel_modal_info": "Channel info", "channel_modal_info": "Channel info",
"channel_modal_description": "Description", "channel_modal_description": "Description",
@ -132,7 +133,8 @@
"user_modal_share_contact": "Share contact", "user_modal_share_contact": "Share contact",
"user_modal_block_user": "Block user", "user_modal_block_user": "Block user",
"user_modal_unblock_user": "Unblock user", "user_modal_unblock_user": "Unblock user",
"user_modal_delete_chat": "Delete chat", "user_modal_clear_history": "Clear history",
"user_modal_delete_chat": "Delete conversation",
"user_modal_add_to_group": "Add to group", "user_modal_add_to_group": "Add to group",
"user_modal_info": "Info", "user_modal_info": "Info",
"user_modal_phone": "Phone", "user_modal_phone": "Phone",
@ -213,6 +215,7 @@
"confirm_modal_logout": "Are you sure you want to log out?", "confirm_modal_logout": "Are you sure you want to log out?",
"confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?", "confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?",
"confirm_modal_history_flush": "Are you sure? This can not be undone!", "confirm_modal_history_flush": "Are you sure? This can not be undone!",
"confirm_modal_history_leave_flush_md": "Are you sure, you want to delete all message history and leave the group?\n\nThis action cannot be undone.",
"confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for this one?", "confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for this one?",
"confirm_modal_terminate_session": "Are you sure you want to log out this device?", "confirm_modal_terminate_session": "Are you sure you want to log out this device?",
"confirm_modal_clipboard_file_send": "Are you sure to send file(s) from clipboard?", "confirm_modal_clipboard_file_send": "Are you sure to send file(s) from clipboard?",
@ -249,7 +252,9 @@
"confirm_modal_are_u_sure": "Are you sure?", "confirm_modal_are_u_sure": "Are you sure?",
"confirm_modal_logout_submit": "Log out", "confirm_modal_logout_submit": "Log out",
"confirm_modal_history_flush_submit": "Delete chat", "confirm_modal_clear_history_submit": "Clear history",
"confirm_modal_leave_chat_submit": "Leave",
"confirm_modal_delete_chat_submit": "Delete chat",
"confirm_modal_clipboard_files_send_submit": "Send", "confirm_modal_clipboard_files_send_submit": "Send",
"confirm_modal_clipboard_file_send_submit": "Send", "confirm_modal_clipboard_file_send_submit": "Send",
"confirm_modal_message_delete_submit": "Delete", "confirm_modal_message_delete_submit": "Delete",
@ -289,7 +294,6 @@
"contact_import_modal_submit": "Save", "contact_import_modal_submit": "Save",
"contact_import_modal_submit_active": "Importing...", "contact_import_modal_submit_active": "Importing...",
"conversation_message_deleted": "deleted message",
"conversation_you": "You", "conversation_you": "You",
"conversation_draft": "Draft:", "conversation_draft": "Draft:",
"conversation_media_photo": "Photo", "conversation_media_photo": "Photo",
@ -419,7 +423,7 @@
"head_media_documents": "Files", "head_media_documents": "Files",
"head_media_audio": "Voice messages", "head_media_audio": "Voice messages",
"head_about": "About", "head_about": "About",
"head_clear_all": "Clear all", "head_clear_all": "Clear history",
"head_edit": "Edit", "head_edit": "Edit",
"head_typing": "typing", "head_typing": "typing",
"head_pluralize_participants": "{'0': 'No members', 'one': '1 member', 'other': '{} members'}", "head_pluralize_participants": "{'0': 'No members', 'one': '1 member', 'other': '{} members'}",

100
app/js/messages_manager.js

@ -175,7 +175,8 @@ angular.module('myApp.services')
message.pFlags.unread = true; message.pFlags.unread = true;
} }
if (historiesStorage[peerID] === undefined) { if (historiesStorage[peerID] === undefined &&
!message.deleted) {
var historyStorage = {count: null, history: [mid], pending: []}; var historyStorage = {count: null, history: [mid], pending: []};
historiesStorage[peerID] = historyStorage; historiesStorage[peerID] = historyStorage;
if (mergeReplyKeyboard(historyStorage, message)) { if (mergeReplyKeyboard(historyStorage, message)) {
@ -308,10 +309,18 @@ angular.module('myApp.services')
ApiUpdatesManager.addChannelState(-peerID, historyResult.pts); ApiUpdatesManager.addChannelState(-peerID, historyResult.pts);
} }
var length = historyResult.messages.length;
if (length &&
historyResult.messages[length - 1].deleted) {
historyResult.messages.splice(length - 1, 1);
length--;
historyResult.count--;
}
if ( if (
peerID < 0 || peerID < 0 ||
!AppUsersManager.isBot(peerID) || !AppUsersManager.isBot(peerID) ||
(historyResult.messages.length == limit && limit < historyResult.count) (length == limit && limit < historyResult.count)
) { ) {
return historyResult; return historyResult;
} }
@ -1039,8 +1048,13 @@ angular.module('myApp.services')
}); });
} }
function doFlushHistory (inputPeer) { function doFlushHistory (inputPeer, justClear) {
var flags = 0;
if (justClear) {
flags |= 1;
}
return MtpApiManager.invokeApi('messages.deleteHistory', { return MtpApiManager.invokeApi('messages.deleteHistory', {
flags: flags,
peer: inputPeer, peer: inputPeer,
max_id: 0 max_id: 0
}).then(function (affectedHistory) { }).then(function (affectedHistory) {
@ -1055,18 +1069,22 @@ angular.module('myApp.services')
if (!affectedHistory.offset) { if (!affectedHistory.offset) {
return true; return true;
} }
return doFlushHistory(inputPeer); return doFlushHistory(inputPeer, justClear);
}); });
} }
function flushHistory (peerID) { function flushHistory (peerID, justClear) {
return doFlushHistory(AppPeersManager.getInputPeerByID(peerID)).then(function () { return doFlushHistory(AppPeersManager.getInputPeerByID(peerID), justClear).then(function () {
if (justClear) {
$rootScope.$broadcast('dialog_flush', {peerID: peerID});
} else {
var foundDialog = getDialogByPeerID(peerID); var foundDialog = getDialogByPeerID(peerID);
if (foundDialog[0]) { if (foundDialog[0]) {
dialogsStorage.dialogs.splice(foundDialog[1], 1); dialogsStorage.dialogs.splice(foundDialog[1], 1);
} }
delete historiesStorage[peerID]; delete historiesStorage[peerID];
$rootScope.$broadcast('dialog_flush', {peerID: peerID}); $rootScope.$broadcast('dialog_drop', {peerID: peerID});
}
}); });
} }
@ -1120,7 +1138,8 @@ angular.module('myApp.services')
apiMessage.toID = toPeerID; apiMessage.toID = toPeerID;
apiMessage.fromID = apiMessage.pFlags.post ? toPeerID : apiMessage.from_id; apiMessage.fromID = apiMessage.pFlags.post ? toPeerID : apiMessage.from_id;
apiMessage.signID = apiMessage.pFlags.post && apiMessage.from_id || fwdHeader && fwdHeader.from_id; apiMessage.signID = apiMessage.pFlags.post && apiMessage.from_id ||
fwdHeader && fwdHeader.channel_id && fwdHeader.from_id;
if (apiMessage.via_bot_id > 0) { if (apiMessage.via_bot_id > 0) {
apiMessage.viaBotID = apiMessage.via_bot_id; apiMessage.viaBotID = apiMessage.via_bot_id;
@ -1200,6 +1219,13 @@ angular.module('myApp.services')
migrateFrom = -channelID; migrateFrom = -channelID;
migrateTo = -apiMessage.action.channel_id; migrateTo = -apiMessage.action.channel_id;
break; break;
case 'messageActionHistoryClear':
apiMessage.deleted = true;
apiMessage.clear_history = true;
apiMessage.pFlags.out = false;
apiMessage.pFlags.unread = false;
break;
} }
if (migrateFrom && if (migrateFrom &&
migrateTo && migrateTo &&
@ -2232,6 +2258,11 @@ angular.module('myApp.services')
} }
for (i = start; i < end; i++) { for (i = start; i < end; i++) {
if (history[i].deleted) {
history.splice(i, 1);
end--;
continue;
}
curMessage = history[i]; curMessage = history[i];
curDay = Math.floor((curMessage.date + ServerTimeManager.midnightOffset) / 86400); curDay = Math.floor((curMessage.date + ServerTimeManager.midnightOffset) / 86400);
@ -2731,11 +2762,22 @@ angular.module('myApp.services')
safeReplaceObject(wasForHistory, newForHistory); safeReplaceObject(wasForHistory, newForHistory);
messagesForHistory[mid] = wasForHistory; messagesForHistory[mid] = wasForHistory;
} }
if (message.clear_history) {
var foundDialog = getDialogByPeerID(peerID);
if (foundDialog[0] &&
foundDialog[0].top_message == mid) {
$rootScope.$broadcast('dialog_flush', {peerID: peerID});
} else {
$rootScope.$broadcast('history_delete', {peerID: peerID, msgs: [mid]});
}
} else {
$rootScope.$broadcast('message_edit', { $rootScope.$broadcast('message_edit', {
peerID: peerID, peerID: peerID,
id: message.id, id: message.id,
mid: mid mid: mid
}); });
}
break; break;
case 'updateReadHistoryInbox': case 'updateReadHistoryInbox':
@ -2875,15 +2917,6 @@ angular.module('myApp.services')
} }
angular.forEach(historiesUpdated, function (updatedData, peerID) { angular.forEach(historiesUpdated, function (updatedData, peerID) {
var foundDialog = getDialogByPeerID(peerID);
if (foundDialog[0]) {
if (updatedData.unread) {
foundDialog[0].unread_count -= updatedData.unread;
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: foundDialog[0].unread_count});
}
}
var historyStorage = historiesStorage[peerID]; var historyStorage = historiesStorage[peerID];
if (historyStorage !== undefined) { if (historyStorage !== undefined) {
var newHistory = [], var newHistory = [],
@ -2912,6 +2945,22 @@ angular.module('myApp.services')
$rootScope.$broadcast('history_delete', {peerID: peerID, msgs: updatedData.msgs}); $rootScope.$broadcast('history_delete', {peerID: peerID, msgs: updatedData.msgs});
} }
var foundDialog = getDialogByPeerID(peerID)[0];
if (foundDialog) {
if (updatedData.unread) {
foundDialog.unread_count -= updatedData.unread;
$rootScope.$broadcast('dialog_unread', {
peerID: peerID,
count: foundDialog.unread_count
});
}
if (updatedData.msgs[foundDialog.top_message]) {
reloadConversation(peerID);
}
}
}); });
break; break;
@ -2999,11 +3048,28 @@ angular.module('myApp.services')
saveMessages(dialogsResult.messages); saveMessages(dialogsResult.messages);
var updatedDialogs = {}; var updatedDialogs = {};
var hasUpdated = false;
angular.forEach(dialogsResult.dialogs, function (dialog) { angular.forEach(dialogsResult.dialogs, function (dialog) {
if (dialog.top_message) {
saveConversation(dialog); saveConversation(dialog);
if (getDialogByPeerID(dialog.peerID).length) {
$rootScope.$broadcast('dialog_top', dialog);
} else {
updatedDialogs[dialog.peerID] = dialog; updatedDialogs[dialog.peerID] = dialog;
hasUpdated = true;
}
} else {
var peerID = AppPeersManager.getPeerID(dialog.peer);
var foundDialog = getDialogByPeerID(peerID);
if (foundDialog.length) {
dialogsStorage.dialogs.splice(foundDialog[1], 1);
$rootScope.$broadcast('dialog_drop', {peerID: peerID});
}
}
}); });
if (hasUpdated) {
$rootScope.$broadcast('dialogs_multiupdate', updatedDialogs); $rootScope.$broadcast('dialogs_multiupdate', updatedDialogs);
}
}); });
} }

12
app/partials/desktop/chat_modal.html

@ -40,13 +40,11 @@
<div class="md_modal_sections clearfix"> <div class="md_modal_sections clearfix">
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="hasRights('invite') && chatFull.participants.participants.length < maxParticipants || chatFull.chat.pFlags.left"> <div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="hasRights('invite') && chatFull.participants.participants.length < maxParticipants">
<i class="md_modal_section_icon md_modal_section_icon_person"></i> <i class="md_modal_section_icon md_modal_section_icon_person"></i>
<div class="md_modal_section_link_wrap" ng-switch="chatFull.chat.pFlags.left"> <div class="md_modal_section_link_wrap">
<a class="md_modal_section_link" ng-click="inviteToGroup()" my-i18n="group_modal_add_member"></a>
<a ng-switch-when="true" class="md_modal_section_link" ng-click="returnToGroup()" my-i18n="group_modal_return"></a>
<a ng-switch-default class="md_modal_section_link" ng-click="inviteToGroup()" my-i18n="group_modal_add_member"></a>
</div> </div>
</div> </div>
@ -73,7 +71,7 @@
<i class="md_modal_section_icon md_modal_section_icon_more"></i> <i class="md_modal_section_icon md_modal_section_icon_more"></i>
<div class="md_modal_section_link_wrap"> <div class="md_modal_section_link_wrap">
<a class="md_modal_section_link" ng-click="flushHistory()" my-i18n="group_modal_menu_delete_chat"></a> <a class="md_modal_section_link" ng-click="flushHistory(true)" my-i18n="group_modal_menu_clear_history"></a>
</div> </div>
</div> </div>
@ -111,7 +109,7 @@
<div class="md_modal_list_peer_wrap clearfix" ng-repeat="participant in chatFull.participants.participants | orderBy:'-user.sortStatus'"> <div class="md_modal_list_peer_wrap clearfix" ng-repeat="participant in chatFull.participants.participants | orderBy:'-user.sortStatus'">
<a ng-if="participant.canLeave" ng-click="leaveGroup()" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_menu_leave"></a> <a ng-if="participant.canLeave" ng-click="leaveGroup()" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_menu_delete_group"></a>
<a ng-if="participant.canKick" ng-click="kickFromGroup(participant.user_id)" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_members_kick"></a> <a ng-if="participant.canKick" ng-click="kickFromGroup(participant.user_id)" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_members_kick"></a>
<a class="md_modal_list_peer_photo pull-left" my-peer-photolink="::participant.user_id" img-class="md_modal_list_peer_photo"></a> <a class="md_modal_list_peer_photo pull-left" my-peer-photolink="::participant.user_id" img-class="md_modal_list_peer_photo"></a>

8
app/partials/desktop/confirm_modal.html

@ -6,6 +6,8 @@
<span ng-switch-when="LOGOUT" my-i18n="confirm_modal_logout"></span> <span ng-switch-when="LOGOUT" my-i18n="confirm_modal_logout"></span>
<span ng-switch-when="WEBOGRAM_UPDATED_RELOAD" my-i18n="confirm_modal_update_reload"></span> <span ng-switch-when="WEBOGRAM_UPDATED_RELOAD" my-i18n="confirm_modal_update_reload"></span>
<span ng-switch-when="HISTORY_FLUSH" my-i18n="confirm_modal_history_flush"></span> <span ng-switch-when="HISTORY_FLUSH" my-i18n="confirm_modal_history_flush"></span>
<span ng-switch-when="HISTORY_LEAVE_AND_FLUSH" my-i18n="confirm_modal_history_leave_flush_md"></span>
<span ng-switch-when="HISTORY_FLUSH_AND_DELETE" my-i18n="confirm_modal_history_flush"></span>
<span ng-switch-when="TERMINATE_SESSIONS" my-i18n="confirm_modal_terminate_sessions"></span> <span ng-switch-when="TERMINATE_SESSIONS" my-i18n="confirm_modal_terminate_sessions"></span>
<span ng-switch-when="TERMINATE_SESSION" my-i18n="confirm_modal_terminate_session"></span> <span ng-switch-when="TERMINATE_SESSION" my-i18n="confirm_modal_terminate_session"></span>
@ -81,9 +83,11 @@
<button class="btn btn-md" ng-click="$dismiss()"> <button class="btn btn-md" ng-click="$dismiss()">
<span my-i18n="modal_cancel"></span> <span my-i18n="modal_cancel"></span>
</button> </button>
<button class="btn btn-md btn-md-primary" ng-switch="type" ng-click="$close()" ng-class="{'btn-md-danger': type == 'RESET_ACCOUNT'}" my-focused > <button class="btn btn-md btn-md-primary" ng-switch="type" ng-click="$close()" ng-class="{'btn-md-danger': type == 'RESET_ACCOUNT' || type == 'HISTORY_LEAVE_AND_FLUSH' || type == 'HISTORY_FLUSH_AND_DELETE' || type == 'HISTORY_FLUSH'}" my-focused >
<span ng-switch-when="LOGOUT" my-i18n="confirm_modal_logout_submit"></span> <span ng-switch-when="LOGOUT" my-i18n="confirm_modal_logout_submit"></span>
<span ng-switch-when="HISTORY_FLUSH" my-i18n="confirm_modal_history_flush_submit"></span> <span ng-switch-when="HISTORY_FLUSH" my-i18n="confirm_modal_clear_history_submit"></span>
<span ng-switch-when="HISTORY_LEAVE_AND_FLUSH" my-i18n="confirm_modal_leave_chat_submit"></span>
<span ng-switch-when="HISTORY_FLUSH_AND_DELETE" my-i18n="confirm_modal_delete_chat_submit"></span>
<span ng-switch-when="FILES_CLIPBOARD_PASTE" my-i18n="confirm_modal_clipboard_files_send_submit"></span> <span ng-switch-when="FILES_CLIPBOARD_PASTE" my-i18n="confirm_modal_clipboard_files_send_submit"></span>
<span ng-switch-when="FILE_CLIPBOARD_PASTE" my-i18n="confirm_modal_clipboard_file_send_submit"></span> <span ng-switch-when="FILE_CLIPBOARD_PASTE" my-i18n="confirm_modal_clipboard_file_send_submit"></span>
<span ng-switch-when="MESSAGE_DELETE" my-i18n="confirm_modal_message_delete_submit"></span> <span ng-switch-when="MESSAGE_DELETE" my-i18n="confirm_modal_message_delete_submit"></span>

2
app/partials/desktop/dialog.html

@ -38,7 +38,7 @@
</div> </div>
<div ng-switch-when="deleted" class="im_dialog_message"> <div ng-switch-when="deleted" class="im_dialog_message">
<span class="im_short_message_text" my-i18n="conversation_message_deleted"></span> <span class="im_short_message_text">&nbsp;</span>
</div> </div>
<div ng-switch-when="message" class="im_dialog_message"> <div ng-switch-when="message" class="im_dialog_message">

1
app/partials/desktop/message.html

@ -1,6 +1,5 @@
<div class="im_message_outer_wrap" ng-click="toggleMessage(historyMessage.mid, $event)"> <div class="im_message_outer_wrap" ng-click="toggleMessage(historyMessage.mid, $event)">
<div class="im_message_wrap clearfix" ng-switch="::historyMessage._ == 'messageService'"> <div class="im_message_wrap clearfix" ng-switch="::historyMessage._ == 'messageService'">
<div class="im_service_message_wrap" ng-switch-when="true" ng-switch="historyMessage.action._ == 'messageActionBotIntro'"> <div class="im_service_message_wrap" ng-switch-when="true" ng-switch="historyMessage.action._ == 'messageActionBotIntro'">

4
app/partials/desktop/user_modal.html

@ -101,6 +101,10 @@
</a> </a>
</div> </div>
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions">
<a class="md_modal_section_link" ng-click="flushHistory(true)" my-i18n="user_modal_clear_history"></a>
</div>
<div class="md_modal_section_link_wrap" ng-if="f.showMoreActions"> <div class="md_modal_section_link_wrap" ng-if="f.showMoreActions">
<a class="md_modal_section_link" ng-click="flushHistory()" my-i18n="user_modal_delete_chat"></a> <a class="md_modal_section_link" ng-click="flushHistory()" my-i18n="user_modal_delete_chat"></a>
</div> </div>

8
app/partials/mobile/chat_modal.html

@ -18,7 +18,7 @@
<a ng-click="editTitle()" my-i18n="group_modal_menu_edit_group"></a> <a ng-click="editTitle()" my-i18n="group_modal_menu_edit_group"></a>
</li> </li>
<li> <li>
<a ng-click="flushHistory()" my-i18n="group_modal_menu_delete_chat"></a> <a ng-click="flushHistory(true)" my-i18n="group_modal_menu_clear_history"></a>
</li> </li>
</ul> </ul>
</div> </div>
@ -65,10 +65,6 @@
<div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.chat.pFlags.creator"> <div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ != 'chatForbidden' && !chatFull.chat.pFlags.left && chatFull.chat.pFlags.creator">
<a class="mobile_modal_action" ng-click="inviteViaLink()" my-i18n="group_modal_menu_share_link"></a> <a class="mobile_modal_action" ng-click="inviteViaLink()" my-i18n="group_modal_menu_share_link"></a>
</div> </div>
<div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ != 'chatForbidden' &amp;&amp; chatFull.chat.pFlags.left">
<a class="mobile_modal_action" ng-click="returnToGroup()" my-i18n="group_modal_return"></a>
</div>
<div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ == 'chatForbidden'"> <div class="mobile_modal_action_wrap" ng-if="chatFull.chat._ == 'chatForbidden'">
<a class="mobile_modal_action" ng-click="flushHistory()" my-i18n="group_modal_delete_group"></a> <a class="mobile_modal_action" ng-click="flushHistory()" my-i18n="group_modal_delete_group"></a>
</div> </div>
@ -100,7 +96,7 @@
<div class="chat_modal_participant_wrap clearfix" ng-repeat="participant in chatFull.participants.participants | orderBy:'-user.sortStatus'"> <div class="chat_modal_participant_wrap clearfix" ng-repeat="participant in chatFull.participants.participants | orderBy:'-user.sortStatus'">
<a ng-if="participant.canKick" ng-click="kickFromGroup(participant.user_id)" class="chat_modal_participant_kick pull-right" my-i18n="group_modal_members_kick"></a> <a ng-if="participant.canKick" ng-click="kickFromGroup(participant.user_id)" class="chat_modal_participant_kick pull-right" my-i18n="group_modal_members_kick"></a>
<a ng-if="participant.canLeave" ng-click="leaveGroup()" class="chat_modal_participant_kick pull-right" my-i18n="group_modal_menu_leave"></a> <a ng-if="participant.canLeave" ng-click="leaveGroup()" class="chat_modal_participant_kick pull-right" my-i18n="group_modal_menu_delete_group"></a>
<a class="chat_modal_participant_photo pull-left" my-peer-photolink="participant.user_id" img-class="chat_modal_participant_photo" status="true"></a> <a class="chat_modal_participant_photo pull-left" my-peer-photolink="participant.user_id" img-class="chat_modal_participant_photo" status="true"></a>

2
app/partials/mobile/dialog.html

@ -38,7 +38,7 @@
</div> </div>
<div ng-switch-when="deleted" class="im_dialog_message"> <div ng-switch-when="deleted" class="im_dialog_message">
<span class="im_short_message_text" my-i18n="conversation_message_deleted"></span> <span class="im_short_message_text">&nbsp;</span>
</div> </div>
<div ng-switch-when="message" class="im_dialog_message"> <div ng-switch-when="message" class="im_dialog_message">

Loading…
Cancel
Save