2021-08-13 11:07:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
/**
|
2022-02-19 16:06:11 +00:00
|
|
|
* @copyright 2021 Ad Aures
|
2021-08-13 11:07:29 +00:00
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Libraries;
|
|
|
|
|
2021-08-13 16:07:45 +00:00
|
|
|
use App\Entities\EpisodeComment;
|
2021-08-23 11:05:16 +00:00
|
|
|
use Modules\Fediverse\Core\ObjectType;
|
2021-08-13 11:07:29 +00:00
|
|
|
|
|
|
|
class CommentObject extends ObjectType
|
|
|
|
{
|
|
|
|
protected string $type = 'Note';
|
|
|
|
|
|
|
|
protected string $attributedTo;
|
|
|
|
|
|
|
|
protected string $inReplyTo;
|
|
|
|
|
|
|
|
protected string $replies;
|
|
|
|
|
2021-08-13 16:07:45 +00:00
|
|
|
public function __construct(EpisodeComment $comment)
|
2021-08-13 11:07:29 +00:00
|
|
|
{
|
|
|
|
$this->id = $comment->uri;
|
|
|
|
|
|
|
|
$this->content = $comment->message_html;
|
|
|
|
$this->published = $comment->created_at->format(DATE_W3C);
|
|
|
|
$this->attributedTo = $comment->actor->uri;
|
|
|
|
|
|
|
|
if ($comment->in_reply_to_id !== null) {
|
|
|
|
$this->inReplyTo = $comment->reply_to_comment->uri;
|
|
|
|
}
|
|
|
|
|
2021-10-13 15:43:40 +00:00
|
|
|
$this->replies = url_to(
|
|
|
|
'episode-comment-replies',
|
2022-03-04 14:33:48 +00:00
|
|
|
esc($comment->actor->username),
|
2021-10-13 15:43:40 +00:00
|
|
|
$comment->episode->slug,
|
|
|
|
$comment->id
|
|
|
|
);
|
2021-08-13 11:07:29 +00:00
|
|
|
|
|
|
|
$this->cc = [$comment->actor->followers_url];
|
|
|
|
}
|
|
|
|
}
|