From beb8b4eaa68fcd6f23c0d32fd017d8a16deec141 Mon Sep 17 00:00:00 2001 From: celestora Date: Sun, 29 Jan 2023 19:14:29 +0200 Subject: [PATCH] Move photo page url resolution to model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit мб пофиксит 842 янеипу --- Web/Models/Entities/Photo.php | 8 ++++++++ Web/Presenters/templates/components/attachment.xml | 3 +-- .../templates/components/notifications/4/_18_13_.xml | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Web/Models/Entities/Photo.php b/Web/Models/Entities/Photo.php index 4fd49c57..3c4db886 100644 --- a/Web/Models/Entities/Photo.php +++ b/Web/Models/Entities/Photo.php @@ -283,6 +283,14 @@ class Photo extends Media return [$x, $y]; } + function getPageURL(): string + { + if($this->isAnonymous()) + return "/photos/" . base_convert((string) $this->getId(), 10, 32); + + return "/photo" . $this->getPrettyId(); + } + function getAlbum(): ?Album { return (new Albums)->getAlbumByPhotoId($this); diff --git a/Web/Presenters/templates/components/attachment.xml b/Web/Presenters/templates/components/attachment.xml index 3f3161f3..3b5f9915 100644 --- a/Web/Presenters/templates/components/attachment.xml +++ b/Web/Presenters/templates/components/attachment.xml @@ -1,7 +1,6 @@ {if $attachment instanceof \openvk\Web\Models\Entities\Photo} {if !$attachment->isDeleted()} - {var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())} - + {$attachment->getDescription()} {else} diff --git a/Web/Presenters/templates/components/notifications/4/_18_13_.xml b/Web/Presenters/templates/components/notifications/4/_18_13_.xml index 69c2c422..0ae73bde 100644 --- a/Web/Presenters/templates/components/notifications/4/_18_13_.xml +++ b/Web/Presenters/templates/components/notifications/4/_18_13_.xml @@ -1,4 +1,4 @@ {var $user = $notification->getModel(0)} {var $post = $notification->getModel(1)} -{_nt_you_were_mentioned_u} {$user->getCanonicalName()} {$notification->getDateTime()} {_nt_mention_in_photo}: "{$notification->getData()}" +{_nt_you_were_mentioned_u} {$user->getCanonicalName()} {$notification->getDateTime()} {_nt_mention_in_photo}: "{$notification->getData()}"