mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 15:43:59 +08:00
Rename post.hideUser
This commit is contained in:
parent
5bb93e569b
commit
1c4070a034
|
@ -20,7 +20,7 @@ Object.assign(Post.prototype, {
|
||||||
isEdited: computed('editedAt', editedAt => !!editedAt),
|
isEdited: computed('editedAt', editedAt => !!editedAt),
|
||||||
|
|
||||||
hiddenAt: Model.attribute('hiddenAt', Model.transformDate),
|
hiddenAt: Model.attribute('hiddenAt', Model.transformDate),
|
||||||
hideUser: Model.hasOne('hideUser'),
|
hiddenUser: Model.hasOne('hiddenUser'),
|
||||||
isHidden: computed('hiddenAt', hiddenAt => !!hiddenAt),
|
isHidden: computed('hiddenAt', hiddenAt => !!hiddenAt),
|
||||||
|
|
||||||
canEdit: Model.attribute('canEdit'),
|
canEdit: Model.attribute('canEdit'),
|
||||||
|
|
|
@ -123,7 +123,7 @@ export default {
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
hideAction() {
|
hideAction() {
|
||||||
this.pushAttributes({ hiddenAt: new Date(), hideUser: app.session.user });
|
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });
|
||||||
|
|
||||||
return this.save({ isHidden: true }).then(() => m.redraw());
|
return this.save({ isHidden: true }).then(() => m.redraw());
|
||||||
},
|
},
|
||||||
|
@ -134,7 +134,7 @@ export default {
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
restoreAction() {
|
restoreAction() {
|
||||||
this.pushAttributes({ hiddenAt: null, hideUser: null });
|
this.pushAttributes({ hiddenAt: null, hiddenUser: null });
|
||||||
|
|
||||||
return this.save({ isHidden: false }).then(() => m.redraw());
|
return this.save({ isHidden: false }).then(() => m.redraw());
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ListPostsController extends AbstractListController
|
||||||
'user',
|
'user',
|
||||||
'user.groups',
|
'user.groups',
|
||||||
'editedUser',
|
'editedUser',
|
||||||
'hideUser',
|
'hiddenUser',
|
||||||
'discussion'
|
'discussion'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ShowDiscussionController extends AbstractShowController
|
||||||
'posts.user',
|
'posts.user',
|
||||||
'posts.user.groups',
|
'posts.user.groups',
|
||||||
'posts.editedUser',
|
'posts.editedUser',
|
||||||
'posts.hideUser'
|
'posts.hiddenUser'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ShowPostController extends AbstractShowController
|
||||||
'user',
|
'user',
|
||||||
'user.groups',
|
'user.groups',
|
||||||
'editedUser',
|
'editedUser',
|
||||||
'hideUser',
|
'hiddenUser',
|
||||||
'discussion'
|
'discussion'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class PostSerializer extends BasicPostSerializer
|
||||||
/**
|
/**
|
||||||
* @return \Tobscure\JsonApi\Relationship
|
* @return \Tobscure\JsonApi\Relationship
|
||||||
*/
|
*/
|
||||||
protected function hideUser($post)
|
protected function hiddenUser($post)
|
||||||
{
|
{
|
||||||
return $this->hasOne($post, BasicUserSerializer::class);
|
return $this->hasOne($post, BasicUserSerializer::class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||||
* @property \Flarum\Discussion\Discussion|null $discussion
|
* @property \Flarum\Discussion\Discussion|null $discussion
|
||||||
* @property User|null $user
|
* @property User|null $user
|
||||||
* @property User|null $editedUser
|
* @property User|null $editedUser
|
||||||
* @property User|null $hideUser
|
* @property User|null $hiddenUser
|
||||||
* @property string $ip_address
|
* @property string $ip_address
|
||||||
* @property bool $is_private
|
* @property bool $is_private
|
||||||
*/
|
*/
|
||||||
|
@ -177,7 +177,7 @@ class Post extends AbstractModel
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
public function hideUser()
|
public function hiddenUser()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'hidden_user_id');
|
return $this->belongsTo(User::class, 'hidden_user_id');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user