MOBILE-2799 user: Check user avatar changed when opening profile

main
Dani Palou 2019-02-06 12:18:37 +01:00
parent 226f4eee82
commit 552b2d5a4a
1 changed files with 8 additions and 0 deletions

View File

@ -97,6 +97,14 @@ export class CoreUserProfilePage {
fetchUser(): Promise<any> {
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);