summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-08-21 11:58:27 +0200
committerJoas Schilling <coding@schilljs.com>2019-08-21 11:58:27 +0200
commit69f2974706c5582b449bd543c5c47bdfa11a9585 (patch)
tree6d4952155553f3b3b701032aa69a838d94ab361d
parentdd02920aedc63e89c8c8cf2e2c41344954bac08c (diff)
downloadnextcloud-server-69f2974706c5582b449bd543c5c47bdfa11a9585.tar.gz
nextcloud-server-69f2974706c5582b449bd543c5c47bdfa11a9585.zip
Only trigger the events with tags that where actually assigned
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/private/SystemTag/SystemTagObjectMapper.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php
index f8a1b03cd01..f1f39fd7d0a 100644
--- a/lib/private/SystemTag/SystemTagObjectMapper.php
+++ b/lib/private/SystemTag/SystemTagObjectMapper.php
@@ -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
));
}