diff options
author | Vincent Petry <vincent@nextcloud.com> | 2020-10-29 11:16:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 11:16:36 +0300 |
commit | fdf1c3cce10684df1b45be2a63e30611af7891ca (patch) | |
tree | 40043bb0a6b051ace756ba759987545dd3ff955f /lib | |
parent | 63ab1d621e9838c62acf68cece6b925a74707d4e (diff) | |
parent | 449c7d2222fa39f72d72ac8d2c5895e0dec1ae52 (diff) |
Merge pull request #4483 from nextcloud/techdebt/4481/always-commentsmanager-from-app
Always use CommentsManager from the app
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/AutoComplete/Sorter.php | 5 | ||||
-rw-r--r-- | lib/Chat/ChatManager.php | 2 | ||||
-rw-r--r-- | lib/Chat/Parser/UserMention.php | 8 | ||||
-rw-r--r-- | lib/Manager.php | 5 | ||||
-rw-r--r-- | lib/Notification/Notifier.php | 3 |
5 files changed, 16 insertions, 7 deletions
diff --git a/lib/Chat/AutoComplete/Sorter.php b/lib/Chat/AutoComplete/Sorter.php index 109c2206e..e7cb173df 100644 --- a/lib/Chat/AutoComplete/Sorter.php +++ b/lib/Chat/AutoComplete/Sorter.php @@ -23,15 +23,16 @@ declare(strict_types=1); namespace OCA\Talk\Chat\AutoComplete; -use OCP\Comments\ICommentsManager; +use OCA\Talk\Chat\CommentsManager; use OCP\Collaboration\AutoComplete\ISorter; +use OCP\Comments\ICommentsManager; class Sorter implements ISorter { /** @var ICommentsManager */ protected $commentsManager; - public function __construct(ICommentsManager $commentsManager) { + public function __construct(CommentsManager $commentsManager) { $this->commentsManager = $commentsManager; } diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index 4c6ba48a6..10214234b 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -59,7 +59,7 @@ class ChatManager { public const MAX_CHAT_LENGTH = 32000; - /** @var CommentsManager|ICommentsManager */ + /** @var ICommentsManager */ private $commentsManager; /** @var IEventDispatcher */ private $dispatcher; diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php index 38a20a2de..9f83f996e 100644 --- a/lib/Chat/Parser/UserMention.php +++ b/lib/Chat/Parser/UserMention.php @@ -38,7 +38,13 @@ use OCP\IUserManager; */ class UserMention { - /** @var ICommentsManager */ + /** + * Do NOT inject OCA\Talk\Chat\CommentsManager here + * otherwise the display name resolvers are lost + * and mentions are not replaced anymore. + * + * @var ICommentsManager + */ private $commentsManager; /** @var IUserManager */ private $userManager; diff --git a/lib/Manager.php b/lib/Manager.php index 5a4b81eb7..1314e6642 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; -use OCA\Talk\Chat\Changelog; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Events\CreateRoomTokenEvent; use OCA\Talk\Events\RoomEvent; @@ -31,6 +30,7 @@ use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Comments\IComment; +use OCP\Comments\ICommentsManager; use OCP\Comments\NotFoundException; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; @@ -54,7 +54,7 @@ class Manager { private $secureRandom; /** @var IUserManager */ private $userManager; - /** @var CommentsManager */ + /** @var ICommentsManager */ private $commentsManager; /** @var TalkSession */ private $talkSession; @@ -192,6 +192,7 @@ class Manager { } public function createCommentObject(array $row): ?IComment { + /** @psalm-suppress UndefinedInterfaceMethod */ return $this->commentsManager->getCommentFromData([ 'id' => $row['comment_id'], 'parent_id' => $row['comment_parent_id'], diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 2c5bd965b..a6a6e5be5 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -32,6 +32,7 @@ use OCA\Talk\GuestManager; use OCA\Talk\Manager; use OCA\Talk\Participant; use OCA\Talk\Room; +use OCP\Comments\ICommentsManager; use OCP\Comments\NotFoundException; use OCP\IL10N; use OCP\IURLGenerator; @@ -66,7 +67,7 @@ class Notifier implements INotifier { protected $manager; /** @var INotificationManager */ protected $notificationManager; - /** @var CommentsManager */ + /** @var ICommentsManager */ protected $commentManager; /** @var MessageParser */ protected $messageParser; |