Rename post.hideUser

This commit is contained in:
Toby Zerner 2018-08-24 21:30:06 +09:30
parent 5bb93e569b
commit 1c4070a034
7 changed files with 9 additions and 9 deletions

View File

@ -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'),

View File

@ -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());
},

View File

@ -33,7 +33,7 @@ class ListPostsController extends AbstractListController
'user',
'user.groups',
'editedUser',
'hideUser',
'hiddenUser',
'discussion'
];

View File

@ -45,7 +45,7 @@ class ShowDiscussionController extends AbstractShowController
'posts.user',
'posts.user.groups',
'posts.editedUser',
'posts.hideUser'
'posts.hiddenUser'
];
/**

View File

@ -30,7 +30,7 @@ class ShowPostController extends AbstractShowController
'user',
'user.groups',
'editedUser',
'hideUser',
'hiddenUser',
'discussion'
];

View File

@ -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);
}

View File

@ -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');
}