diff options
author | Vitor Mattos <vitor@php.rio> | 2022-02-08 19:03:09 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-02-15 18:49:54 +0300 |
commit | 1a8f3f41cd9a421235ff7181835489a52c65992b (patch) | |
tree | a92e32bd90890187a03b37a8c0ee7c40ec335cf8 /lib | |
parent | 61f3e53fe5c54fc47b9f805049dce94cfa3d24c4 (diff) |
Fix typo and changes to use ReactionManager
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/ReactionManager.php | 2 | ||||
-rw-r--r-- | lib/Controller/ReactionController.php | 11 |
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/Chat/ReactionManager.php b/lib/Chat/ReactionManager.php index 03f0654d4..9c3b0ea78 100644 --- a/lib/Chat/ReactionManager.php +++ b/lib/Chat/ReactionManager.php @@ -130,7 +130,7 @@ class ReactionManager { public function getCommentToReact(Room $chat, string $messageId): IComment { if (!$this->commentsManager->supportReactions()) { - throw new NotFoundException('Reactions unsuported'); + throw new NotFoundException('Reactions unsupported'); } $comment = $this->commentsManager->get($messageId); diff --git a/lib/Controller/ReactionController.php b/lib/Controller/ReactionController.php index 285e3aa07..ca0de0331 100644 --- a/lib/Controller/ReactionController.php +++ b/lib/Controller/ReactionController.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace OCA\Talk\Controller; -use OCA\Talk\Chat\ChatManager; use OCA\Talk\Chat\ReactionManager; use OCA\Talk\Exceptions\ReactionAlreadyExistsException; use OCP\AppFramework\Http; @@ -34,17 +33,13 @@ use OCP\Comments\NotFoundException; use OCP\IRequest; class ReactionController extends AEnvironmentAwareController { - /** @var ChatManager */ - private $chatManager; /** @var ReactionManager */ private $reactionManager; public function __construct(string $appName, IRequest $request, - ChatManager $chatManager, ReactionManager $reactionManager) { parent::__construct($appName, $request); - $this->chatManager = $chatManager; $this->reactionManager = $reactionManager; } @@ -62,7 +57,7 @@ class ReactionController extends AEnvironmentAwareController { try { $chat = $this->getRoom(); $participant = $this->getParticipant(); - $parentMessage = $this->chatManager->getComment($chat, (string) $messageId); + $parentMessage = $this->reactionManager->getCommentToReact($chat, (string) $messageId); $this->reactionManager->addReactionMessage($chat, $participant, $parentMessage, $reaction); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); @@ -88,7 +83,7 @@ class ReactionController extends AEnvironmentAwareController { $participant = $this->getParticipant(); try { // Verify that messageId is part of the room - $this->chatManager->getComment($this->getRoom(), (string) $messageId); + $this->reactionManager->getCommentToReact($this->getRoom(), (string) $messageId); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } @@ -121,7 +116,7 @@ class ReactionController extends AEnvironmentAwareController { public function getReactions(int $messageId, ?string $reaction): DataResponse { try { // Verify that messageId is part of the room - $this->chatManager->getComment($this->getRoom(), (string) $messageId); + $this->reactionManager->getCommentToReact($this->getRoom(), (string) $messageId); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); } |