refactor(comment): Port away from deprecated event comment constant
Create new events to replace deprecated CommentsEvent constant and use them when creating CommentsEvents. On the listener side, we can't yet use these events as deck still send the old events. Also fixes some issues reported by psalm level 3 on the comment app. Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>pull/56076/head
parent
86f0cbf1e8
commit
3c9b937e28
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OCP\Comments\Events;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
|
||||
/**
|
||||
* Class BeforeCommentAddedEvent
|
||||
*
|
||||
* @since 33.0.0
|
||||
*/
|
||||
#[Consumable(since: '33.0.0')]
|
||||
final class BeforeCommentUpdatedEvent extends CommentsEvent {
|
||||
/**
|
||||
* CommentEvent constructor.
|
||||
*/
|
||||
public function __construct(IComment $comment) {
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
parent::__construct(CommentsEvent::EVENT_PRE_UPDATE, $comment);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OCP\Comments\Events;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
|
||||
/**
|
||||
* Class CommentAddedEvent
|
||||
*
|
||||
* @since 33.0.0
|
||||
*/
|
||||
#[Consumable(since: '33.0.0')]
|
||||
final class CommentAddedEvent extends CommentsEvent {
|
||||
/**
|
||||
* CommentAddedEvent constructor.
|
||||
*/
|
||||
public function __construct(IComment $comment) {
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
parent::__construct(CommentsEvent::EVENT_ADD, $comment);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OCP\Comments\Events;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
|
||||
/**
|
||||
* Class CommentRemovedEvent
|
||||
*
|
||||
* @since 33.0.0
|
||||
*/
|
||||
#[Consumable(since: '33.0.0')]
|
||||
final class CommentDeletedEvent extends CommentsEvent {
|
||||
/**
|
||||
* CommentRemovedEvent constructor.
|
||||
*/
|
||||
public function __construct(IComment $comment) {
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
parent::__construct(CommentsEvent::EVENT_DELETE, $comment);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
namespace OCP\Comments\Events;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
|
||||
/**
|
||||
* Class CommentUpdatedEvent
|
||||
*
|
||||
* @since 33.0.0
|
||||
*/
|
||||
#[Consumable(since: '33.0.0')]
|
||||
final class CommentUpdatedEvent extends CommentsEvent {
|
||||
/**
|
||||
* CommentUpdatedEvent constructor.
|
||||
*/
|
||||
public function __construct(IComment $comment) {
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
parent::__construct(CommentsEvent::EVENT_UPDATE, $comment);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue