mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-15 12:37:46 +02:00
feat(comments): add comments to episodes + update naming of status to post
- remove confusing counts for episode (total favourites, total reblogs) - add comments section to episode page to display episode comments + post replies linked to the episode
This commit is contained in:
parent
3ff1364906
commit
bb4752c35e
86 changed files with 1667 additions and 1152 deletions
42
app/Libraries/CommentObject.php
Normal file
42
app/Libraries/CommentObject.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
* @link https://castopod.org/
|
||||
*/
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
use ActivityPub\Core\ObjectType;
|
||||
use App\Entities\Comment;
|
||||
|
||||
class CommentObject extends ObjectType
|
||||
{
|
||||
protected string $type = 'Note';
|
||||
|
||||
protected string $attributedTo;
|
||||
|
||||
protected string $inReplyTo;
|
||||
|
||||
protected string $replies;
|
||||
|
||||
public function __construct(Comment $comment)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
$this->replies = url_to('comment-replies', $comment->actor->username, $comment->episode->slug, $comment->id);
|
||||
|
||||
$this->cc = [$comment->actor->followers_url];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue