Compare commits

...

3 commits

Author SHA1 Message Date
celestora
aca48e726e 4 2023-01-29 19:16:10 +02:00
celestora
beb8b4eaa6 Move photo page url resolution to model
мб пофиксит 842 янеипу
2023-01-29 19:14:29 +02:00
celestora
5401871b38 name translit: Add global filter to leave CJK characters intact
Fixes #834
2023-01-29 18:57:19 +02:00
5 changed files with 13 additions and 4 deletions

2
.gitignore vendored
View file

@ -14,3 +14,5 @@ themepacks/*
!themepacks/midnight !themepacks/midnight
storage/* storage/*
!storage/.gitkeep !storage/.gitkeep
.idea

View file

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

View file

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

View file

@ -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()}"

View file

@ -1,5 +1,5 @@
"__locale" = "en_US.UTF-8;Eng"; "__locale" = "en_US.UTF-8;Eng";
"__transNames" = "Russian-Latin/BGN; Any-Latin"; "__transNames" = "[\P{script=Han}]; Russian-Latin/BGN; Any-Latin";
/* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */ /* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */