mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +02:00
Update js/src/common/models/User.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
This commit is contained in:
committed by
Alexander Skvortsov
parent
528c964d94
commit
4bd5bc87ee
@@ -131,8 +131,7 @@ export default class User extends Model {
|
|||||||
const image = new Image();
|
const image = new Image();
|
||||||
const user = this;
|
const user = this;
|
||||||
|
|
||||||
// @ts-expect-error This shouldn't be failing.
|
image.addEventListener('load', function (this: HTMLImageElement) {
|
||||||
image.onload = function (this: HTMLImageElement) {
|
|
||||||
try {
|
try {
|
||||||
const colorThief = new ColorThief();
|
const colorThief = new ColorThief();
|
||||||
user.avatarColor = colorThief.getColor(this);
|
user.avatarColor = colorThief.getColor(this);
|
||||||
@@ -147,7 +146,7 @@ export default class User extends Model {
|
|||||||
}
|
}
|
||||||
user.freshness = new Date();
|
user.freshness = new Date();
|
||||||
m.redraw();
|
m.redraw();
|
||||||
};
|
});
|
||||||
image.crossOrigin = 'anonymous';
|
image.crossOrigin = 'anonymous';
|
||||||
image.src = this.avatarUrl() ?? '';
|
image.src = this.avatarUrl() ?? '';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user