Merge pull request #16822 from nextcloud/bugfix/fat-75/database-error-on-occ-scan-with-autotaggging
Only trigger the events with tags that where actually assigned
This commit is contained in:
commit
1d782aa13c
|
@ -154,20 +154,26 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
|
|||
'systemtagid' => $query->createParameter('tagid'),
|
||||
]);
|
||||
|
||||
$tagsAssigned = [];
|
||||
foreach ($tagIds as $tagId) {
|
||||
try {
|
||||
$query->setParameter('tagid', $tagId);
|
||||
$query->execute();
|
||||
$tagsAssigned[] = $tagId;
|
||||
} catch (UniqueConstraintViolationException $e) {
|
||||
// ignore existing relations
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($tagsAssigned)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(MapperEvent::EVENT_ASSIGN, new MapperEvent(
|
||||
MapperEvent::EVENT_ASSIGN,
|
||||
$objectType,
|
||||
$objId,
|
||||
$tagIds
|
||||
$tagsAssigned
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue