diff --git a/app/js/controllers.js b/app/js/controllers.js index 5c2cf7bf..4f456aac 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -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']) $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']) $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 () {