mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +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)
|
||||
{
|
||||
$disallowedTags = Tag::getIdsWhereCannot($actor, 'discussion.startWithoutApproval');
|
||||
static $disallowedTags;
|
||||
|
||||
if (! $disallowedTags) {
|
||||
$disallowedTags = Tag::getIdsWhereCannot($actor, 'discussion.startWithoutApproval');
|
||||
}
|
||||
|
||||
if (in_array($tag->id, $disallowedTags)) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user