mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-13 09:45:47 +00:00

- update CI process to include quality stage (tests + code review) - add captainhook to install git pre-commit & pre-push hooks - remove .devcontainer Dockerfile to use project's docker-compose services: all services can now be started automatically using vscode - update docs/setup-development.md
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* This class defines the Object which is the
|
|
* primary base type for the Activity Streams vocabulary.
|
|
*
|
|
* Object is a reserved word in php, so the class is named ObjectType.
|
|
*
|
|
* @copyright 2021 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace ActivityPub\Objects;
|
|
|
|
use ActivityPub\Entities\Note;
|
|
use ActivityPub\Core\ObjectType;
|
|
|
|
class NoteObject extends ObjectType
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $type = 'Note';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $attributedTo;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $inReplyTo;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $replies = [];
|
|
|
|
/**
|
|
* @param Note $note
|
|
*/
|
|
public function __construct($note)
|
|
{
|
|
$this->id = $note->uri;
|
|
|
|
$this->content = $note->message_html;
|
|
$this->published = $note->published_at->format(DATE_W3C);
|
|
$this->attributedTo = $note->actor->uri;
|
|
|
|
if ($note->is_reply) {
|
|
$this->inReplyTo = $note->reply_to_note->uri;
|
|
}
|
|
|
|
$this->replies = base_url(
|
|
route_to('note-replies', $note->actor->username, $note->id),
|
|
);
|
|
|
|
$this->cc = [$note->actor->followers_url];
|
|
}
|
|
}
|