mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Rename discussion.lastPostedUser
This commit is contained in:
parent
6670605b7c
commit
350d162d81
|
@ -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'),
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -32,7 +32,7 @@ class CreateDiscussionController extends AbstractCreateController
|
|||
public $include = [
|
||||
'posts',
|
||||
'user',
|
||||
'lastUser',
|
||||
'lastPostedUser',
|
||||
'firstPost',
|
||||
'lastPost'
|
||||
];
|
||||
|
|
|
@ -33,7 +33,7 @@ class CreatePostController extends AbstractCreateController
|
|||
'user',
|
||||
'discussion',
|
||||
'discussion.posts',
|
||||
'discussion.lastUser'
|
||||
'discussion.lastPostedUser'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class ListDiscussionsController extends AbstractListController
|
|||
*/
|
||||
public $include = [
|
||||
'user',
|
||||
'lastUser',
|
||||
'lastPostedUser',
|
||||
'mostRelevantPost',
|
||||
'mostRelevantPost.user'
|
||||
];
|
||||
|
|
|
@ -53,7 +53,7 @@ class ShowDiscussionController extends AbstractShowController
|
|||
*/
|
||||
public $optionalInclude = [
|
||||
'user',
|
||||
'lastUser',
|
||||
'lastPostedUser',
|
||||
'firstPost',
|
||||
'lastPost'
|
||||
];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user