mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Move photo page url resolution to model
мб пофиксит 842 янеипу
This commit is contained in:
parent
5401871b38
commit
beb8b4eaa6
3 changed files with 10 additions and 3 deletions
|
@ -283,6 +283,14 @@ class Photo extends Media
|
||||||
return [$x, $y];
|
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
|
function getAlbum(): ?Album
|
||||||
{
|
{
|
||||||
return (new Albums)->getAlbumByPhotoId($this);
|
return (new Albums)->getAlbumByPhotoId($this);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{if $attachment instanceof \openvk\Web\Models\Entities\Photo}
|
{if $attachment instanceof \openvk\Web\Models\Entities\Photo}
|
||||||
{if !$attachment->isDeleted()}
|
{if !$attachment->isDeleted()}
|
||||||
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
|
<a href="{$attachment->getPageUrl()}">
|
||||||
<a href="{$link}">
|
|
||||||
<img class="media" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" />
|
<img class="media" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" />
|
||||||
</a>
|
</a>
|
||||||
{else}
|
{else}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{var $user = $notification->getModel(0)}
|
{var $user = $notification->getModel(0)}
|
||||||
{var $post = $notification->getModel(1)}
|
{var $post = $notification->getModel(1)}
|
||||||
|
|
||||||
{_nt_you_were_mentioned_u} <a href="{$user->getURL()}"><b>{$user->getCanonicalName()}</b></a> {$notification->getDateTime()} <a href="/photo{$post->getURL()}"><b>{_nt_mention_in_photo}</b></a>: "{$notification->getData()}"
|
{_nt_you_were_mentioned_u} <a href="{$user->getURL()}"><b>{$user->getCanonicalName()}</b></a> {$notification->getDateTime()} <a href="/photo{$post->getPageURL()}"><b>{_nt_mention_in_photo}</b></a>: "{$notification->getData()}"
|
||||||
|
|
Loading…
Reference in a new issue