Added simple user blocking

This commit is contained in:
Igor Zhukov 2014-11-20 23:20:39 +03:00
parent 379d2c49f5
commit 19b23402f2
3 changed files with 18 additions and 0 deletions

View File

@ -1846,6 +1846,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.user = AppUsersManager.getUser($scope.userID);
$scope.userPhoto = AppUsersManager.getUserPhoto($scope.userID, 'User');
$scope.blocked = false;
$scope.settings = {notifications: true};
@ -1862,6 +1863,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
if (userFullResult.profile_photo._ != 'photoEmpty') {
$scope.userPhoto.id = userFullResult.profile_photo.id;
}
$scope.blocked = userFullResult.blocked;
NotificationsManager.savePeerSettings($scope.userID, userFullResult.notify_settings);
NotificationsManager.getPeerMuted($scope.userID).then(function (muted) {
@ -1922,6 +1924,14 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
};
$scope.toggleBlock = function (block) {
MtpApiManager.invokeApi(block ? 'contacts.block' : 'contacts.unblock', {
id: AppUsersManager.getUserInput($scope.userID)
}).then(function () {
$scope.blocked = block;
});
};
$scope.shareContact = function () {
PeersSelectService.selectPeer({confirm_type: 'SHARE_CONTACT_PEER'}).then(function (peerString) {
var peerID = AppPeersManager.getPeerID(peerString);

View File

@ -69,6 +69,8 @@
"user_modal_delete_contact": "Delete contact",
"user_modal_add_contact": "Add to contacts",
"user_modal_share_contact": "Share contact",
"user_modal_block_user": "Block user",
"user_modal_unblock_user": "Unblock user",
"user_modal_delete_chat": "Delete chat",
"user_modal_info": "Info",
"user_modal_phone": "Phone",

View File

@ -36,6 +36,12 @@
<li ng-if="user.phone.length > 0 &amp;&amp; user._ != 'userContact'">
<a ng-click="importContact()" my-i18n="user_modal_add_contact"></a>
</li>
<li ng-if="user._ != 'userSelf'">
<a ng-click="toggleBlock(!blocked)" ng-switch="blocked">
<my-i18n ng-switch-when="true" msgid="user_modal_unblock_user"></my-i18n>
<my-i18n ng-switch-default msgid="user_modal_block_user"></my-i18n>
</a>
</li>
<li ng-if="user.phone.length > 0">
<a ng-click="shareContact()" my-i18n="user_modal_share_contact"></a>
</li>