forked from GNUsocial/gnu-social
[EVENT][AddFeedActions] Add bool param which denotes whether the feed is empty. [PLUGIN][NoteTypeFeedFilter] Don't show filters if the feed is empty
This commit is contained in:
parent
d5a6fa924b
commit
8fa04bb47d
@ -14,7 +14,7 @@
|
|||||||
<h1>{{ page_title | trans }}</h1>
|
<h1>{{ page_title | trans }}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<nav class="feed-actions">
|
<nav class="feed-actions">
|
||||||
{% for block in handle_event('AddFeedActions', app.request) %}
|
{% for block in handle_event('AddFeedActions', app.request, notes is defined and notes is not empty) %}
|
||||||
{{ block | raw }}
|
{{ block | raw }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -124,8 +124,9 @@ class NoteTypeFeedFilter extends Plugin
|
|||||||
/**
|
/**
|
||||||
* Draw the media feed navigation.
|
* Draw the media feed navigation.
|
||||||
*/
|
*/
|
||||||
public function onAddFeedActions(Request $request, &$res): bool
|
public function onAddFeedActions(Request $request, bool $is_not_empty, &$res): bool
|
||||||
{
|
{
|
||||||
|
if ($is_not_empty) {
|
||||||
$qs = [];
|
$qs = [];
|
||||||
parse_str($request->getQueryString(), $qs);
|
parse_str($request->getQueryString(), $qs);
|
||||||
if (\array_key_exists('p', $qs) && \is_string($qs['p'])) {
|
if (\array_key_exists('p', $qs) && \is_string($qs['p'])) {
|
||||||
@ -155,6 +156,7 @@ class NoteTypeFeedFilter extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res[] = Formatting::twigRenderFile('NoteTypeFeedFilter/tabs.html.twig', ['tabs' => $tabs]);
|
$res[] = Formatting::twigRenderFile('NoteTypeFeedFilter/tabs.html.twig', ['tabs' => $tabs]);
|
||||||
|
}
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user