mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +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),
|
||||
|
||||
hiddenAt: Model.attribute('hiddenAt', Model.transformDate),
|
||||
hideUser: Model.hasOne('hideUser'),
|
||||
hiddenUser: Model.hasOne('hiddenUser'),
|
||||
isHidden: computed('hiddenAt', hiddenAt => !!hiddenAt),
|
||||
|
||||
canEdit: Model.attribute('canEdit'),
|
||||
|
|
|
@ -123,7 +123,7 @@ export default {
|
|||
* @return {Promise}
|
||||
*/
|
||||
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());
|
||||
},
|
||||
|
@ -134,7 +134,7 @@ export default {
|
|||
* @return {Promise}
|
||||
*/
|
||||
restoreAction() {
|
||||
this.pushAttributes({ hiddenAt: null, hideUser: null });
|
||||
this.pushAttributes({ hiddenAt: null, hiddenUser: null });
|
||||
|
||||
return this.save({ isHidden: false }).then(() => m.redraw());
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ class ListPostsController extends AbstractListController
|
|||
'user',
|
||||
'user.groups',
|
||||
'editedUser',
|
||||
'hideUser',
|
||||
'hiddenUser',
|
||||
'discussion'
|
||||
];
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class ShowDiscussionController extends AbstractShowController
|
|||
'posts.user',
|
||||
'posts.user.groups',
|
||||
'posts.editedUser',
|
||||
'posts.hideUser'
|
||||
'posts.hiddenUser'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class ShowPostController extends AbstractShowController
|
|||
'user',
|
||||
'user.groups',
|
||||
'editedUser',
|
||||
'hideUser',
|
||||
'hiddenUser',
|
||||
'discussion'
|
||||
];
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class PostSerializer extends BasicPostSerializer
|
|||
/**
|
||||
* @return \Tobscure\JsonApi\Relationship
|
||||
*/
|
||||
protected function hideUser($post)
|
||||
protected function hiddenUser($post)
|
||||
{
|
||||
return $this->hasOne($post, BasicUserSerializer::class);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||
* @property \Flarum\Discussion\Discussion|null $discussion
|
||||
* @property User|null $user
|
||||
* @property User|null $editedUser
|
||||
* @property User|null $hideUser
|
||||
* @property User|null $hiddenUser
|
||||
* @property string $ip_address
|
||||
* @property bool $is_private
|
||||
*/
|
||||
|
@ -177,7 +177,7 @@ class Post extends AbstractModel
|
|||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function hideUser()
|
||||
public function hiddenUser()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'hidden_user_id');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user