mirror of
https://github.com/wekan/wekan.git
synced 2026-01-06 01:28:49 +01:00
fix: user avatar images & upload
This commit is contained in:
parent
1875551a93
commit
efcca9739a
3 changed files with 10 additions and 15 deletions
|
|
@ -3,6 +3,7 @@ import Avatars from '/models/avatars';
|
|||
import Users from '/models/users';
|
||||
import Org from '/models/org';
|
||||
import Team from '/models/team';
|
||||
import { formatFleURL } from 'meteor/ostrio:files/lib';
|
||||
|
||||
Template.userAvatar.helpers({
|
||||
userData() {
|
||||
|
|
@ -184,21 +185,14 @@ BlazeComponent.extendComponent({
|
|||
Meteor.subscribe('my-avatars');
|
||||
},
|
||||
|
||||
avatarUrlOptions() {
|
||||
return {
|
||||
auth: false,
|
||||
brokenIsFine: true,
|
||||
};
|
||||
},
|
||||
|
||||
uploadedAvatars() {
|
||||
return Avatars.find({ userId: Meteor.userId() });
|
||||
return Avatars.find({ userId: Meteor.userId() }).each();
|
||||
},
|
||||
|
||||
isSelected() {
|
||||
const userProfile = Meteor.user().profile;
|
||||
const avatarUrl = userProfile && userProfile.avatarUrl;
|
||||
const currentAvatarUrl = this.currentData().url(this.avatarUrlOptions());
|
||||
const currentAvatarUrl = `${this.currentData().link()}?auth=false&brokenIsFine=true`;
|
||||
return avatarUrl === currentAvatarUrl;
|
||||
},
|
||||
|
||||
|
|
@ -234,8 +228,9 @@ BlazeComponent.extendComponent({
|
|||
);
|
||||
uploader.on('uploaded', (error, fileRef) => {
|
||||
if (!error) {
|
||||
self.setAvatar(fileRef.path);
|
||||
// self.setAvatar(this.currentData().url(this.avatarUrlOptions()));
|
||||
self.setAvatar(
|
||||
`${formatFleURL(fileRef)}?auth=false&brokenIsFine=true`,
|
||||
);
|
||||
}
|
||||
});
|
||||
uploader.on('error', (error, fileData) => {
|
||||
|
|
@ -245,7 +240,7 @@ BlazeComponent.extendComponent({
|
|||
}
|
||||
},
|
||||
'click .js-select-avatar'() {
|
||||
const avatarUrl = this.currentData().url(this.avatarUrlOptions());
|
||||
const avatarUrl = `${this.currentData().link()}?auth=false&brokenIsFine=true`;
|
||||
this.setAvatar(avatarUrl);
|
||||
},
|
||||
'click .js-select-initials'() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue