[TESTS] Fix Core/ControllerTest

This commit is contained in:
2022-03-07 14:08:07 +00:00
parent 813e66e83e
commit 487791d606
7 changed files with 49 additions and 30 deletions

View File

@@ -88,21 +88,23 @@ class PinnedNotes extends Plugin
$locale = Common::currentLanguage()->getLocale();
$notes = Collection::query('pinned:true actor:' . $actor->getId(), 1, $locale, $actor);
$res[] = Formatting::twigRenderFile('PinnedNotes/notes.html.twig', ['pinnednotes' => $notes['notes']]);
$res[] = Formatting::twigRenderFile('PinnedNotes/notes.html.twig', ['pinned_notes' => $notes['notes']]);
return Event::next;
}
public function onCollectionQueryAddJoins(QueryBuilder &$note_qb, QueryBuilder &$actor_qb): bool
{
$note_qb->leftJoin(E\PinnedNotes::class, 'pinned', Expr\Join::WITH, 'note.id = pinned.note_id');
if (!\in_array('pinned_notes', $note_qb->getAllAliases())) {
$note_qb->leftJoin(E\PinnedNotes::class, 'pinned_notes', Expr\Join::WITH, 'note.id = pinned_notes.note_id');
}
return Event::next;
}
public function onCollectionQueryCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, ?Actor $actor, &$note_expr, &$actor_expr): bool
{
if ($term === 'pinned:true') {
$note_expr = $eb->neq('pinned', null);
$note_expr = $eb->neq('pinned_notes', null);
return Event::stop;
}
if (str_starts_with($term, 'actor:')) {

View File

@@ -1,11 +1,11 @@
{% import "/cards/macros/note/factory.html.twig" as NoteFactory %}
{# Backwards compatibility with hAtom 0.1 #}
{% if pinnednotes is not empty %}
{% if pinned_notes is not empty %}
<main class="feed pinned" tabindex="0" role="feed">
<h1>Pinned Notes</h1>
<div class="h-feed hfeed notes">
{% for conversation in pinnednotes %}
{% for conversation in pinned_notes %}
{% block current_note %}
{% if conversation is instanceof('array') %}
{% set args = conversation | merge({ 'type': 'vanilla_full', 'extra': { 'depth': 0 }}) %}