mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 20:16:08 +08:00
Update js/src/common/models/User.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
This commit is contained in:
parent
5881a053e8
commit
4b5f680c39
|
@ -131,8 +131,7 @@ export default class User extends Model {
|
|||
const image = new Image();
|
||||
const user = this;
|
||||
|
||||
// @ts-expect-error This shouldn't be failing.
|
||||
image.onload = function (this: HTMLImageElement) {
|
||||
image.addEventListener('load', function (this: HTMLImageElement) {
|
||||
try {
|
||||
const colorThief = new ColorThief();
|
||||
user.avatarColor = colorThief.getColor(this);
|
||||
|
@ -147,7 +146,7 @@ export default class User extends Model {
|
|||
}
|
||||
user.freshness = new Date();
|
||||
m.redraw();
|
||||
};
|
||||
});
|
||||
image.crossOrigin = 'anonymous';
|
||||
image.src = this.avatarUrl() ?? '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user