Groups: Do not show group pin button in group list when the group cannot be pinned

This commit is contained in:
Maxim Leshchenko 2021-12-24 22:08:03 +02:00
parent b765038bc3
commit 948719ec3d
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
2 changed files with 7 additions and 5 deletions

View file

@ -540,6 +540,8 @@ class User extends RowModel
$manager = $club->getManager($this); $manager = $club->getManager($this);
if(!is_null($manager)) if(!is_null($manager))
return $manager->isClubPinned(); return $manager->isClubPinned();
return false;
} }
function getMeetings(int $page = 1): \Traversable function getMeetings(int $page = 1): \Traversable

View file

@ -51,9 +51,9 @@
{$x->getDescription()} {$x->getDescription()}
{/block} {/block}
{var clubPinned = $thisUser->isClubPinned($x)} {block actions}
{if $x->canBeModifiedBy($thisUser ?? NULL) || $clubPinned || $thisUser->getPinnedClubCount() <= 10} {var clubPinned = $thisUser->isClubPinned($x)}
{block actions} {if $x->canBeModifiedBy($thisUser ?? NULL) && ($clubPinned || $thisUser->getPinnedClubCount() <= 10)}
<a class="profile_link" href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}"> <a class="profile_link" href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}">
{if $clubPinned} {if $clubPinned}
{_remove_from_left_menu} {_remove_from_left_menu}
@ -61,5 +61,5 @@
{_add_to_left_menu} {_add_to_left_menu}
{/if} {/if}
</a> </a>
{/block} {/if}
{/if} {/block}