mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:53:27 +08:00
Performance: Reuse list of disallowed tags
This commit is contained in:
parent
910ddc9f55
commit
6f07aef206
@ -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