2016-02-05 04:45:16 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2016-02-05 04:45:16 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-02-05 04:45:16 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Comments;
|
|
|
|
|
|
2025-10-29 05:44:33 -04:00
|
|
|
use OCP\AppFramework\Attribute\Consumable;
|
2019-10-16 06:36:03 -04:00
|
|
|
use OCP\EventDispatcher\Event;
|
2016-02-05 04:45:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class CommentsEvent
|
|
|
|
|
*
|
|
|
|
|
* @since 9.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
*
|
|
|
|
|
* In the future, once the deprecated methods are removed, this class will be abstract.
|
2016-02-05 04:45:16 -05:00
|
|
|
*/
|
2025-10-29 05:44:33 -04:00
|
|
|
#[Consumable(since: '9.0.0')]
|
2016-02-05 04:45:16 -05:00
|
|
|
class CommentsEvent extends Event {
|
2021-02-09 07:53:41 -05:00
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 11.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
* @deprecated 33.0.0 Use \OCP\Comments\Events\CommentAddedEvent instead.
|
2021-02-09 07:53:41 -05:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const EVENT_ADD = 'OCP\Comments\ICommentsManager::addComment';
|
2021-02-09 07:53:41 -05:00
|
|
|
|
|
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 11.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
* @deprecated 33.0.0 Use \OCP\Comments\Events\BeforeCommentUpdatedEvent instead.
|
2021-02-09 07:53:41 -05:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const EVENT_PRE_UPDATE = 'OCP\Comments\ICommentsManager::preUpdateComment';
|
2021-02-09 07:53:41 -05:00
|
|
|
|
|
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 11.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
* @deprecated 33.0.0 Use \OCP\Comments\Events\CommentUpdatedEvent instead.
|
2021-02-09 07:53:41 -05:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const EVENT_UPDATE = 'OCP\Comments\ICommentsManager::updateComment';
|
2021-02-09 07:53:41 -05:00
|
|
|
|
|
|
|
|
/**
|
2024-02-14 14:48:27 -05:00
|
|
|
* @since 11.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
* @deprecated 33.0.0 Use \OCP\Comments\Events\CommentDeletedEvent instead.
|
2021-02-09 07:53:41 -05:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const EVENT_DELETE = 'OCP\Comments\ICommentsManager::deleteComment';
|
2016-02-05 04:45:16 -05:00
|
|
|
|
|
|
|
|
/**
|
2025-10-29 05:44:33 -04:00
|
|
|
* CommentsEvent constructor.
|
2016-02-05 04:45:16 -05:00
|
|
|
*
|
2016-02-24 06:42:34 -05:00
|
|
|
* @since 9.0.0
|
2016-02-05 04:45:16 -05:00
|
|
|
*/
|
2025-10-29 05:44:33 -04:00
|
|
|
public function __construct(
|
|
|
|
|
protected readonly string $event,
|
|
|
|
|
protected readonly IComment $comment,
|
|
|
|
|
) {
|
|
|
|
|
parent::__construct();
|
2016-02-05 04:45:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 9.0.0
|
2025-10-29 05:44:33 -04:00
|
|
|
* @depreacted Since 33.0.0 use instanceof CommentAddedEvent, CommentRemovedEvent, CommentUpdatedEvent or BeforeCommentUpdatedEvent instead.
|
2016-02-05 04:45:16 -05:00
|
|
|
*/
|
2025-10-29 05:44:33 -04:00
|
|
|
public function getEvent(): string {
|
2016-02-05 04:45:16 -05:00
|
|
|
return $this->event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
2025-10-29 05:44:33 -04:00
|
|
|
public function getComment(): IComment {
|
2016-02-05 04:45:16 -05:00
|
|
|
return $this->comment;
|
|
|
|
|
}
|
|
|
|
|
}
|