- Remove suburl from beginning of avatar file path, so that avatar images

don't get broken when root-url changes to different sub-url.
  This does not change avatar urls in database, instead this
  fixes url on the fly after loading avatar url from database.

Thanks to xet7 !

Closes #1776,
closes #386
This commit is contained in:
Lauri Ojansivu 2018-08-22 21:42:53 +03:00
parent 1b94b919fe
commit 7e0bc1e33a
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,13 @@ Template.userAvatar.helpers({
});
},
fixAvatarUrl(avatarUrl) {
// Remove suburl from beginning of avatar file path,
// so that avatar images don't get broken when root-url changes to different sub-url.
avatarUrl = '/' + avatarUrl.substring(avatarUrl.indexOf('/cfs/files/avatars/')+1);
return avatarUrl;
},
memberType() {
const user = Users.findOne(this.userId);
return user && user.isBoardAdmin() ? 'admin' : 'normal';