[COMPONENT][Search] Only display search subscribe field if a user is logged in

This commit is contained in:
Hugo Sales 2021-12-21 16:44:42 +00:00
parent af122df6e1
commit 012e0665b0
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 14 additions and 11 deletions

View File

@ -150,7 +150,8 @@ class Search extends FeedController
return [
'_template' => 'search/show.html.twig',
'search_form' => Comp\Search::searchForm($request, query: $q, add_subscribe: true),
'actor' => $actor,
'search_form' => Comp\Search::searchForm($request, query: $q, add_subscribe: !\is_null($actor)),
'search_builder_form' => $search_builder_form->createView(),
'notes' => $notes ?? [],
'actors' => $actors ?? [],

View File

@ -21,16 +21,18 @@
{{ form_row(search_form.search_query) }}
{{ form_row(search_form.submit_search) }}
</div>
<details class="section-widget">
<summary>
<h3>
{% trans %}Save this search as a feed{% endtrans %}
{{ icon('arrow-down', 'icon icon-details-open') | raw }}
</h3>
</summary>
{{ form_row(search_form.title) }}
{{ form_row(search_form.subscribe_to_search) }}
</details>
{% if actor is not null %}
<details class="section-widget">
<summary>
<h3>
{% trans %}Save this search as a feed{% endtrans %}
{{ icon('arrow-down', 'icon icon-details-open') | raw }}
</h3>
</summary>
{{ form_row(search_form.title) }}
{{ form_row(search_form.subscribe_to_search) }}
</details>
{% endif %}
{{ form_end(search_form)}}
<hr>
<details class="section-widget">