mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Rename post.time
This commit is contained in:
parent
e1400b0ef9
commit
c2f6e2d7a3
|
@ -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'),
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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}) : '';
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user