diff options
author | Joas Schilling <coding@schilljs.com> | 2019-08-21 11:58:27 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-08-21 11:58:27 +0200 |
commit | 69f2974706c5582b449bd543c5c47bdfa11a9585 (patch) | |
tree | 6d4952155553f3b3b701032aa69a838d94ab361d | |
parent | dd02920aedc63e89c8c8cf2e2c41344954bac08c (diff) | |
download | nextcloud-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.php | 8 |
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 )); } |