ViewPhoto: simplify filter verification
This commit is contained in:
@@ -50,13 +50,12 @@ class ViewPhoto extends HTMLController
|
||||
if (isset($_GET['by']))
|
||||
{
|
||||
// Let's first verify that the filter is valid
|
||||
$contributors = array_filter($tag->getContributorList(), fn($el) => $el['slug'] === $_GET['by']);
|
||||
if (count($contributors) !== 1)
|
||||
$user = Member::fromSlug($_GET['by']);
|
||||
if (!$user)
|
||||
throw new UnexpectedValueException('Invalid filter for this album or tag.');
|
||||
|
||||
// Alright, let's run with it then
|
||||
$filter = reset($contributors);
|
||||
$page->setActiveFilter($filter['slug']);
|
||||
$page->setActiveFilter($user->getSlug());
|
||||
}
|
||||
|
||||
$this->page->adopt($page);
|
||||
|
||||
Reference in New Issue
Block a user