[CORE][Actor] Fix generic profile route
This commit is contained in:
parent
cee2d143c9
commit
b6ed0b4c6c
@ -188,6 +188,7 @@ class ActivityPub extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
switch ($route) {
|
||||
case 'actor_view_id':
|
||||
case 'person_actor_view_id':
|
||||
case 'person_actor_view_nickname':
|
||||
case 'group_actor_view_id':
|
||||
|
@ -23,23 +23,23 @@ declare(strict_types = 1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Core\Controller;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use Component\Collection\Util\Controller\FeedController;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ActorFeed extends FeedController
|
||||
class ActorProfile extends Controller
|
||||
{
|
||||
public function actorViewId(Request $request, int $id): RedirectResponse
|
||||
public function actorViewId(Request $request, int $id): array
|
||||
{
|
||||
$route_id = match (Actor::getById($id)->getType()) {
|
||||
$actor = Actor::getById($id);
|
||||
$route_id = match ($actor->getType()) {
|
||||
Actor::PERSON => 'person_actor_view_id',
|
||||
Actor::GROUP => 'group_actor_view_id',
|
||||
Actor::BOT => 'bot_actor_view_id',
|
||||
default => throw new InvalidArgumentException(),
|
||||
};
|
||||
return new RedirectResponse(Router::url($route_id, ['id' => $id]), status: 302);
|
||||
return ['_redirect' => Router::url($route_id, ['id' => $id]), 'actor' => $actor];
|
||||
}
|
||||
}
|
@ -44,6 +44,6 @@ abstract class Actor
|
||||
|
||||
public static function load(RouteLoader $r): void
|
||||
{
|
||||
$r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\ActorFeed::class, 'actorViewId']);
|
||||
$r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\ActorProfile::class, 'actorViewId']);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user