Rename post.time

This commit is contained in:
Toby Zerner 2018-08-24 21:25:45 +09:30
parent e1400b0ef9
commit c2f6e2d7a3
5 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ Object.assign(Post.prototype, {
number: Model.attribute('number'), number: Model.attribute('number'),
discussion: Model.hasOne('discussion'), discussion: Model.hasOne('discussion'),
time: Model.attribute('time', Model.transformDate), createdAt: Model.attribute('createdAt', Model.transformDate),
user: Model.hasOne('user'), user: Model.hasOne('user'),
contentType: Model.attribute('contentType'), contentType: Model.attribute('contentType'),
content: Model.attribute('content'), content: Model.attribute('content'),

View File

@ -14,7 +14,7 @@ import fullTime from '../../common/helpers/fullTime';
export default class PostMeta extends Component { export default class PostMeta extends Component {
view() { view() {
const post = this.props.post; const post = this.props.post;
const time = post.time(); const time = post.createdAt();
const permalink = this.getPermalink(post); const permalink = this.getPermalink(post);
const touch = 'ontouchstart' in document.documentElement; const touch = 'ontouchstart' in document.documentElement;

View File

@ -205,7 +205,7 @@ class PostStream extends Component {
const attrs = {'data-index': this.visibleStart + i}; const attrs = {'data-index': this.visibleStart + i};
if (post) { if (post) {
const time = post.time(); const time = post.createdAt();
const PostComponent = app.postComponents[post.contentType()]; const PostComponent = app.postComponents[post.contentType()];
content = PostComponent ? PostComponent.component({post}) : ''; content = PostComponent ? PostComponent.component({post}) : '';

View File

@ -39,7 +39,7 @@ class BasicPostSerializer extends AbstractSerializer
$attributes = [ $attributes = [
'id' => (int) $post->id, 'id' => (int) $post->id,
'number' => (int) $post->number, 'number' => (int) $post->number,
'time' => $this->formatDate($post->created_at), 'createdAt' => $this->formatDate($post->created_at),
'contentType' => $post->type 'contentType' => $post->type
]; ];

View File

@ -91,7 +91,7 @@ class PostReplyHandler
$command->ipAddress $command->ipAddress
); );
if ($actor->isAdmin() && ($time = array_get($command->data, 'attributes.time'))) { if ($actor->isAdmin() && ($time = array_get($command->data, 'attributes.createdAt'))) {
$post->created_at = new Carbon($time); $post->created_at = new Carbon($time);
} }