fix: event block rules not working with tags filters, see issue #8551

pull/8568/head
Luciano Righetti 2022-08-22 16:07:40 +02:00
parent 984a06f259
commit e991d0c8da
No known key found for this signature in database
GPG Key ID: CB91F2A37C557248
1 changed files with 4 additions and 4 deletions

View File

@ -3343,16 +3343,16 @@ class Event extends AppModel
if (empty($this->eventBlockRule)) {
return true;
}
if (!empty($rules['tags'])) {
if (!is_array($rules['tags'])) {
$rules['tags'] = [$rules['tags']];
if (!empty($this->eventBlockRule['tags'])) {
if (!is_array($this->eventBlockRule['tags'])) {
$this->eventBlockRule['tags'] = [$this->eventBlockRule['tags']];
}
$eventTags = Hash::extract($event, 'Event.Tag.{n}.name');
if (empty($eventTags)) {
$eventTags = Hash::extract($event, 'Event.EventTag.{n}.Tag.name');
}
if (!empty($eventTags)) {
foreach ($rules['tags'] as $blockTag) {
foreach ($this->eventBlockRule['tags'] as $blockTag) {
if (in_array($blockTag, $eventTags)) {
return false;
}