mirror of
https://github.com/flarum/core.git
synced 2025-08-04 23:47:32 +02:00
Performance: Reuse list of disallowed tags
This commit is contained in:
@@ -29,7 +29,11 @@ class TagPolicy extends AbstractPolicy
|
|||||||
*/
|
*/
|
||||||
public function addToDiscussion(User $actor, Tag $tag)
|
public function addToDiscussion(User $actor, Tag $tag)
|
||||||
{
|
{
|
||||||
$disallowedTags = Tag::getIdsWhereCannot($actor, 'discussion.startWithoutApproval');
|
static $disallowedTags;
|
||||||
|
|
||||||
|
if (! $disallowedTags) {
|
||||||
|
$disallowedTags = Tag::getIdsWhereCannot($actor, 'discussion.startWithoutApproval');
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($tag->id, $disallowedTags)) {
|
if (in_array($tag->id, $disallowedTags)) {
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user