Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-08-27 20:54:20 +0300
committerJoas Schilling <coding@schilljs.com>2018-09-27 16:18:43 +0300
commit5237f4299f16df4a4fb5cde46cdc70373c3781d2 (patch)
tree9339f01595edb9205fbe4a7f02324ebd14eca973 /lib/Notification/Notifier.php
parent6ba97c9445e72cfec9b8f6437369fbc25e52e4b4 (diff)
Introduce Chat\MessageParser which dispatches an event for all apps
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r--lib/Notification/Notifier.php25
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php
index e485be7b4..2254524d1 100644
--- a/lib/Notification/Notifier.php
+++ b/lib/Notification/Notifier.php
@@ -23,8 +23,7 @@ declare(strict_types=1);
namespace OCA\Spreed\Notification;
-use OCA\Spreed\Chat\RichMessageHelper;
-use OCA\Spreed\Chat\SystemMessage\Parser;
+use OCA\Spreed\Chat\MessageParser;
use OCA\Spreed\Exceptions\RoomNotFoundException;
use OCA\Spreed\Manager;
use OCA\Spreed\Room;
@@ -56,11 +55,8 @@ class Notifier implements INotifier {
/** @var ICommentsManager */
protected $commentManager;
- /** @var RichMessageHelper */
- protected $richMessageHelper;
-
- /** @var Parser */
- protected $systemMessageParser;
+ /** @var MessageParser */
+ protected $messageParser;
/** @var Definitions */
protected $definitions;
@@ -70,16 +66,14 @@ class Notifier implements INotifier {
IUserManager $userManager,
Manager $manager,
ICommentsManager $commentManager,
- RichMessageHelper $richMessageHelper,
- Parser $systemMessageParser,
+ MessageParser $messageParser,
Definitions $definitions) {
$this->lFactory = $lFactory;
$this->url = $url;
$this->userManager = $userManager;
$this->manager = $manager;
$this->commentManager = $commentManager;
- $this->richMessageHelper = $richMessageHelper;
- $this->systemMessageParser = $systemMessageParser;
+ $this->messageParser = $messageParser;
$this->definitions = $definitions;
}
@@ -179,13 +173,8 @@ class Notifier implements INotifier {
throw new \InvalidArgumentException('Unknown comment');
}
- if ($comment->getVerb() === 'system') {
- $user = $this->userManager->get($notification->getUser());
- $this->systemMessageParser->setUserInfo($user, $l);
- list($richMessage, $richMessageParameters) = $this->systemMessageParser->parseMessage($comment);
- } else {
- list($richMessage, $richMessageParameters) = $this->richMessageHelper->getRichMessage($comment);
- }
+ $user = $this->userManager->get($notification->getUser());
+ list($richMessage, $richMessageParameters) = $this->messageParser->parseMessage($comment, $l, $user);
$placeholders = $replacements = [];
foreach ($richMessageParameters as $placeholder => $parameter) {