From 350d162d814b8169b6194e3b3f93b842eaba702c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 24 Aug 2018 20:44:42 +0930 Subject: [PATCH] Rename discussion.lastPostedUser --- framework/core/js/src/common/models/Discussion.js | 2 +- framework/core/js/src/forum/components/DiscussionList.js | 2 +- framework/core/js/src/forum/components/TerminalPost.js | 2 +- .../core/src/Api/Controller/CreateDiscussionController.php | 2 +- framework/core/src/Api/Controller/CreatePostController.php | 2 +- .../core/src/Api/Controller/ListDiscussionsController.php | 2 +- .../core/src/Api/Controller/ShowDiscussionController.php | 2 +- .../core/src/Api/Serializer/BasicDiscussionSerializer.php | 2 +- framework/core/src/Discussion/Discussion.php | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/framework/core/js/src/common/models/Discussion.js b/framework/core/js/src/common/models/Discussion.js index 7fa357e6b..4b2beef27 100644 --- a/framework/core/js/src/common/models/Discussion.js +++ b/framework/core/js/src/common/models/Discussion.js @@ -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'), diff --git a/framework/core/js/src/forum/components/DiscussionList.js b/framework/core/js/src/forum/components/DiscussionList.js index 48e1e88ea..dd0f155cc 100644 --- a/framework/core/js/src/forum/components/DiscussionList.js +++ b/framework/core/js/src/forum/components/DiscussionList.js @@ -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]; diff --git a/framework/core/js/src/forum/components/TerminalPost.js b/framework/core/js/src/forum/components/TerminalPost.js index d9ce8236a..c818f9bbd 100644 --- a/framework/core/js/src/forum/components/TerminalPost.js +++ b/framework/core/js/src/forum/components/TerminalPost.js @@ -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 ( diff --git a/framework/core/src/Api/Controller/CreateDiscussionController.php b/framework/core/src/Api/Controller/CreateDiscussionController.php index 7e857ff71..32caf0463 100644 --- a/framework/core/src/Api/Controller/CreateDiscussionController.php +++ b/framework/core/src/Api/Controller/CreateDiscussionController.php @@ -32,7 +32,7 @@ class CreateDiscussionController extends AbstractCreateController public $include = [ 'posts', 'user', - 'lastUser', + 'lastPostedUser', 'firstPost', 'lastPost' ]; diff --git a/framework/core/src/Api/Controller/CreatePostController.php b/framework/core/src/Api/Controller/CreatePostController.php index 4cdae617e..03da2c4be 100644 --- a/framework/core/src/Api/Controller/CreatePostController.php +++ b/framework/core/src/Api/Controller/CreatePostController.php @@ -33,7 +33,7 @@ class CreatePostController extends AbstractCreateController 'user', 'discussion', 'discussion.posts', - 'discussion.lastUser' + 'discussion.lastPostedUser' ]; /** diff --git a/framework/core/src/Api/Controller/ListDiscussionsController.php b/framework/core/src/Api/Controller/ListDiscussionsController.php index 7338793fe..c7022547f 100644 --- a/framework/core/src/Api/Controller/ListDiscussionsController.php +++ b/framework/core/src/Api/Controller/ListDiscussionsController.php @@ -31,7 +31,7 @@ class ListDiscussionsController extends AbstractListController */ public $include = [ 'user', - 'lastUser', + 'lastPostedUser', 'mostRelevantPost', 'mostRelevantPost.user' ]; diff --git a/framework/core/src/Api/Controller/ShowDiscussionController.php b/framework/core/src/Api/Controller/ShowDiscussionController.php index 2b0e05e07..4c439d9fb 100644 --- a/framework/core/src/Api/Controller/ShowDiscussionController.php +++ b/framework/core/src/Api/Controller/ShowDiscussionController.php @@ -53,7 +53,7 @@ class ShowDiscussionController extends AbstractShowController */ public $optionalInclude = [ 'user', - 'lastUser', + 'lastPostedUser', 'firstPost', 'lastPost' ]; diff --git a/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php b/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php index 389b87cd3..8adc2ae67 100644 --- a/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php +++ b/framework/core/src/Api/Serializer/BasicDiscussionSerializer.php @@ -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); } diff --git a/framework/core/src/Discussion/Discussion.php b/framework/core/src/Discussion/Discussion.php index 4c1aff4e3..930cf3084 100644 --- a/framework/core/src/Discussion/Discussion.php +++ b/framework/core/src/Discussion/Discussion.php @@ -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'); }