Browse Source

Bugfixes

master
Igor Zhukov 11 years ago
parent
commit
d946e85a47
  1. 11
      app/js/controllers.js
  2. 3
      app/js/lib/mtproto.js
  3. 6
      app/js/services.js
  4. 2
      app/partials/chat_modal.html

11
app/js/controllers.js

@ -871,10 +871,10 @@ angular.module('myApp.controllers', []) @@ -871,10 +871,10 @@ angular.module('myApp.controllers', [])
});
ContactsSelectService.selectContacts({disabled: disabled}).then(function (userIDs) {
angular.forEach(userIDs, function () {
angular.forEach(userIDs, function (userID) {
MtpApiManager.invokeApi('messages.addChatUser', {
chat_id: $scope.chatID,
user_id: {_: 'inputUserContact', user_id: userIDs},
user_id: {_: 'inputUserContact', user_id: userID},
fwd_limit: 100
}).then(function (addResult) {
AppUsersManager.saveApiUsers(addResult.users);
@ -1049,7 +1049,6 @@ angular.module('myApp.controllers', []) @@ -1049,7 +1049,6 @@ angular.module('myApp.controllers', [])
$scope.disabledContacts[$scope.disabled[i]] = true;
}
}
console.log($scope.disabled, $scope.disabledContacts);
if ($scope.selected) {
for (var i = 0; i < $scope.selected.length; i++) {
@ -1111,7 +1110,7 @@ angular.module('myApp.controllers', []) @@ -1111,7 +1110,7 @@ angular.module('myApp.controllers', [])
})
.controller('ChatCreateModalController', function ($scope, $modalInstance, $rootScope, MtpApiManager, AppChatsManager) {
.controller('ChatCreateModalController', function ($scope, $modalInstance, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, ApiUpdatesManager) {
$scope.group = {name: ''};
$scope.createGroup = function () {
@ -1126,8 +1125,6 @@ angular.module('myApp.controllers', []) @@ -1126,8 +1125,6 @@ angular.module('myApp.controllers', [])
title: $scope.group.name,
users: inputUsers
}).then(function (createdResult) {
$modalInstance.close();
AppUsersManager.saveApiUsers(createdResult.users);
AppChatsManager.saveApiChats(createdResult.chats);
@ -1139,7 +1136,7 @@ angular.module('myApp.controllers', []) @@ -1139,7 +1136,7 @@ angular.module('myApp.controllers', [])
});
}
var peerString = AppChatsManager.getChatString(message.to_id.chat_id);
var peerString = AppChatsManager.getChatString(createdResult.message.to_id.chat_id);
$rootScope.$broadcast('history_focus', {peerString: peerString});
});
};

3
app/js/lib/mtproto.js

@ -1507,6 +1507,8 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato @@ -1507,6 +1507,8 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato
offline;
$rootScope.offline = true;
$rootScope.offlineConnecting = true;
$rootScope.retryOnline = function () {
$(document.body).trigger('online');
}
@ -1802,6 +1804,7 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato @@ -1802,6 +1804,7 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato
this.offline = enabled;
$rootScope.offline = enabled;
$rootScope.offlineConnecting = false;
if (this.offline) {
$timeout.cancel(this.nextReqPromise);

6
app/js/services.js

@ -372,7 +372,7 @@ angular.module('myApp.services', []) @@ -372,7 +372,7 @@ angular.module('myApp.services', [])
participant.user = AppUsersManager.getUser(participant.user_id);
participant.userPhoto = AppUsersManager.getUserPhoto(participant.user_id, 'User');
participant.inviter = AppUsersManager.getUser(participant.inviter_id);
participant.canKick = myID == chat.admin_id || myID == participant.inviter_id;
participant.canKick = myID != participant.user_id && (myID == chat.admin_id || myID == participant.inviter_id);
});
});
}
@ -2376,13 +2376,15 @@ angular.module('myApp.services', []) @@ -2376,13 +2376,15 @@ angular.module('myApp.services', [])
if (!started) {
started = true;
$rootScope.$watch('idle.isIDLE', checkIDLE);
$rootScope.$watch('offline', checkIDLE);
}
}
function sendUpdateStatusReq(offline) {
var date = tsNow();
if (offline && !lastOnlineUpdated ||
!offline && (date - lastOnlineUpdated) < 50000) {
!offline && (date - lastOnlineUpdated) < 50000 ||
$rootScope.offline) {
return;
}
lastOnlineUpdated = offline ? 0 : date;

2
app/partials/chat_modal.html

@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
<div class="chat_modal_members_list">
<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.userID)" class="chat_modal_participant_kick pull-right">Kick</a>
<a ng-if="participant.canKick" ng-click="kickFromGroup(participant.user_id)" class="chat_modal_participant_kick pull-right">Kick</a>
<a ng-click="openUser(participant.user_id)" class="chat_modal_participant_photo pull-left">
<img
class="chat_modal_participant_photo"

Loading…
Cancel
Save