Show the number of likes, comments and shares even if the user was not logged in

i didn't know how to call a commit in short
This commit is contained in:
Ilya Prokopenko 2022-07-22 15:40:56 +07:00
parent d1344d0cf8
commit 3775948df6
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56

View file

@ -59,12 +59,17 @@
</span> </span>
</div> </div>
</div> </div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu"> <div n:if="!($compact ?? false)" class="post-menu">
{if $post->canBeDeletedBy($thisUser) && !($forceNoDeleteLink ?? false)} {if is_null($thisUser)}
{var $forceNoDeleteLink = true}
{var $forceNoPinLink = true}
{/if}
{if !($forceNoDeleteLink ?? false) && $post->canBeDeletedBy($thisUser)}
<a href="/wall{$post->getPrettyId()}/delete">{_delete}</a> &nbsp;|&nbsp; <a href="/wall{$post->getPrettyId()}/delete">{_delete}</a> &nbsp;|&nbsp;
{/if} {/if}
{if $post->canBePinnedBy($thisUser) && !($forceNoPinLink ?? false)} {if !($forceNoPinLink ?? false) && $post->canBePinnedBy($thisUser)}
{if $post->isPinned()} {if $post->isPinned()}
<a href="/wall{$post->getPrettyId()}/pin?act=unpin&hash={rawurlencode($csrfToken)}">{_unpin}</a> <a href="/wall{$post->getPrettyId()}/pin?act=unpin&hash={rawurlencode($csrfToken)}">{_unpin}</a>
{else} {else}
@ -84,7 +89,7 @@
&nbsp;|&nbsp; &nbsp;|&nbsp;
{/if} {/if}
<a n:if="!($forceNoShareLink ?? false)" class="post-share-button" href="javascript:repostPost('{$post->getPrettyId()}', '{rawurlencode($csrfToken)}')"> <a n:if="!($forceNoShareLink ?? false)" class="post-share-button" {ifset $thisUser} href="javascript:repostPost('{$post->getPrettyId()}', '{rawurlencode($csrfToken)}')"{/ifset}>
{_share} {_share}
{if $post->getRepostCount() > 0} {if $post->getRepostCount() > 0}
(<b>{$post->getRepostCount()}</b>) (<b>{$post->getRepostCount()}</b>)
@ -92,11 +97,18 @@
</a> </a>
<div n:if="!($forceNoLike ?? false)" class="like_wrap"> <div n:if="!($forceNoLike ?? false)" class="like_wrap">
{var $liked = $post->hasLikeFrom($thisUser)} {ifset $thisUser}
<a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}" class="post-like-button" data-liked="{(int) $liked}" data-likes="{$post->getLikesCount()}"> {var $liked = $post->hasLikeFrom($thisUser)}
<div class="heart" id="{if $liked}liked{/if}"></div> <a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}" class="post-like-button" data-liked="{(int) $liked}" data-likes="{$post->getLikesCount()}">
<span class="likeCnt">{if $post->getLikesCount() > 0}{$post->getLikesCount()}{/if}</span> <div class="heart" id="{if $liked}liked{/if}"></div>
</a> <span class="likeCnt">{if $post->getLikesCount() > 0}{$post->getLikesCount()}{/if}</span>
</a>
{else}
<a n:if="$post->getLikesCount() > 0" class="post-like-button">
<div class="heart"></div>
<span class="likeCnt">{$post->getLikesCount()}</span>
</a>
{/ifset}
</div> </div>
</div> </div>
</td> </td>