Optimize search page "Topics with your posts" for "User has posted earlier" == YES

This commit is contained in:
Visman 2023-07-15 15:54:54 +07:00
parent 6e0923ac44
commit d8bb95fcff
2 changed files with 16 additions and 10 deletions

View file

@ -422,7 +422,7 @@ class Search extends Page
$model = $this->c->search;
$model->page = $args['page'] ?? 1;
$action = $args['action'];
$action = $model->currentAction = $args['action'];
$asTopicsList = true;
$list = false;
$uid = $args['uid'] ?? null;

View file

@ -44,9 +44,15 @@ class View extends Action
$result = $this->c->topics->loadByIds($arg->idsList, $full);
if (
! $this->c->user->isGuest
&& 1 === $this->c->config->b_show_dot
$this->c->user->isGuest
|| 1 !== $this->c->config->b_show_dot
) {
return $result;
}
if ('topics_with_your_posts' === $arg->currentAction) {
$dots = $arg->idsList;
} else {
$vars = [
':uid' => $this->c->user->id,
':ids' => $arg->idsList,
@ -57,14 +63,14 @@ class View extends Action
GROUP BY p.topic_id';
$dots = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
}
foreach ($dots as $id) {
if (
isset($result[$id])
&& $result[$id] instanceof Topic
) {
$result[$id]->__dot = true;
}
foreach ($dots as $id) {
if (
isset($result[$id])
&& $result[$id] instanceof Topic
) {
$result[$id]->__dot = true;
}
}