[COMPONENT][Tag] Update tag stream to use new pagedStream format

This commit is contained in:
Hugo Sales 2021-09-21 16:39:36 +01:00
parent 69e7dc44bd
commit c6082bab10
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 9 additions and 6 deletions

View File

@ -4,18 +4,21 @@ namespace Component\Tag\Controller;
use App\Core\Cache; use App\Core\Cache;
use App\Core\Controller; use App\Core\Controller;
use App\Util\Common;
use Component\Tag\Tag as CompTag; use Component\Tag\Tag as CompTag;
class Tag extends Controller class Tag extends Controller
{ {
public function tag(string $tag) public function tag(string $tag)
{ {
$page = $this->int('page') ?: 1; $user = Common::user();
$tag = CompTag::canonicalTag($tag); $page = $this->int('page') ?: 1;
$notes = Cache::pagedStream( $canonical = CompTag::canonicalTag($tag);
key: "tag-{$tag}", $notes = Cache::pagedStream(
query: 'select n from note n join note_tag nt with nt.note_id = n.id where nt.canonical = :tag order by nt.created DESC, n.id DESC', key: "tag-{$canonical}",
query_args: ['tag' => $tag], query: 'select n from note n join note_tag nt with n.id = nt.note_id where nt.canonical = :canon order by nt.created DESC, nt.note_id DESC',
query_args: ['canon' => $canonical],
actor: $user,
page: $page page: $page
); );