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