From 65de19def1c978111d7a1d7ce5621d2efaa7764e Mon Sep 17 00:00:00 2001 From: Ilya Prokopenko Date: Mon, 11 Jul 2022 19:07:49 +0300 Subject: [PATCH] User, Group: Don't force a redirect to short URL This behavior wasn't seen in VKontakte. --- Web/Presenters/GroupPresenter.php | 7 ++----- Web/Presenters/UserPresenter.php | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index c239ff22..101e71b3 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -22,15 +22,12 @@ final class GroupPresenter extends OpenVKPresenter if(!$club) { $this->notFound(); } else { - if($club->getShortCode()) - if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $club->getShortCode()) - $this->redirect("/" . $club->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT); - - $this->template->club = $club; $this->template->albums = (new Albums)->getClubAlbums($club, 1, 3); $this->template->albumsCount = (new Albums)->getClubAlbumsCount($club); $this->template->topics = (new Topics)->getLastTopics($club, 3); $this->template->topicsCount = (new Topics)->getClubTopicsCount($club); + + $this->template->club = $club; } } diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index cc39a0b5..48ffc417 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -33,13 +33,9 @@ final class UserPresenter extends OpenVKPresenter function renderView(int $id): void { $user = $this->users->get($id); - if(!$user || $user->isDeleted()) + if(!$user || $user->isDeleted()) { $this->template->_template = "User/deleted.xml"; - else { - if($user->getShortCode()) - if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode()) - $this->redirect("/" . $user->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT); - + } else { $this->template->albums = (new Albums)->getUserAlbums($user); $this->template->albumsCount = (new Albums)->getUserAlbumsCount($user); $this->template->videos = (new Videos)->getByUser($user, 1, 2);