From 552b2d5a4a12f8cba2ee42f073219d311eba18c7 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 6 Feb 2019 12:18:37 +0100 Subject: [PATCH] MOBILE-2799 user: Check user avatar changed when opening profile --- src/core/user/pages/profile/profile.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/user/pages/profile/profile.ts b/src/core/user/pages/profile/profile.ts index a6b506f63..efef99985 100644 --- a/src/core/user/pages/profile/profile.ts +++ b/src/core/user/pages/profile/profile.ts @@ -97,6 +97,14 @@ export class CoreUserProfilePage { fetchUser(): Promise { return this.userProvider.getProfile(this.userId, this.courseId).then((user) => { + if (this.userId == this.site.getUserId() && user.profileimageurl != this.site.getInfo().userpictureurl) { + // The current user image received is different than the one stored in site info. Assume the image was updated. + this.eventsProvider.trigger(CoreUserProvider.PROFILE_PICTURE_UPDATED, { + userId: this.userId, + picture: user.profileimageurl + }, this.site.getId()); + } + user.address = this.userHelper.formatAddress('', user.city, user.country); user.roles = this.userHelper.formatRoleList(user.roles);