seed and use comment count for sorting

This commit is contained in:
Daniël Klabbers 2021-11-11 21:40:34 +01:00
parent 87f695484b
commit cadfc7b9bd
3 changed files with 6 additions and 3 deletions

View File

@ -32,7 +32,8 @@ class SearchController extends ListDiscussionsController
protected array $translateSort = [ protected array $translateSort = [
'lastPostedAt' => 'updated_at', 'lastPostedAt' => 'updated_at',
'createdAt' => 'created_at' 'createdAt' => 'created_at',
'commentCount' => 'comment_count'
]; ];
public function __construct(protected Client $elastic) public function __construct(protected Client $elastic)

View File

@ -65,7 +65,8 @@ class CommentSeeder extends Seeder
'updated_at' => $model->edited_at?->toAtomString(), 'updated_at' => $model->edited_at?->toAtomString(),
'is_private' => $model->is_private, 'is_private' => $model->is_private,
'user_id' => $model->user_id, 'user_id' => $model->user_id,
'groups' => $this->groupsForDiscussion($model->discussion) 'groups' => $this->groupsForDiscussion($model->discussion),
'comment_count' => $model->discussion->comment_count,
]); ]);
if ($this->extensionEnabled('fof-byobu')) { if ($this->extensionEnabled('fof-byobu')) {

View File

@ -65,7 +65,8 @@ class DiscussionSeeder extends Seeder
'updated_at' => $model->last_posted_at?->toAtomString(), 'updated_at' => $model->last_posted_at?->toAtomString(),
'is_private' => $model->is_private, 'is_private' => $model->is_private,
'user_id' => $model->user_id, 'user_id' => $model->user_id,
'groups' => $this->groupsForDiscussion($model) 'groups' => $this->groupsForDiscussion($model),
'comment_count' => $model->comment_count,
]); ]);
if ($this->extensionEnabled('fof-byobu')) { if ($this->extensionEnabled('fof-byobu')) {