Rename discussion.lastPostedUser

This commit is contained in:
Toby Zerner 2018-08-24 20:44:42 +09:30
parent 6670605b7c
commit 350d162d81
9 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@ Object.assign(Discussion.prototype, {
firstPost: Model.hasOne('firstPost'),
lastTime: Model.attribute('lastTime', Model.transformDate),
lastUser: Model.hasOne('lastUser'),
lastPostedUser: Model.hasOne('lastPostedUser'),
lastPost: Model.hasOne('lastPost'),
lastPostNumber: Model.attribute('lastPostNumber'),

View File

@ -87,7 +87,7 @@ export default class DiscussionList extends Component {
* @api
*/
requestParams() {
const params = {include: ['user', 'lastUser'], filter: {}};
const params = {include: ['user', 'lastPostedUser'], filter: {}};
params.sort = this.sortMap()[this.props.params.sort];

View File

@ -15,7 +15,7 @@ export default class TerminalPost extends Component {
const discussion = this.props.discussion;
const lastPost = this.props.lastPost && discussion.repliesCount();
const user = discussion[lastPost ? 'lastUser' : 'user']();
const user = discussion[lastPost ? 'lastPostedUser' : 'user']();
const time = discussion[lastPost ? 'lastTime' : 'startTime']();
return (

View File

@ -32,7 +32,7 @@ class CreateDiscussionController extends AbstractCreateController
public $include = [
'posts',
'user',
'lastUser',
'lastPostedUser',
'firstPost',
'lastPost'
];

View File

@ -33,7 +33,7 @@ class CreatePostController extends AbstractCreateController
'user',
'discussion',
'discussion.posts',
'discussion.lastUser'
'discussion.lastPostedUser'
];
/**

View File

@ -31,7 +31,7 @@ class ListDiscussionsController extends AbstractListController
*/
public $include = [
'user',
'lastUser',
'lastPostedUser',
'mostRelevantPost',
'mostRelevantPost.user'
];

View File

@ -53,7 +53,7 @@ class ShowDiscussionController extends AbstractShowController
*/
public $optionalInclude = [
'user',
'lastUser',
'lastPostedUser',
'firstPost',
'lastPost'
];

View File

@ -60,7 +60,7 @@ class BasicDiscussionSerializer extends AbstractSerializer
/**
* @return \Tobscure\JsonApi\Relationship
*/
protected function lastUser($discussion)
protected function lastPostedUser($discussion)
{
return $this->hasOne($discussion, BasicUserSerializer::class);
}

View File

@ -49,7 +49,7 @@ use Flarum\Util\Str;
* @property Post|null $firstPost
* @property User|null $user
* @property Post|null $lastPost
* @property User|null $lastUser
* @property User|null $lastPostedUser
* @property \Illuminate\Database\Eloquent\Collection $readers
* @property bool $is_private
*/
@ -359,7 +359,7 @@ class Discussion extends AbstractModel
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function lastUser()
public function lastPostedUser()
{
return $this->belongsTo(User::class, 'last_posted_user_id');
}