mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +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
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Entities;
|
|
|
|
use App\Models\EpisodeModel;
|
|
use RuntimeException;
|
|
|
|
class Note extends \ActivityPub\Entities\Note
|
|
{
|
|
/**
|
|
* @var Episode|null
|
|
*/
|
|
protected $episode;
|
|
|
|
protected $casts = [
|
|
'id' => 'string',
|
|
'uri' => 'string',
|
|
'actor_id' => 'integer',
|
|
'in_reply_to_id' => '?string',
|
|
'reblog_of_id' => '?string',
|
|
'episode_id' => '?integer',
|
|
'message' => 'string',
|
|
'message_html' => 'string',
|
|
'favourites_count' => 'integer',
|
|
'reblogs_count' => 'integer',
|
|
'replies_count' => 'integer',
|
|
'created_by' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* Returns the note's attached episode
|
|
*
|
|
* @return \App\Entities\Episode
|
|
*/
|
|
public function getEpisode()
|
|
{
|
|
if (empty($this->episode_id)) {
|
|
throw new RuntimeException(
|
|
'Note must have an episode_id before getting episode.',
|
|
);
|
|
}
|
|
|
|
if (empty($this->episode)) {
|
|
$this->episode = (new EpisodeModel())->getEpisodeById(
|
|
$this->episode_id,
|
|
);
|
|
}
|
|
|
|
return $this->episode;
|
|
}
|
|
}
|