Skip to content

Commit

Permalink
fix: Fix Event and Notification creation with the new required parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Sep 17, 2024
1 parent 295eee6 commit 117c7ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
32 changes: 8 additions & 24 deletions lib/private/Activity/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
use OCP\RichObjectStrings\IRichTextFormatter;
use OCP\RichObjectStrings\IValidator;

class Manager implements IManager {
/** @var IRequest */
protected $request;

/** @var IUserSession */
protected $session;

/** @var IConfig */
protected $config;

/** @var IValidator */
protected $validator;

/** @var string */
protected $formattingObjectType;
Expand All @@ -48,20 +38,14 @@ class Manager implements IManager {
/** @var string */
protected $currentUserId;

protected $l10n;

public function __construct(
IRequest $request,
IUserSession $session,
IConfig $config,
IValidator $validator,
IL10N $l10n
protected IRequest $request,
protected IUserSession $session,
protected IConfig $config,
protected IValidator $validator,
protected IRichTextFormatter $richTextFormatter,
protected IL10N $l10n,
) {
$this->request = $request;
$this->session = $session;
$this->config = $config;
$this->validator = $validator;
$this->l10n = $l10n;
}

/** @var \Closure[] */
Expand Down Expand Up @@ -104,7 +88,7 @@ protected function getConsumers(): array {
* @return IEvent
*/
public function generateEvent(): IEvent {
return new Event($this->validator);
return new Event($this->validator, $this->richTextFormatter);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion lib/private/Notification/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use OCP\Notification\UnknownNotificationException;
use OCP\RichObjectStrings\IRichTextFormatter;
use OCP\RichObjectStrings\IValidator;
use OCP\Support\Subscription\IRegistry;
use Psr\Container\ContainerExceptionInterface;
Expand Down Expand Up @@ -55,6 +56,7 @@ public function __construct(
protected IRegistry $subscription,
protected LoggerInterface $logger,
private Coordinator $coordinator,
private IRichTextFormatter $richTextFormatter,
) {
$this->cache = $cacheFactory->createDistributed('notifications');

Expand Down Expand Up @@ -199,7 +201,7 @@ public function getNotifiers(): array {
* @since 8.2.0
*/
public function createNotification(): INotification {
return new Notification($this->validator);
return new Notification($this->validator, $this->richTextFormatter);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
use OCP\Profiler\IProfiler;
use OCP\Remote\Api\IApiFactory;
use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IRichTextFormatter;
use OCP\RichObjectStrings\IValidator;
use OCP\Route\IRouter;
use OCP\Security\Bruteforce\IThrottler;
Expand Down Expand Up @@ -648,6 +649,7 @@ public function __construct($webRoot, \OC\Config $config) {
$c->get(IUserSession::class),
$c->get(\OCP\IConfig::class),
$c->get(IValidator::class),
$c->get(IRichTextFormatter::class),
$l10n
);
});
Expand Down Expand Up @@ -1285,7 +1287,7 @@ public function __construct($webRoot, \OC\Config $config) {

$this->registerAlias(\OCP\Security\Ip\IFactory::class, \OC\Security\Ip\Factory::class);

$this->registerAlias(\OCP\RichObjectStrings\IRichTextFormatter::class, \OC\RichObjectStrings\RichTextFormatter::class);
$this->registerAlias(IRichTextFormatter::class, \OC\RichObjectStrings\RichTextFormatter::class);

$this->connectDispatcher();
}
Expand Down

0 comments on commit 117c7ee

Please sign in to comment.