mirror of
https://github.com/flarum/framework.git
synced 2025-03-15 00:05:12 +08:00
Performance: Reuse list of disallowed tags
This commit is contained in:
parent
f154c7cae6
commit
0479c03502
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user