diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-08-22 21:42:53 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-08-22 21:42:53 +0300 |
commit | 7e0bc1e33aef6dc0de11a595b81854623b417572 (patch) | |
tree | e28029afd1cb1da9c0a10e87e7fb450f74c20654 /client | |
parent | 1b94b919fe953d8da5ad2cd358866579481bbeb2 (diff) | |
download | wekan-7e0bc1e33aef6dc0de11a595b81854623b417572.tar.gz wekan-7e0bc1e33aef6dc0de11a595b81854623b417572.tar.bz2 wekan-7e0bc1e33aef6dc0de11a595b81854623b417572.zip |
- 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
Diffstat (limited to 'client')
-rw-r--r-- | client/components/users/userAvatar.jade | 2 | ||||
-rw-r--r-- | client/components/users/userAvatar.js | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/client/components/users/userAvatar.jade b/client/components/users/userAvatar.jade index 83e2c8d0..c61ade21 100644 --- a/client/components/users/userAvatar.jade +++ b/client/components/users/userAvatar.jade @@ -1,7 +1,7 @@ template(name="userAvatar") a.member.js-member(title="{{userData.profile.fullname}} ({{userData.username}})") if userData.profile.avatarUrl - img.avatar.avatar-image(src=userData.profile.avatarUrl) + img.avatar.avatar-image(src="{{fixAvatarUrl userData.profile.avatarUrl}}") else +userAvatarInitials(userId=userData._id) diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js index 91cad237..5fb5d9df 100644 --- a/client/components/users/userAvatar.js +++ b/client/components/users/userAvatar.js @@ -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'; |