mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 15:19:56 +08:00
Clean up, don't use mixin
PhpStorm/WebStorm doesn't like the mixin syntax, and it's clearer to just use Object.assign.
This commit is contained in:
@ -7,7 +7,9 @@ import ItemList from 'flarum/utils/ItemList';
|
||||
import computed from 'flarum/utils/computed';
|
||||
import GroupBadge from 'flarum/components/GroupBadge';
|
||||
|
||||
export default class User extends mixin(Model, {
|
||||
export default class User extends Model {}
|
||||
|
||||
Object.assign(User.prototype, {
|
||||
username: Model.attribute('username'),
|
||||
email: Model.attribute('email'),
|
||||
isActivated: Model.attribute('isActivated'),
|
||||
@ -45,8 +47,8 @@ export default class User extends mixin(Model, {
|
||||
}
|
||||
|
||||
return '#' + stringToColor(username);
|
||||
})
|
||||
}) {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Check whether or not the user has been seen in the last 5 minutes.
|
||||
*
|
||||
@ -55,7 +57,7 @@ export default class User extends mixin(Model, {
|
||||
*/
|
||||
isOnline() {
|
||||
return this.lastSeenTime() > moment().subtract(5, 'minutes').toDate();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the Badge components that apply to this user.
|
||||
@ -73,7 +75,7 @@ export default class User extends mixin(Model, {
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculate the dominant color of the user's avatar. The dominant color will
|
||||
@ -92,7 +94,7 @@ export default class User extends mixin(Model, {
|
||||
m.redraw();
|
||||
};
|
||||
image.src = this.avatarUrl();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the user's preferences.
|
||||
@ -107,4 +109,6 @@ export default class User extends mixin(Model, {
|
||||
|
||||
return this.save({preferences});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default User;
|
||||
|
Reference in New Issue
Block a user