diff --git a/components/Collection/Collection.php b/components/Collection/Collection.php new file mode 100644 index 0000000000..e642fb6872 --- /dev/null +++ b/components/Collection/Collection.php @@ -0,0 +1,11 @@ + $nickname]); - return self::collectionsListView($request, $user->getId(), $nickname); + return self::collectionsView($request, $user->getId(), $nickname); } - public function collectionsListViewByActorId(Request $request, int $id): array + public function collectionsViewByActorId(Request $request, int $id): array { - return self::collectionsListView($request, $id, null); + return self::collectionsView($request, $id, null); } /** @@ -73,12 +72,12 @@ abstract class CollectionController extends FeedController * * @return array twig template options */ - public function collectionsListView(Request $request, int $id, ?string $nickname): array + public function collectionsView(Request $request, int $id, ?string $nickname): array { - $collections = $this->getCollectionsBy($id); + $collections = $this->getCollectionsByActorId($id); - $create_title = _m('Create a ' . mb_strtolower(preg_replace( '/([a-z0-9])([A-Z])/', "$1 $2", $this->slug))); - $collections_title = _m('Your ' . mb_strtolower(preg_replace( '/([a-z0-9])([A-Z])/', "$1 $2", $this->plural_slug))); + $create_title = _m('Create a ' . mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1 $2', $this->slug))); + $collections_title = _m('Your ' . mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1 $2', $this->plural_slug))); // create collection form $create = null; if (Common::user()?->getId() === $id) { @@ -191,7 +190,7 @@ abstract class CollectionController extends FeedController }; return [ - '_template' => 'collections/collection_list_view.html.twig', + '_template' => 'collection/meta_collections.html.twig', 'page_title' => $this->page_title, 'list_title' => $collections_title, 'add_collection' => $create?->createView(), diff --git a/components/Collection/Util/Controller/OrderedCollection.php b/components/Collection/Util/Controller/OrderedCollection.php new file mode 100644 index 0000000000..7a61f1ab46 --- /dev/null +++ b/components/Collection/Util/Controller/OrderedCollection.php @@ -0,0 +1,9 @@ + _m('Add to ' . $this->plural_slug), 'user' => $user, diff --git a/plugins/Directory/templates/directory/actors.html.twig b/components/Collection/templates/collection/actors.html.twig similarity index 100% rename from plugins/Directory/templates/directory/actors.html.twig rename to components/Collection/templates/collection/actors.html.twig diff --git a/templates/collections/collection_entry_view.html.twig b/components/Collection/templates/collection/collection_entry_view.html.twig similarity index 87% rename from templates/collections/collection_entry_view.html.twig rename to components/Collection/templates/collection/collection_entry_view.html.twig index 3354d1f799..a0ddb84cd2 100644 --- a/templates/collections/collection_entry_view.html.twig +++ b/components/Collection/templates/collection/collection_entry_view.html.twig @@ -1,4 +1,4 @@ -{% extends '/feed/feed.html.twig' %} +{% extends '/collection/notes.html.twig' %} {% block title %}{{ page_title | trans }}{% endblock %} diff --git a/templates/collections/collection_list_view.html.twig b/components/Collection/templates/collection/meta_collections.html.twig similarity index 100% rename from templates/collections/collection_list_view.html.twig rename to components/Collection/templates/collection/meta_collections.html.twig diff --git a/components/Feed/templates/feed/feed.html.twig b/components/Collection/templates/collection/notes.html.twig similarity index 100% rename from components/Feed/templates/feed/feed.html.twig rename to components/Collection/templates/collection/notes.html.twig diff --git a/templates/collections/widget.html.twig b/components/Collection/templates/collection/widget_add_to.html.twig similarity index 100% rename from templates/collections/widget.html.twig rename to components/Collection/templates/collection/widget_add_to.html.twig diff --git a/components/Conversation/Controller/Conversation.php b/components/Conversation/Controller/Conversation.php index 15c50022fa..51a2679041 100644 --- a/components/Conversation/Controller/Conversation.php +++ b/components/Conversation/Controller/Conversation.php @@ -29,12 +29,12 @@ namespace Component\Conversation\Controller; use App\Core\DB\DB; use App\Core\Form; +use Component\Collection\Util\Controller\FeedController; use function App\Core\I18n\_m; use App\Util\Common; use App\Util\Exception\RedirectException; use Component\Conversation\Entity\ConversationBlock; use Component\Feed\Feed; -use Component\Feed\Util\FeedController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -50,7 +50,7 @@ class Conversation extends FeedController $data = Feed::query(query: "note-conversation:{$conversation_id}", page: $this->int('p') ?? 1); $notes = $data['notes']; return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'notes' => $notes, 'should_format' => false, 'page_title' => _m('Conversation'), diff --git a/components/Conversation/Controller/Reply.php b/components/Conversation/Controller/Reply.php index 62759ee885..d03be7a972 100644 --- a/components/Conversation/Controller/Reply.php +++ b/components/Conversation/Controller/Reply.php @@ -32,8 +32,8 @@ use App\Util\Exception\ClientException; use App\Util\Exception\NoLoggedInUser; use App\Util\Exception\NoSuchNoteException; use App\Util\Exception\ServerException; +use Component\Collection\Util\Controller\FeedController; use Component\Feed\Feed; -use Component\Feed\Util\FeedController; use Symfony\Component\HttpFoundation\Request; use function App\Core\I18n\_m; @@ -62,7 +62,7 @@ class Reply extends FeedController $data = Feed::query(query: "note-conversation:{$conversation_id}", page: $this->int('p') ?? 1); $notes = $data['notes']; return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'notes' => $notes, 'should_format' => false, 'page_title' => _m('Conversation'), diff --git a/components/Feed/Controller/Feeds.php b/components/Feed/Controller/Feeds.php index 77a64dfd79..5b0382df39 100644 --- a/components/Feed/Controller/Feeds.php +++ b/components/Feed/Controller/Feeds.php @@ -37,8 +37,8 @@ namespace Component\Feed\Controller; use function App\Core\I18n\_m; use App\Util\Common; +use Component\Collection\Util\Controller\FeedController; use Component\Feed\Feed; -use Component\Feed\Util\FeedController; use Symfony\Component\HttpFoundation\Request; class Feeds extends FeedController @@ -54,7 +54,7 @@ class Feeds extends FeedController language: Common::actor()?->getTopLanguage()?->getLocale(), ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m(\is_null(Common::user()) ? 'Feed' : 'Planet'), 'notes' => $data['notes'], ]; @@ -74,7 +74,7 @@ class Feeds extends FeedController actor: $actor, ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m('Home'), 'notes' => $data['notes'], ]; diff --git a/components/FreeNetwork/Controller/Feeds.php b/components/FreeNetwork/Controller/Feeds.php index 13f63c3452..8961a36f95 100644 --- a/components/FreeNetwork/Controller/Feeds.php +++ b/components/FreeNetwork/Controller/Feeds.php @@ -37,8 +37,8 @@ namespace Component\FreeNetwork\Controller; use App\Core\DB\DB; use function App\Core\I18n\_m; use App\Util\Common; +use Component\Collection\Util\Controller\FeedController; use Component\Feed\Feed; -use Component\Feed\Util\FeedController; use Symfony\Component\HttpFoundation\Request; class Feeds extends FeedController @@ -58,7 +58,7 @@ class Feeds extends FeedController language: Common::actor()?->getTopLanguage()?->getLocale(), ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m('Meteorites'), 'should_format' => true, 'notes' => $data['notes'], @@ -86,7 +86,7 @@ class Feeds extends FeedController EOF, ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m('Planetary System'), 'should_format' => true, 'notes' => $notes, @@ -107,7 +107,7 @@ class Feeds extends FeedController language: Common::actor()?->getTopLanguage()?->getLocale(), ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m('Galaxy'), 'should_format' => true, 'notes' => $data['notes'], diff --git a/components/Group/Controller/Group.php b/components/Group/Controller/Group.php index 7a841b016d..71e17ed97b 100644 --- a/components/Group/Controller/Group.php +++ b/components/Group/Controller/Group.php @@ -24,7 +24,6 @@ declare(strict_types = 1); namespace Component\Group\Controller; use App\Core\Cache; -use App\Core\Controller\ActorController; use App\Core\DB\DB; use App\Core\Form; use function App\Core\I18n\_m; @@ -36,13 +35,16 @@ use App\Util\Exception\ClientException; use App\Util\Exception\RedirectException; use App\Util\Form\ActorForms; use App\Util\Nickname; +use Component\Collection\Util\ActorControllerTrait; +use Component\Collection\Util\Controller\FeedController; use Component\Group\Entity\GroupMember; use Component\Group\Entity\LocalGroup; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; -class Group extends ActorController +class Group extends FeedController { + use ActorControllerTrait; public function groupViewId(Request $request, int $id) { return $this->handleActorById( diff --git a/components/Group/Group.php b/components/Group/Group.php index e1a2d15b36..61a9b31ac9 100644 --- a/components/Group/Group.php +++ b/components/Group/Group.php @@ -94,7 +94,7 @@ class Group extends Component $group = $this->getGroupFromContext($request); if (!\is_null($group)) { $nick = '!' . $group->getNickname(); - $targets[$nick] = $nick; + $targets[$nick] = $group->getId(); } return Event::next; } diff --git a/components/LeftPanel/Controller/EditFeeds.php b/components/LeftPanel/Controller/EditFeeds.php index 5e3ff39575..0735e651a6 100644 --- a/components/LeftPanel/Controller/EditFeeds.php +++ b/components/LeftPanel/Controller/EditFeeds.php @@ -33,7 +33,7 @@ use App\Entity\Feed; use App\Util\Common; use App\Util\Exception\ClientException; use App\Util\Exception\RedirectException; -use Component\Feed\Util\FeedController; +use Component\Collection\Util\Controller\FeedController; use Functional as F; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; diff --git a/components/Notification/Controller/Feed.php b/components/Notification/Controller/Feed.php index 171470359a..d0955e0fb7 100644 --- a/components/Notification/Controller/Feed.php +++ b/components/Notification/Controller/Feed.php @@ -57,7 +57,7 @@ class Feed extends Controller ) EOF, ['id' => $user->getId()]); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => _m('Notifications'), 'should_format' => true, 'notes' => $notes, diff --git a/components/Search/Controller/Search.php b/components/Search/Controller/Search.php index cd099b42fe..0d286be854 100644 --- a/components/Search/Controller/Search.php +++ b/components/Search/Controller/Search.php @@ -30,8 +30,8 @@ use App\Util\Exception\BugFoundException; use App\Util\Exception\RedirectException; use App\Util\Form\FormFields; use App\Util\Formatting; +use Component\Collection\Util\Controller\FeedController; use Component\Feed\Feed; -use Component\Feed\Util\FeedController; use Component\Search as Comp; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; diff --git a/components/Search/templates/search/show.html.twig b/components/Search/templates/search/show.html.twig index b1d9c5e8dc..aedb60c644 100644 --- a/components/Search/templates/search/show.html.twig +++ b/components/Search/templates/search/show.html.twig @@ -1,4 +1,4 @@ -{% extends 'feed/feed.html.twig' %} +{% extends 'collection/notes.html.twig' %} {% block body %} diff --git a/plugins/ActivityPub/Controller/Inbox.php b/plugins/ActivityPub/Controller/Inbox.php index 1da31c4922..eac213de43 100644 --- a/plugins/ActivityPub/Controller/Inbox.php +++ b/plugins/ActivityPub/Controller/Inbox.php @@ -165,7 +165,7 @@ class Inbox extends Controller $ap_actor->getActorId(), Discovery::normalize($actor->getNickname() . '@' . parse_url($ap_actor->getInboxUri(), PHP_URL_HOST)), ); - Event::handle('NewNotification', [$actor, $ap_act->getActivity(), [], _m('{nickname} mentioned you.', ['nickname' => $actor->getNickname()])]); + Event::handle('NewNotification', [$actor, $ap_act->getActivity(), [], _m('{nickname} mentioned you.', ['{nickname}' => $actor->getNickname()])]); DB::flush(); dd($ap_act, $act = $ap_act->getActivity(), $act->getActor(), $act->getObject()); diff --git a/plugins/ActorCircles/ActorCircles.php b/plugins/ActorCircles/ActorCircles.php index 8ad42a21a1..8e14f91d5a 100644 --- a/plugins/ActorCircles/ActorCircles.php +++ b/plugins/ActorCircles/ActorCircles.php @@ -34,18 +34,18 @@ namespace Plugin\ActorCircles; use App\Core\DB\DB; use App\Core\Event; use function App\Core\I18n\_m; -use App\Core\Modules\Collection; use App\Core\Router\RouteLoader; use App\Core\Router\Router; use App\Entity\Actor; use App\Entity\Feed; use App\Entity\LocalUser; use App\Util\Nickname; +use Component\Collection\Util\MetaCollectionPlugin; use Plugin\ActorCircles\Controller as C; use Plugin\ActorCircles\Entity as E; use Symfony\Component\HttpFoundation\Request; -class ActorCircles extends Collection +class ActorCircles extends MetaCollectionPlugin { protected string $slug = 'circle'; protected string $plural_slug = 'circles'; @@ -138,23 +138,23 @@ class ActorCircles extends Collection $r->connect( id: 'actor_circles_view_by_actor_id', uri_path: '/actor/{id<\d+>}/circles', - target: [C\Controller::class, 'collectionsViewByActorId'], + target: [C\Circles::class, 'collectionsViewByActorId'], ); $r->connect( id: 'actor_circles_view_by_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/circles', - target: [C\Controller::class, 'collectionsByActorNickname'], + target: [C\Circles::class, 'collectionsViewByActorNickname'], ); // View notes from a circle by actor id and nickname $r->connect( id: 'actor_circles_notes_view_by_actor_id', uri_path: '/actor/{id<\d+>}/circles/{cid<\d+>}', - target: [C\Controller::class, 'collectionNotesViewByActorId'], + target: [C\Circles::class, 'collectionsEntryViewNotesByActorId'], ); $r->connect( id: 'actor_circles_notes_view_by_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/circles/{cid<\d+>}', - target: [C\Controller::class, 'collectionNotesByNickname'], + target: [C\Circles::class, 'collectionsEntryViewNotesByNickname'], ); return Event::next; } diff --git a/plugins/ActorCircles/Controller/Controller.php b/plugins/ActorCircles/Controller/Circles.php similarity index 90% rename from plugins/ActorCircles/Controller/Controller.php rename to plugins/ActorCircles/Controller/Circles.php index 42a2bdea4a..5f86eafccc 100644 --- a/plugins/ActorCircles/Controller/Controller.php +++ b/plugins/ActorCircles/Controller/Circles.php @@ -23,12 +23,12 @@ declare(strict_types = 1); namespace Plugin\ActorCircles\Controller; -use App\Core\Controller\CollectionController; use App\Core\DB\DB; use App\Core\Router\Router; +use Component\Collection\Util\Controller\MetaCollectionController; use Plugin\ActorCircles\Entity\ActorCircles; -class Controller extends CollectionController +class Circles extends MetaCollectionController { protected string $slug = 'circle'; protected string $plural_slug = 'circles'; @@ -69,16 +69,16 @@ class Controller extends CollectionController ['circle_id' => $collection_id], ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'notes' => array_values($notes), ]; } - public function getCollectionsBy(int $owner_id): array + public function getCollectionsByActorId(int $owner_id): array { return DB::findBy(ActorCircles::class, ['actor_id' => $owner_id], order_by: ['id' => 'desc']); } public function getCollectionBy(int $owner_id, int $collection_id): ActorCircles { - return DB::findOneBy(ActorCircles::class, ['id' => $collection_id]); + return DB::findOneBy(ActorCircles::class, ['id' => $collection_id, 'actor_id' => $owner_id]); } } diff --git a/plugins/AttachmentCollections/AttachmentCollections.php b/plugins/AttachmentCollections/AttachmentCollections.php index a4cde8f3fa..0ae1b53b3e 100644 --- a/plugins/AttachmentCollections/AttachmentCollections.php +++ b/plugins/AttachmentCollections/AttachmentCollections.php @@ -33,20 +33,20 @@ namespace Plugin\AttachmentCollections; use App\Core\DB\DB; use App\Core\Event; -use App\Core\Modules\Collection; +use function App\Core\I18n\_m; use App\Core\Router\RouteLoader; use App\Core\Router\Router; use App\Entity\Actor; use App\Entity\Feed; use App\Entity\LocalUser; use App\Util\Nickname; +use Component\Collection\Util\MetaCollectionPlugin; use Plugin\AttachmentCollections\Controller\AttachmentCollections as AttachmentCollectionsController; use Plugin\AttachmentCollections\Entity\AttachmentCollection; use Plugin\AttachmentCollections\Entity\AttachmentCollectionEntry; use Symfony\Component\HttpFoundation\Request; -use function App\Core\I18n\_m; -class AttachmentCollections extends Collection +class AttachmentCollections extends MetaCollectionPlugin { protected function createCollection(Actor $owner, array $vars, string $name) { @@ -128,12 +128,12 @@ class AttachmentCollections extends Collection $r->connect( id: 'collections_view_by_actor_id', uri_path: '/actor/{id<\d+>}/collections', - target: [AttachmentCollectionsController::class, 'collectionsListViewByActorId'], + target: [AttachmentCollectionsController::class, 'collectionsViewByActorId'], ); $r->connect( id: 'collections_view_by_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/collections', - target: [AttachmentCollectionsController::class, 'collectionsListViewByActorNickname'], + target: [AttachmentCollectionsController::class, 'collectionsViewByActorNickname'], ); // View notes from a collection by actor id and nickname $r->connect( diff --git a/plugins/AttachmentCollections/Controller/AttachmentCollections.php b/plugins/AttachmentCollections/Controller/AttachmentCollections.php index 6844a010a0..9f86081c0c 100644 --- a/plugins/AttachmentCollections/Controller/AttachmentCollections.php +++ b/plugins/AttachmentCollections/Controller/AttachmentCollections.php @@ -23,12 +23,12 @@ declare(strict_types = 1); namespace Plugin\AttachmentCollections\Controller; -use App\Core\Controller\CollectionController; use App\Core\DB\DB; use App\Core\Router\Router; +use Component\Collection\Util\Controller\MetaCollectionController; use Plugin\AttachmentCollections\Entity\AttachmentCollection; -class AttachmentCollections extends CollectionController +class AttachmentCollections extends MetaCollectionController { public function createCollection(int $owner_id, string $name) { @@ -69,7 +69,7 @@ class AttachmentCollections extends CollectionController 'bare_notes' => array_values($notes), ]; } - public function getCollectionsBy(int $owner_id): array + public function getCollectionsByActorId(int $owner_id): array { return DB::findBy(AttachmentCollection::class, ['actor_id' => $owner_id], order_by: ['id' => 'desc']); } diff --git a/plugins/AttachmentCollections/templates/AttachmentCollections/collection_entry_view.html.twig b/plugins/AttachmentCollections/templates/AttachmentCollections/collection_entry_view.html.twig index ba5a29d8e1..30ae2d2dd1 100644 --- a/plugins/AttachmentCollections/templates/AttachmentCollections/collection_entry_view.html.twig +++ b/plugins/AttachmentCollections/templates/AttachmentCollections/collection_entry_view.html.twig @@ -1,4 +1,4 @@ -{% extends 'collections/collection_entry_view.html.twig' %} +{% extends 'collection/collection_entry_view.html.twig' %} {% block collection_items %} {% for key, attachment in attachments %} diff --git a/plugins/Directory/Controller/Directory.php b/plugins/Directory/Controller/Directory.php index 068e75dc70..550529658f 100644 --- a/plugins/Directory/Controller/Directory.php +++ b/plugins/Directory/Controller/Directory.php @@ -28,7 +28,7 @@ use function App\Core\I18n\_m; use App\Entity\Actor; use App\Util\Exception\BugFoundException; use App\Util\Exception\ClientException; -use Component\Feed\Util\FeedController; +use Component\Collection\Util\Controller\CircleController; use Symfony\Component\HttpFoundation\Request; class Directory extends FeedController @@ -144,7 +144,7 @@ class Directory extends FeedController } return [ - '_template' => 'directory/actors.html.twig', + '_template' => 'collection/actors.html.twig', 'actors' => $query_fn($actor_type), 'title' => $title, 'empty_message' => $empty_message, diff --git a/plugins/Favourite/Controller/Favourite.php b/plugins/Favourite/Controller/Favourite.php index ef23ee0d35..50e796c18e 100644 --- a/plugins/Favourite/Controller/Favourite.php +++ b/plugins/Favourite/Controller/Favourite.php @@ -35,7 +35,7 @@ use App\Util\Exception\NoLoggedInUser; use App\Util\Exception\NoSuchNoteException; use App\Util\Exception\RedirectException; use App\Util\Exception\ServerException; -use Component\Feed\Util\FeedController; +use Component\Collection\Util\Controller\FeedController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -174,7 +174,7 @@ class Favourite extends FeedController ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => 'Favourites feed.', 'notes' => $notes, ]; @@ -207,7 +207,7 @@ class Favourite extends FeedController ); return [ - '_template' => 'feed/feed.html.twig', + '_template' => 'collection/notes.html.twig', 'page_title' => 'Reverse favourites feed.', 'notes' => $notes, ]; diff --git a/plugins/NoteTypeFeedFilter/NoteTypeFeedFilter.php b/plugins/NoteTypeFeedFilter/NoteTypeFeedFilter.php index 6fd815933e..11898db361 100644 --- a/plugins/NoteTypeFeedFilter/NoteTypeFeedFilter.php +++ b/plugins/NoteTypeFeedFilter/NoteTypeFeedFilter.php @@ -43,6 +43,7 @@ use App\Util\Functional as GSF; use Functional as F; use Symfony\Component\HttpFoundation\Request; +// TODO: Migrate this to query filters class NoteTypeFeedFilter extends Plugin { public const ALLOWED_TYPES = ['media', 'link', 'text', 'tag']; diff --git a/src/Controller/Actor.php b/src/Controller/ActorFeed.php similarity index 90% rename from src/Controller/Actor.php rename to src/Controller/ActorFeed.php index 0a57560157..9dcd7ffe00 100644 --- a/src/Controller/Actor.php +++ b/src/Controller/ActorFeed.php @@ -23,12 +23,14 @@ declare(strict_types = 1); namespace App\Controller; -use App\Core\Controller\ActorController; use App\Entity as E; +use Component\Collection\Util\ActorControllerTrait; +use Component\Collection\Util\Controller\FeedController; use Symfony\Component\HttpFoundation\Request; -class Actor extends ActorController +class ActorFeed extends FeedController { + use ActorControllerTrait; public function actorViewId(Request $request, int $id) { return $this->handleActorById( diff --git a/src/Controller/Security.php b/src/Controller/Security.php index 49cb39098e..289fe3f8c0 100644 --- a/src/Controller/Security.php +++ b/src/Controller/Security.php @@ -163,7 +163,7 @@ class Security extends Controller $actor, $user, function (int $id) use ($user) { - // Self subscription + // Self subscription for the Home feed and alike DB::persist(Subscription::create(['subscriber_id' => $id, 'subscribed_id' => $id])); Feed::createDefaultFeeds($id, $user); }, diff --git a/src/Core/Controller.php b/src/Core/Controller.php index 87bc0c781f..69196d9b00 100644 --- a/src/Core/Controller.php +++ b/src/Core/Controller.php @@ -39,7 +39,7 @@ use App\Util\Exception\BugFoundException; use App\Util\Exception\ClientException; use App\Util\Exception\RedirectException; use App\Util\Exception\ServerException; -use Component\Feed\Util\FeedController; +use Component\Collection\Util\Controller\FeedController; use Exception; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/src/Routes/Actor.php b/src/Routes/Actor.php index 9474e6e357..638e707f5d 100644 --- a/src/Routes/Actor.php +++ b/src/Routes/Actor.php @@ -45,7 +45,7 @@ abstract class Actor public static function load(RouteLoader $r): void { - $r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\Actor::class, 'actorViewId']); - $r->connect(id: 'actor_view_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\Actor::class, 'actorViewNickname'], options: ['is_system_path' => false]); + $r->connect(id: 'actor_view_id', uri_path: '/actor/{id<\d+>}', target: [C\ActorFeed::class, 'actorViewId']); + $r->connect(id: 'actor_view_nickname', uri_path: '/@{nickname<' . Nickname::DISPLAY_FMT . '>}', target: [C\ActorFeed::class, 'actorViewNickname'], options: ['is_system_path' => false]); } } diff --git a/templates/actor/view.html.twig b/templates/actor/view.html.twig index 9ed7fcb034..6ccbff47d7 100644 --- a/templates/actor/view.html.twig +++ b/templates/actor/view.html.twig @@ -1,4 +1,4 @@ -{% extends 'feed/feed.html.twig' %} +{% extends 'collection/notes.html.twig' %} {% block title %}{% trans %}%nickname%'s profile{% endtrans %}{% endblock %} diff --git a/tests/Controller/FeedsTest.php b/tests/Controller/FeedsTest.php index 7a395227ab..e1cc06e646 100644 --- a/tests/Controller/FeedsTest.php +++ b/tests/Controller/FeedsTest.php @@ -78,7 +78,7 @@ class FeedsTest extends GNUsocialTestCase static::assertThrows(ClientException::class, fn () => $feeds->home($req)); } $result = $feeds->{$route}($req, ...$extra_args); - static::assertSame($result['_template'], 'feed/feed.html.twig'); + static::assertSame($result['_template'], 'collection/notes.html.twig'); foreach ($result['notes'] as $n) { static::assertIsArray($n['replies']); }