framework/js/lib/models/post.js
Toby Zerner 781dc2ef0c New component for post excerpts, which will be shown in search results
Perhaps also in user activity stream. They are used in the mentions
extension.

In order to generate the excerpt, each formatter can implement a
“strip” method which basically converts block formatting into inline
formatting.
2015-05-14 22:41:05 +09:30

29 lines
1.0 KiB
JavaScript

import Model from 'flarum/model';
import computed from 'flarum/utils/computed';
class Post extends Model {}
Post.prototype.id = Model.prop('id');
Post.prototype.number = Model.prop('number');
Post.prototype.discussion = Model.one('discussion');
Post.prototype.time = Model.prop('time');
Post.prototype.user = Model.one('user');
Post.prototype.contentType = Model.prop('contentType');
Post.prototype.content = Model.prop('content');
Post.prototype.contentHtml = Model.prop('contentHtml');
Post.prototype.excerpt = Model.prop('excerpt');
Post.prototype.editTime = Model.prop('editTime', Model.date);
Post.prototype.editUser = Model.one('editUser');
Post.prototype.isEdited = computed('editTime', editTime => !!editTime);
Post.prototype.hideTime = Model.prop('hideTime', Model.date);
Post.prototype.hideUser = Model.one('hideUser');
Post.prototype.isHidden = computed('hideTime', hideTime => !!hideTime);
Post.prototype.canEdit = Model.prop('canEdit');
Post.prototype.canDelete = Model.prop('canDelete');
export default Post;