mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-14 12:07: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
56
app/Models/PostModel.php
Normal file
56
app/Models/PostModel.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?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\Models;
|
||||
|
||||
use ActivityPub\Models\PostModel as ActivityPubPostModel;
|
||||
use App\Entities\Post;
|
||||
|
||||
class PostModel extends ActivityPubPostModel
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $returnType = Post::class;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'uri',
|
||||
'actor_id',
|
||||
'in_reply_to_id',
|
||||
'reblog_of_id',
|
||||
'episode_id',
|
||||
'message',
|
||||
'message_html',
|
||||
'favourites_count',
|
||||
'reblogs_count',
|
||||
'replies_count',
|
||||
'created_by',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* Retrieves all published posts for a given episode ordered by publication date
|
||||
*
|
||||
* @return Post[]
|
||||
*/
|
||||
public function getEpisodePosts(int $episodeId): array
|
||||
{
|
||||
return $this->where([
|
||||
'episode_id' => $episodeId,
|
||||
])
|
||||
->where('`published_at` <= NOW()', null, false)
|
||||
->orderBy('published_at', 'DESC')
|
||||
->findAll();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue