Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/private/Comments/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,4 +523,23 @@

return $this;
}

public function jsonSerialize(): mixed {

Check failure on line 527 in lib/private/Comments/Comment.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

lib/private/Comments/Comment.php:527:2: MissingOverrideAttribute: Method OC\Comments\Comment::jsonserialize should have the "Override" attribute (see https://psalm.dev/358)
return [
'id' => $this->getId(),
'parent_id' => $this->getParentId(),
'top_parent_id' => $this->getTopmostParentId(),
'children_count' => $this->getChildrenCount(),
'message' => $this->getMessage(),
'actor_type' => $this->getActorType(),
'actor_id' => $this->getActorId(),
'object_type' => $this->getObjectType(),
'object_id' => $this->getObjectId(),
'reference_id' => $this->getReferenceId(),
'metadata' => $this->getMetaData(),
'creation_time' => $this->getCreationDateTime()->format(\DateTimeInterface::ATOM),
'reactions' => $this->getReactions(),
'expire_data' => $this->getExpireDate(),
];
}
}
9 changes: 8 additions & 1 deletion lib/public/Comments/CommentsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use OCP\AppFramework\Attribute\Consumable;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IWebhookCompatibleEvent;

/**
* Class CommentsEvent
Expand All @@ -19,7 +20,7 @@
* In the future, once the deprecated methods are removed, this class will be abstract.
*/
#[Consumable(since: '9.0.0')]
class CommentsEvent extends Event {
class CommentsEvent extends Event implements IWebhookCompatibleEvent {
/**
* @since 11.0.0
* @deprecated 33.0.0 Use \OCP\Comments\Events\CommentAddedEvent instead.
Expand Down Expand Up @@ -70,4 +71,10 @@
public function getComment(): IComment {
return $this->comment;
}

public function getWebhookSerializable(): array {

Check failure on line 75 in lib/public/Comments/CommentsEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-ocp

MissingOverrideAttribute

lib/public/Comments/CommentsEvent.php:75:2: MissingOverrideAttribute: Method OCP\Comments\CommentsEvent::getwebhookserializable should have the "Override" attribute (see https://psalm.dev/358)

Check failure on line 75 in lib/public/Comments/CommentsEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-ocp

InvalidDocblock

lib/public/Comments/CommentsEvent.php:75:2: InvalidDocblock: PHPDoc is required for methods in OCP. (see https://psalm.dev/008)

Check failure on line 75 in lib/public/Comments/CommentsEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

lib/public/Comments/CommentsEvent.php:75:2: MissingOverrideAttribute: Method OCP\Comments\CommentsEvent::getwebhookserializable should have the "Override" attribute (see https://psalm.dev/358)
return [
'comment' => $this->comment,
];
}
}
4 changes: 3 additions & 1 deletion lib/public/Comments/IComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

namespace OCP\Comments;

use JsonSerializable;

/**
* Interface IComment
*
* This class represents a comment
*
* @since 9.0.0
*/
interface IComment {
interface IComment extends JsonSerializable {
/**
* @since 9.0.0
*/
Expand Down
Loading