Browse Source

Fix userpic while profile not loaded

master
Igor Zhukov 5 years ago
parent
commit
718c7d22be
  1. 19
      app/js/controllers.js
  2. 2
      app/partials/desktop/settings_modal.html
  3. 2
      app/partials/desktop/user_modal.html
  4. 2
      app/partials/mobile/settings_modal.html
  5. 2
      app/partials/mobile/user_modal.html

19
app/js/controllers.js

@ -3787,7 +3787,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -3787,7 +3787,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.settings = {notifications: true}
AppProfileManager.getProfile($scope.userID, $scope.override).then(function (userFull) {
var profilePromise = AppProfileManager.getProfile($scope.userID, $scope.override)
profilePromise.then(function (userFull) {
$scope.blocked = userFull.pFlags.blocked
$scope.bot_info = userFull.bot_info
$scope.rAbout = userFull.rAbout
@ -3811,6 +3813,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -3811,6 +3813,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$rootScope.$broadcast('history_focus', {peerString: peerString})
}
$scope.openUserPic = function () {
profilePromise.then(function () {
$scope.openPhoto($scope.user.photo.photo_id, {p: $scope.userID})
})
}
$scope.flushHistory = function (justClear) {
ErrorService.confirm({type: justClear ? 'HISTORY_FLUSH' : 'HISTORY_FLUSH_AND_DELETE'}).then(function () {
AppMessagesManager.flushHistory($scope.userID, justClear).then(function () {
@ -4239,6 +4247,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4239,6 +4247,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
})
.controller('SettingsModalController', function ($rootScope, $scope, $timeout, $modal, AppUsersManager, AppChatsManager, AppPhotosManager, MtpApiManager, Storage, NotificationsManager, MtpApiFileManager, PasswordManager, ApiUpdatesManager, ChangelogNotifyService, LayoutSwitchService, WebPushApiManager, AppRuntimeManager, ErrorService, _) {
$scope.profile = {}
$scope.photo = {}
$scope.version = Config.App.version
@ -4247,7 +4256,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4247,7 +4256,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.profile = AppUsersManager.getUser(id)
})
MtpApiManager.invokeApi('users.getFullUser', {
var profilePromise = MtpApiManager.invokeApi('users.getFullUser', {
id: {_: 'inputUserSelf'}
}).then(function (userFullResult) {
AppUsersManager.saveApiUser(userFullResult.user)
@ -4268,6 +4277,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -4268,6 +4277,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
var updatePasswordTimeout = false
var stopped = false
$scope.openUserPic = function () {
profilePromise.then(function () {
$scope.openPhoto($scope.profile.photo.photo_id, {p: $scope.profile.id})
})
}
$scope.changePassword = function (options) {
options = options || {}
if (options.action == 'cancel_email') {

2
app/partials/desktop/settings_modal.html

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<div ng-switch-when="true" class="peer_modal_photo md_photo_loading loading_dots">
<i></i><i></i><i></i>
</div>
<a ng-switch-default ng-click="openPhoto(profile.photo.photo_id, {p: profile.id})" class="peer_modal_photo" my-peer-photolink="::profile.id" img-class="peer_modal_photo" watch="true" no-open="true" ng-class="{disabled: !profile.photo.photo_id}" ng-disabled="!profile.photo.photo_id"></a>
<a ng-switch-default ng-click="openUserPic()" class="peer_modal_photo" my-peer-photolink="::profile.id" img-class="peer_modal_photo" watch="true" no-open="true" ng-class="{disabled: !profile.photo.photo_id}" ng-disabled="!profile.photo.photo_id"></a>
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-peer-link="profile.id"></div>

2
app/partials/desktop/user_modal.html

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<div class="peer_modal_profile_wrap clearfix">
<div class="peer_modal_photo_wrap pull-left">
<a ng-click="openPhoto(user.photo.photo_id, {p: user.id})" class="peer_modal_photo" ng-class="{disabled: !user.photo.photo_id}" ng-disabled="!user.photo.photo_id" my-peer-photolink="::user.id" img-class="peer_modal_photo" no-open="true"></a>
<a ng-click="openUserPic()" class="peer_modal_photo" ng-class="{disabled: !user.photo.photo_id}" ng-disabled="!user.photo.photo_id" my-peer-photolink="::user.id" img-class="peer_modal_photo" no-open="true"></a>
</div>
<div class="peer_modal_profile">
<div class="peer_modal_profile_name" my-peer-link="user.id" verified="true"></div>

2
app/partials/mobile/settings_modal.html

@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
<div class="mobile_user_modal_photo_profile_wrap">
<a ng-click="openPhoto(profile.photo.photo_id, {p: profile.id})" class="mobile_user_modal_image_wrap pull-left" my-peer-photolink="::profile.id" img-class="mobile_user_modal_image" no-open="true" watch="true" ng-class="{disabled: !profile.photo.photo_id}" ng-disabled="!profile.photo.photo_id"></a>
<a ng-click="openUserPic()" class="mobile_user_modal_image_wrap pull-left" my-peer-photolink="::profile.id" img-class="mobile_user_modal_image" no-open="true" watch="true" ng-class="{disabled: !profile.photo.photo_id}" ng-disabled="!profile.photo.photo_id"></a>
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-peer-link="profile.id"></h4>

2
app/partials/mobile/user_modal.html

@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
<div class="mobile_user_modal_photo_profile_wrap">
<a ng-click="openPhoto(user.photo.photo_id, {p: user.id})" class="mobile_user_modal_image_wrap pull-left" my-peer-photolink="::user.id" img-class="mobile_user_modal_image" no-open="true" watch="true" ng-class="{disabled: !user.photo.photo_id}" ng-disabled="!user.photo.photo_id"></a>
<a ng-click="openUserPic()" class="mobile_user_modal_image_wrap pull-left" my-peer-photolink="::user.id" img-class="mobile_user_modal_image" no-open="true" watch="true" ng-class="{disabled: !user.photo.photo_id}" ng-disabled="!user.photo.photo_id"></a>
<div class="mobile_user_modal_info_wrap clearfix">
<h4 class="mobile_user_modal_header" my-peer-link="user.id" verified="true"></h4>

Loading…
Cancel
Save