diff options
author | grnd-alt <salimbelakkaf@outlook.de> | 2024-11-18 13:59:53 +0100 |
---|---|---|
committer | grnd-alt <salimbelakkaf@outlook.de> | 2024-12-03 20:56:36 +0100 |
commit | 8d953aeb8de809aab95371b2af1ef04e9d9d099f (patch) | |
tree | adbd29882ed266c6bf03ca5f5e63f945cdd21825 /apps | |
parent | 2d02d835978a82bcff4845adc702d8033b4fcb60 (diff) | |
download | nextcloud-server-8d953aeb8de809aab95371b2af1ef04e9d9d099f.tar.gz nextcloud-server-8d953aeb8de809aab95371b2af1ef04e9d9d099f.zip |
refactor(tags): move favorite event dispatching to tags.php
Signed-off-by: grnd-alt <salimbelakkaf@outlook.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/TagsPlugin.php | 4 | ||||
-rw-r--r-- | apps/files/lib/AppInfo/Application.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Service/TagService.php | 10 | ||||
-rw-r--r-- | apps/files/tests/Service/TagServiceTest.php | 1 |
4 files changed, 0 insertions, 17 deletions
diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index f70706c1d47..eb06fa5cef6 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -28,8 +28,6 @@ namespace OCA\DAV\Connector\Sabre; * */ use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\Events\NodeAddedToFavorite; -use OCP\Files\Events\NodeRemovedFromFavorite; use OCP\ITagManager; use OCP\ITags; use OCP\IUserSession; @@ -260,10 +258,8 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { $propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node, $path) { if ((int)$favState === 1 || $favState === 'true') { $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE); - $this->eventDispatcher->dispatchTyped(new NodeAddedToFavorite($this->userSession->getUser(), $node->getId(), $path)); } else { $this->getTagger()->unTag($node->getId(), self::TAG_FAVORITE); - $this->eventDispatcher->dispatchTyped(new NodeRemovedFromFavorite($this->userSession->getUser(), $node->getId(), $path)); } if (is_null($favState)) { diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 04a1434adec..84387983946 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -35,7 +35,6 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\Collaboration\Reference\RenderReferenceEvent; use OCP\Collaboration\Resources\IProviderManager; -use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Cache\CacheEntryRemovedEvent; use OCP\Files\Events\Node\BeforeNodeCopiedEvent; use OCP\Files\Events\Node\BeforeNodeDeletedEvent; @@ -100,7 +99,6 @@ class Application extends App implements IBootstrap { $c->get(IActivityManager::class), $c->get(ITagManager::class)->load(self::APP_ID), $server->getUserFolder(), - $c->get(IEventDispatcher::class), ); }); diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index abae26f91a6..63c54d01fd0 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -8,9 +8,6 @@ namespace OCA\Files\Service; use OCP\Activity\IManager; -use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\Events\NodeAddedToFavorite; -use OCP\Files\Events\NodeRemovedFromFavorite; use OCP\Files\Folder; use OCP\Files\NotFoundException; use OCP\ITags; @@ -26,7 +23,6 @@ class TagService { private IManager $activityManager, private ?ITags $tagger, private ?Folder $homeFolder, - private IEventDispatcher $dispatcher, ) { } @@ -58,16 +54,10 @@ class TagService { $newTags = array_diff($tags, $currentTags); foreach ($newTags as $tag) { - if ($tag === ITags::TAG_FAVORITE) { - $this->dispatcher->dispatchTyped(new NodeAddedToFavorite($this->userSession->getUser(), $fileId, $path)); - } $this->tagger->tagAs($fileId, $tag); } $deletedTags = array_diff($currentTags, $tags); foreach ($deletedTags as $tag) { - if ($tag === ITags::TAG_FAVORITE) { - $this->dispatcher->dispatchTyped(new NodeRemovedFromFavorite($this->userSession->getUser(), $fileId, $path)); - } $this->tagger->unTag($fileId, $tag); } diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index 68a9ec86cb4..a05025e98e1 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -91,7 +91,6 @@ class TagServiceTest extends \Test\TestCase { $this->activityManager, $this->tagger, $this->root, - $this->dispatcher, ]) ->setMethods($methods) ->getMock(); |