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'), firstPost: Model.hasOne('firstPost'),
lastTime: Model.attribute('lastTime', Model.transformDate), lastTime: Model.attribute('lastTime', Model.transformDate),
lastUser: Model.hasOne('lastUser'), lastPostedUser: Model.hasOne('lastPostedUser'),
lastPost: Model.hasOne('lastPost'), lastPost: Model.hasOne('lastPost'),
lastPostNumber: Model.attribute('lastPostNumber'), lastPostNumber: Model.attribute('lastPostNumber'),

View File

@ -87,7 +87,7 @@ export default class DiscussionList extends Component {
* @api * @api
*/ */
requestParams() { requestParams() {
const params = {include: ['user', 'lastUser'], filter: {}}; const params = {include: ['user', 'lastPostedUser'], filter: {}};
params.sort = this.sortMap()[this.props.params.sort]; 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 discussion = this.props.discussion;
const lastPost = this.props.lastPost && discussion.repliesCount(); 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'](); const time = discussion[lastPost ? 'lastTime' : 'startTime']();
return ( return (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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