Browse Source

Fixed updateProfile

Close #1157
master
Igor Zhukov 9 years ago
parent
commit
4b9d23ce11
  1. 23
      app/js/controllers.js

23
app/js/controllers.js

@ -3748,9 +3748,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -3748,9 +3748,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
id: {_: 'inputUserSelf'}
}).then(function (userFullResult) {
AppUsersManager.saveApiUser(userFullResult.user);
AppPhotosManager.savePhoto(userFullResult.profile_photo, {
user_id: userFullResult.user.id
});
if (userFullResult.profile_photo) {
AppPhotosManager.savePhoto(userFullResult.profile_photo, {
user_id: userFullResult.user.id
});
}
});
$scope.notify = {volume: 0.5};
@ -4042,13 +4044,19 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4042,13 +4044,19 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.error = {};
MtpApiManager.getUserID().then(function (id) {
$scope.profile = AppUsersManager.getUser(id);
var user = AppUsersManager.getUser(id);
$scope.profile = {
first_name: user.first_name,
last_name: user.last_name
};
});
$scope.updateProfile = function () {
$scope.profile.updating = true;
var flags = (1 << 0) | (1 << 1);
MtpApiManager.invokeApi('account.updateProfile', {
flags: flags,
first_name: $scope.profile.first_name || '',
last_name: $scope.profile.last_name || ''
}).then(function (user) {
@ -4084,7 +4092,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4084,7 +4092,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.error = {};
MtpApiManager.getUserID().then(function (id) {
$scope.profile = angular.copy(AppUsersManager.getUser(id));
var user = AppUsersManager.getUser(id);
$scope.profile = {
username: user.username
};
});
$scope.updateUsername = function () {

Loading…
Cancel
Save