mirror of
https://github.com/flarum/core.git
synced 2025-08-17 05:44:13 +02:00
Rename discussion.startPost
This commit is contained in:
@@ -33,7 +33,7 @@ class CreateDiscussionController extends AbstractCreateController
|
||||
'posts',
|
||||
'startUser',
|
||||
'lastUser',
|
||||
'startPost',
|
||||
'firstPost',
|
||||
'lastPost'
|
||||
];
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class ListDiscussionsController extends AbstractListController
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $optionalInclude = [
|
||||
'startPost',
|
||||
'firstPost',
|
||||
'lastPost'
|
||||
];
|
||||
|
||||
@@ -98,7 +98,7 @@ class ListDiscussionsController extends AbstractListController
|
||||
|
||||
$results = $results->getResults()->load($load);
|
||||
|
||||
if ($relations = array_intersect($load, ['startPost', 'lastPost'])) {
|
||||
if ($relations = array_intersect($load, ['firstPost', 'lastPost'])) {
|
||||
foreach ($results as $discussion) {
|
||||
foreach ($relations as $relation) {
|
||||
if ($discussion->$relation) {
|
||||
|
@@ -54,7 +54,7 @@ class ShowDiscussionController extends AbstractShowController
|
||||
public $optionalInclude = [
|
||||
'startUser',
|
||||
'lastUser',
|
||||
'startPost',
|
||||
'firstPost',
|
||||
'lastPost'
|
||||
];
|
||||
|
||||
|
@@ -52,7 +52,7 @@ class BasicDiscussionSerializer extends AbstractSerializer
|
||||
/**
|
||||
* @return \Tobscure\JsonApi\Relationship
|
||||
*/
|
||||
protected function startPost($discussion)
|
||||
protected function firstPost($discussion)
|
||||
{
|
||||
return $this->hasOne($discussion, BasicPostSerializer::class);
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class StartDiscussionHandler
|
||||
// attributes as posting the reply will have changed some of them (e.g.
|
||||
// last_time.)
|
||||
$discussion->setRawAttributes($post->discussion->getAttributes(), true);
|
||||
$discussion->setStartPost($post);
|
||||
$discussion->setFirstPost($post);
|
||||
$discussion->setLastPost($post);
|
||||
|
||||
$this->dispatchEventsFor($discussion, $actor);
|
||||
|
@@ -46,7 +46,7 @@ use Flarum\Util\Str;
|
||||
* @property \Illuminate\Database\Eloquent\Collection $posts
|
||||
* @property \Illuminate\Database\Eloquent\Collection $comments
|
||||
* @property \Illuminate\Database\Eloquent\Collection $participants
|
||||
* @property Post|null $startPost
|
||||
* @property Post|null $firstPost
|
||||
* @property User|null $startUser
|
||||
* @property Post|null $lastPost
|
||||
* @property User|null $lastUser
|
||||
@@ -184,12 +184,12 @@ class Discussion extends AbstractModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the discussion's start post details.
|
||||
* Set the discussion's first post details.
|
||||
*
|
||||
* @param Post $post
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartPost(Post $post)
|
||||
public function setFirstPost(Post $post)
|
||||
{
|
||||
$this->created_at = $post->created_at;
|
||||
$this->user_id = $post->user_id;
|
||||
@@ -329,7 +329,7 @@ class Discussion extends AbstractModel
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function startPost()
|
||||
public function firstPost()
|
||||
{
|
||||
return $this->belongsTo(Post::class, 'first_post_id');
|
||||
}
|
||||
|
Reference in New Issue
Block a user