From 0b864e85fd706997c3dbd2145680ef1d9cc86aae Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Tue, 1 Mar 2022 11:23:39 +0000 Subject: [PATCH] [TEMPLATES] Fixup uses of deprecated noteView, in favour of new NoteFactory facility --- components/Tag/templates/note_tag_feed.html.twig | 7 ++++--- plugins/PinnedNotes/templates/PinnedNotes/notes.html.twig | 7 ++++--- plugins/PinnedNotes/templates/PinnedNotes/toggle.html.twig | 7 ++++--- .../templates/tag_based_filtering/add_blocked.html.twig | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/components/Tag/templates/note_tag_feed.html.twig b/components/Tag/templates/note_tag_feed.html.twig index ad7855b2b6..a058ef0490 100644 --- a/components/Tag/templates/note_tag_feed.html.twig +++ b/components/Tag/templates/note_tag_feed.html.twig @@ -1,9 +1,9 @@ {% extends 'base.html.twig' %} -{% import '/cards/macros/note.html.twig' as noteView %} +{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% block stylesheets %} {{ parent() }} - + {% endblock stylesheets %} {% block body %} @@ -22,7 +22,8 @@ {% for note in results %} {% block current_note %} - {{ noteView.note_vanilla(note) }} + {% set args = { 'type': 'vanilla_full', 'note': note, 'extra': { 'depth': 0 } } %} + {{ NoteFactory.constructor(args) }} {% endblock current_note %} {% endfor %} diff --git a/plugins/PinnedNotes/templates/PinnedNotes/notes.html.twig b/plugins/PinnedNotes/templates/PinnedNotes/notes.html.twig index 2a19bec7ef..df4ad614cc 100644 --- a/plugins/PinnedNotes/templates/PinnedNotes/notes.html.twig +++ b/plugins/PinnedNotes/templates/PinnedNotes/notes.html.twig @@ -1,4 +1,4 @@ -{% import '/cards/macros/note.html.twig' as noteView %} +{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {# Backwards compatibility with hAtom 0.1 #} {% if pinnednotes is not empty %} @@ -8,11 +8,12 @@ {% for conversation in pinnednotes %} {% block current_note %} {% if conversation is instanceof('array') %} - {{ noteView.note_vanilla(conversation['note'], conversation['replies']) }} + {% set args = conversation | merge({ 'type': 'vanilla_full', 'extra': { 'depth': 0 }}) %} + {{ NoteFactory.constructor(args) }} {% else %} {{ noteView.note_vanilla(conversation) }} {% endif %} -
+
{% endblock current_note %} {% endfor %} diff --git a/plugins/PinnedNotes/templates/PinnedNotes/toggle.html.twig b/plugins/PinnedNotes/templates/PinnedNotes/toggle.html.twig index 7e670b8516..56980d052b 100644 --- a/plugins/PinnedNotes/templates/PinnedNotes/toggle.html.twig +++ b/plugins/PinnedNotes/templates/PinnedNotes/toggle.html.twig @@ -1,18 +1,19 @@ {% extends 'stdgrid.html.twig' %} -{% import "/cards/macros/note.html.twig" as noteView %} +{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% block title %}{{ title }}{% endblock %} {% block stylesheets %} {{ parent() }} - + {% endblock stylesheets %} {% block body %} {{ parent() }}
- {{ noteView.note_compact(note) }} + {% set args = { 'type': 'vanilla_full', 'note': note, 'extra': { 'depth': 0 } } %} + {{ NoteFactory.constructor(args) }} {{ form(toggle_form) }}
diff --git a/plugins/TagBasedFiltering/templates/tag_based_filtering/add_blocked.html.twig b/plugins/TagBasedFiltering/templates/tag_based_filtering/add_blocked.html.twig index 7d846895ab..d6a605f6a7 100644 --- a/plugins/TagBasedFiltering/templates/tag_based_filtering/add_blocked.html.twig +++ b/plugins/TagBasedFiltering/templates/tag_based_filtering/add_blocked.html.twig @@ -1,16 +1,17 @@ {% extends 'base.html.twig' %} -{% import '/cards/macros/note.html.twig' as noteView %} +{% import "/cards/macros/note/factory.html.twig" as NoteFactory %} {% block stylesheets %} {{ parent() }} - + {% endblock stylesheets %} {% block body %} {% if note is defined or actor is defined %}
{% if note is defined and note is not null %} - {{ noteView.note_vanilla(note, {}) }} + {% set args = { 'type': 'vanilla_full', 'note': note, 'extra': { 'depth': 0 } } %} + {{ NoteFactory.constructor(args) }} {% elseif actor is defined and actor is not null %} {% include 'cards/blocks/profile.html.twig' with {'actor': actor} only %} {% endif %}