Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor OC\Server::getCommentsManager #40117

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/private/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use OC\Hooks\Emitter;
use OC_Helper;
use OCP\Accounts\IAccountManager;
use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Group\Events\BeforeUserRemovedEvent;
use OCP\Group\Events\UserRemovedEvent;
Expand Down Expand Up @@ -290,8 +291,8 @@ public function delete() {
// Delete the user's keys in preferences
\OC::$server->getConfig()->deleteAllUserValues($this->uid);

\OC::$server->getCommentsManager()->deleteReferencesOfActor('users', $this->uid);
\OC::$server->getCommentsManager()->deleteReadMarksFromUser($this);
\OC::$server->get(ICommentsManager::class)->deleteReferencesOfActor('users', $this->uid);
\OC::$server->get(ICommentsManager::class)->deleteReadMarksFromUser($this);

/** @var AvatarManager $avatarManager */
$avatarManager = \OCP\Server::get(AvatarManager::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Comments/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ public function testDeleteReferencesOfActorWithUserManagement() {
$user = \OC::$server->getUserManager()->createUser('xenia', '123456');
$this->assertTrue($user instanceof IUser);

$manager = \OC::$server->getCommentsManager();
$manager = \OC::$server->get(ICommentsManager::class);
$comment = $manager->create('users', $user->getUID(), 'files', 'file64');
$comment
->setMessage('Most important comment I ever left on the Internet.')
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use OC\App\AppStore\Fetcher\AppFetcher;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OCP\Comments\ICommentsManager;

/**
* Class Server
Expand Down Expand Up @@ -185,7 +186,7 @@ public function testOverwriteDefaultCommentsManager() {

$config->setSystemValue('comments.managerFactory', '\Test\Comments\FakeFactory');

$manager = $this->server->getCommentsManager();
$manager = $this->server->get(ICommentsManager::class);
$this->assertInstanceOf('\OCP\Comments\ICommentsManager', $manager);

$config->setSystemValue('comments.managerFactory', $defaultManagerFactory);
Expand Down
Loading