Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions www/core/components/user/controllers/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular.module('mm.core.user')
* @ngdoc controller
* @name mmaParticipantsProfileCtrl
*/
.controller('mmUserProfileCtrl', function($scope, $stateParams, $mmUtil, $mmUser, $mmUserDelegate, $mmSite, $q) {
.controller('mmUserProfileCtrl', function($scope, $stateParams, $mmUtil, $mmUser, $mmUserDelegate, $mmSite, $q, $translate) {

var courseid = $stateParams.courseid,
userid = $stateParams.userid;
Expand Down Expand Up @@ -63,9 +63,11 @@ angular.module('mm.core.user')

fetchUserData().then(function() {
// Add log in Moodle.
$mmSite.write('core_user_view_user_profile', {
return $mmSite.write('core_user_view_user_profile', {
userid: userid,
courseid: courseid
}).catch(function(error) {
$scope.isDeleted = error === $translate.instant('mm.core.userdeleted');
});
}).finally(function() {
$scope.userLoaded = true;
Expand Down
8 changes: 6 additions & 2 deletions www/core/components/user/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ion-content padding="true">
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="userLoaded" on-refresh="refreshUser()"></ion-refresher>
<mm-loading hide-until="userLoaded">
<div class="list" ng-if="user">
<div class="list" ng-if="user && !isDeleted">
<div class="item item-avatar">
<img ng-if="user.profileimageurl" ng-src="{{user.profileimageurl}}" mm-external-content alt="" role="presentation">
<img ng-if="!user.profileimageurl" src="img/user-avatar.png" alt="" role="presentation">
Expand Down Expand Up @@ -99,9 +99,13 @@ <h2>{{ 'mm.user.description' | translate}}</h2>
</div>
</div>

<div ng-if="!user">
<div ng-if="!user && !isDeleted">
{{ 'mm.user.detailsnotavailable' | translate }}
</div>

<div ng-if="isDeleted">
{{ 'mm.core.userdeleted' | translate }}
</div>
</mm-loading>
</ion-content>
</ion-view>