2014-12-20 14:26:46 +08:00
|
|
|
import DS from 'ember-data';
|
|
|
|
|
2015-02-13 09:15:14 +08:00
|
|
|
import stringToColor from 'flarum/utils/string-to-color';
|
|
|
|
|
2014-12-20 14:26:46 +08:00
|
|
|
export default DS.Model.extend({
|
2015-02-10 15:35:40 +08:00
|
|
|
username: DS.attr('string'),
|
|
|
|
email: DS.attr('string'),
|
|
|
|
password: DS.attr('string'),
|
|
|
|
avatarUrl: DS.attr('string'),
|
2014-12-20 14:26:46 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
groups: DS.hasMany('group'),
|
2014-12-20 14:26:46 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
joinTime: DS.attr('date'),
|
|
|
|
lastSeenTime: DS.attr('date'),
|
|
|
|
readTime: DS.attr('date'),
|
2014-12-20 14:26:46 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
discussionsCount: DS.attr('number'),
|
|
|
|
postsCount: DS.attr('number'),
|
2014-12-20 14:26:46 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
canEdit: DS.attr('boolean'),
|
2015-02-13 09:15:14 +08:00
|
|
|
canDelete: DS.attr('boolean'),
|
|
|
|
|
|
|
|
color: Ember.computed('username', function() {
|
2015-02-13 09:17:37 +08:00
|
|
|
return '#'+stringToColor(this.get('username'));
|
2015-02-13 09:15:14 +08:00
|
|
|
})
|
2014-12-20 14:26:46 +08:00
|
|
|
});
|