User, Group: Don't force a redirect to short URL

This behavior wasn't seen in VKontakte.
This commit is contained in:
Ilya Prokopenko 2022-07-11 19:07:49 +03:00
parent 5b5d095121
commit 65de19def1
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56
2 changed files with 4 additions and 11 deletions

View file

@ -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;
}
}

View file

@ -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);