forked from GNUsocial/gnu-social
[PLUGINS][MediaFeed] Fixed template path typos
This commit is contained in:
parent
1e7a285ded
commit
f10b3bb05c
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
*
|
||||
* @package GNUsocial
|
||||
* @category Plugin
|
||||
*
|
||||
* @author Phablulo <phablulo@gmail.com>
|
||||
* @copyright 2018-2019, 2021 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
@ -31,11 +32,11 @@ declare(strict_types=1);
|
||||
namespace Plugin\MediaFeed;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Entity\Note;
|
||||
use Functional as F;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Formatting;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Formatting;
|
||||
use Functional as F;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class MediaFeed extends Plugin
|
||||
@ -47,19 +48,21 @@ class MediaFeed extends Plugin
|
||||
}
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the media feed navigation.
|
||||
* @return bool hook value; true means continue processing, false means stop.
|
||||
*
|
||||
* @return bool hook value; true means continue processing, false means stop
|
||||
*/
|
||||
public function onBeforeFeed(Request $request, &$res): bool
|
||||
{
|
||||
$isMediaActive = $request->get('filter-type') === 'media';
|
||||
// we need two urls: one with filter-type=media and without it.
|
||||
$query = strpos($request->getRequestUri(), '?');
|
||||
$query = mb_strpos($request->getRequestUri(), '?');
|
||||
$mediaURL = $request->getRequestUri() . ($query !== false ? '&' : '?') . 'filter-type=media';
|
||||
$allURL = $request->getPathInfo();
|
||||
if ($query !== false) {
|
||||
$params = explode('&', substr($request->getRequestUri(), $query + 1));
|
||||
$params = explode('&', mb_substr($request->getRequestUri(), $query + 1));
|
||||
$params = array_filter($params, fn ($s) => $s !== 'filter-type=media');
|
||||
$params = implode('&', $params);
|
||||
if ($params) {
|
||||
@ -67,7 +70,7 @@ class MediaFeed extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
$res[] = Formatting::twigRenderFile('mediaFeeed/tabs.html.twig', [
|
||||
$res[] = Formatting::twigRenderFile('mediaFeed/tabs.html.twig', [
|
||||
'main' => [
|
||||
'active' => !$isMediaActive,
|
||||
'url' => $isMediaActive ? $allURL : '',
|
||||
@ -75,10 +78,11 @@ class MediaFeed extends Plugin
|
||||
'media' => [
|
||||
'active' => $isMediaActive,
|
||||
'url' => $isMediaActive ? '' : $mediaURL,
|
||||
]
|
||||
],
|
||||
]);
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output our dedicated stylesheet
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user