diff --git a/src/Controller/Network.php b/src/Controller/Network.php index 33abd01efe..7ea60dcbf3 100644 --- a/src/Controller/Network.php +++ b/src/Controller/Network.php @@ -141,8 +141,21 @@ END; public function actors(Request $request) { - return [ - '_template' => 'network/public.html.twig', - ]; + if (Common::isLoggedIn()) { + $user_id = Common::ensureLoggedIn()->getId(); + + return [ + '_template' => 'network/actors.html.twig', + 'actors' => DB::dql('select a from App\Entity\GSActor a ' . + 'where a.id != :id ' . + 'order by a.created DESC', ['id' => $user_id]), + ]; + } else { + return [ + '_template' => 'network/actors.html.twig', + 'actors' => DB::dql('select a from App\Entity\GSActor a ' . + 'order by a.created DESC'), + ]; + } } } diff --git a/src/Entity/GSActor.php b/src/Entity/GSActor.php index a75f6773d1..af4005e73f 100644 --- a/src/Entity/GSActor.php +++ b/src/Entity/GSActor.php @@ -24,6 +24,7 @@ namespace App\Entity; use App\Core\Cache; use App\Core\DB\DB; use App\Core\Entity; +use App\Core\Event; use App\Core\UserRoles; use DateTimeInterface; use Functional as F; @@ -204,6 +205,13 @@ class GSActor extends Entity // }}} Autocode + public function getAvatarUrl() + { + $url = null; + Event::handle('get_avatar_url', [$this->getNickname(), &$url]); + return $url; + } + public static function getFromId(int $id): ?self { return Cache::get('gsactor-id-' . $id, function () use ($id) { diff --git a/templates/network/actors.html.twig b/templates/network/actors.html.twig index 04ad8b45cc..b670e8afbb 100644 --- a/templates/network/actors.html.twig +++ b/templates/network/actors.html.twig @@ -25,9 +25,90 @@ {% endblock %} {% block body %} - - - +
{{ actor_bio }}
+ {% else %} +{{ '(No bio)' | trans }}
+ {% endif %} +