fix(activity-pub): get database records using new model instances

update types and some remap logic
This commit is contained in:
Yassine Doghri 2021-06-09 12:40:22 +00:00
parent 4a28127bc4
commit 92536ddb38
No known key found for this signature in database
GPG Key ID: 3E7F89498B960C9F
56 changed files with 204 additions and 191 deletions

View File

@ -34,7 +34,7 @@ class PermissionModel extends MythAuthPermissionModel
$groupPermissions = $this->db $groupPermissions = $this->db
->table('auth_groups_permissions') ->table('auth_groups_permissions')
->select('id, auth_permissions.name') ->select('id, auth_permissions.name')
->join('auth_permissions', 'auth_permissions.id = permission_id', 'inner',) ->join('auth_permissions', 'auth_permissions.id = permission_id', 'inner')
->where('group_id', $groupId) ->where('group_id', $groupId)
->get() ->get()
->getResultObject(); ->getResultObject();

View File

@ -123,7 +123,7 @@ Events::on('on_undo_follow', function ($actor, $targetActor): void {
* @param Note $note * @param Note $note
*/ */
Events::on('on_note_add', function ($note): void { Events::on('on_note_add', function ($note): void {
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
$note = $note->reply_to_note; $note = $note->reply_to_note;
} }
@ -147,7 +147,7 @@ Events::on('on_note_add', function ($note): void {
* @param Note $note * @param Note $note
*/ */
Events::on('on_note_remove', function ($note): void { Events::on('on_note_remove', function ($note): void {
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
Events::trigger('on_note_remove', $note->reply_to_note); Events::trigger('on_note_remove', $note->reply_to_note);
} }
@ -207,7 +207,7 @@ Events::on('on_note_reblog', function ($actor, $note): void {
cache() cache()
->deleteMatching("page_note#{$note->id}*"); ->deleteMatching("page_note#{$note->id}*");
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}"); cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
} }
}); });
@ -239,7 +239,7 @@ Events::on('on_note_undo_reblog', function ($reblogNote): void {
cache() cache()
->deleteMatching("page_note#{$reblogNote->id}*"); ->deleteMatching("page_note#{$reblogNote->id}*");
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}"); cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
} }
@ -308,7 +308,7 @@ Events::on('on_note_favourite', function ($actor, $note): void {
cache() cache()
->deleteMatching("page_note#{$note->id}*"); ->deleteMatching("page_note#{$note->id}*");
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}*"); cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
} }
@ -340,7 +340,7 @@ Events::on('on_note_undo_favourite', function ($actor, $note): void {
cache() cache()
->deleteMatching("page_note#{$note->id}*"); ->deleteMatching("page_note#{$note->id}*");
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}*"); cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
} }

View File

@ -27,19 +27,24 @@ class ContributorController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
$this->podcast = (new PodcastModel())->getPodcastById((int) $params[0]); if (count($params) === 0) {
throw PageNotFoundException::forPageNotFound();
if (count($params) <= 1) {
return $this->{$method}();
} }
if (($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) === null) {
throw PageNotFoundException::forPageNotFound();
}
$this->podcast = $podcast;
if ( if (
($this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0],)) !== null count($params) > 1 &&
($this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0])) === null
) { ) {
return $this->{$method}(); throw PageNotFoundException::forPageNotFound();
} }
throw PageNotFoundException::forPageNotFound(); return $this->{$method}();
} }
public function list(): string public function list(): string
@ -57,7 +62,7 @@ class ContributorController extends BaseController
public function view(): string public function view(): string
{ {
$data = [ $data = [
'contributor' => (new UserModel())->getPodcastContributor($this->user->id, $this->podcast->id,), 'contributor' => (new UserModel())->getPodcastContributor($this->user->id, $this->podcast->id),
]; ];
replace_breadcrumb_params([ replace_breadcrumb_params([
@ -173,7 +178,7 @@ class ContributorController extends BaseController
$podcastModel = new PodcastModel(); $podcastModel = new PodcastModel();
if ( if (
! $podcastModel->removePodcastContributor($this->user->id, $this->podcast->id,) ! $podcastModel->removePodcastContributor($this->user->id, $this->podcast->id)
) { ) {
return redirect() return redirect()
->back() ->back()

View File

@ -33,11 +33,13 @@ class EpisodeController extends BaseController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if ( if (
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) === null ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) === null
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
$this->podcast = $podcast;
if (count($params) > 1) { if (count($params) > 1) {
if ( if (
! ($this->episode = (new EpisodeModel()) ! ($this->episode = (new EpisodeModel())
@ -135,7 +137,7 @@ class EpisodeController extends BaseController
'audio_file' => $this->request->getFile('audio_file'), 'audio_file' => $this->request->getFile('audio_file'),
'description_markdown' => $this->request->getPost('description'), 'description_markdown' => $this->request->getPost('description'),
'image' => $image, 'image' => $image,
'location' => new Location($this->request->getPost('location_name'),), 'location' => new Location($this->request->getPost('location_name')),
'transcript' => $this->request->getFile('transcript'), 'transcript' => $this->request->getFile('transcript'),
'chapters' => $this->request->getFile('chapters'), 'chapters' => $this->request->getFile('chapters'),
'parental_advisory' => 'parental_advisory' =>
@ -276,7 +278,7 @@ class EpisodeController extends BaseController
} }
} elseif ($transcriptChoice === 'remote-url') { } elseif ($transcriptChoice === 'remote-url') {
if ( if (
($transcriptFileRemoteUrl = $this->request->getPost('transcript_file_remote_url',)) && ($transcriptFileRemoteUrl = $this->request->getPost('transcript_file_remote_url')) &&
(($transcriptFile = $this->episode->transcript_file) && (($transcriptFile = $this->episode->transcript_file) &&
$transcriptFile !== null) $transcriptFile !== null)
) { ) {
@ -295,7 +297,7 @@ class EpisodeController extends BaseController
} }
} elseif ($chaptersChoice === 'remote-url') { } elseif ($chaptersChoice === 'remote-url') {
if ( if (
($chaptersFileRemoteUrl = $this->request->getPost('chapters_file_remote_url',)) && ($chaptersFileRemoteUrl = $this->request->getPost('chapters_file_remote_url')) &&
(($chaptersFile = $this->episode->chapters_file) && (($chaptersFile = $this->episode->chapters_file) &&
$chaptersFile !== null) $chaptersFile !== null)
) { ) {

View File

@ -31,7 +31,7 @@ class EpisodePersonController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) && ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) &&
($this->episode = (new EpisodeModel()) ($this->episode = (new EpisodeModel())
->where([ ->where([
'id' => $params[1], 'id' => $params[1],

View File

@ -27,7 +27,7 @@ class PersonController extends BaseController
} }
if ( if (
($this->person = (new PersonModel())->getPersonById((int) $params[0],)) !== null ($this->person = (new PersonModel())->getPersonById((int) $params[0])) !== null
) { ) {
return $this->{$method}(); return $this->{$method}();
} }

View File

@ -33,7 +33,7 @@ class PodcastController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null
) { ) {
return $this->{$method}(); return $this->{$method}();
} }
@ -45,7 +45,7 @@ class PodcastController extends BaseController
{ {
if (! has_permission('podcasts-list')) { if (! has_permission('podcasts-list')) {
$data = [ $data = [
'podcasts' => (new PodcastModel())->getUserPodcasts((int) user_id(),), 'podcasts' => (new PodcastModel())->getUserPodcasts((int) user_id()),
]; ];
} else { } else {
$data = [ $data = [
@ -162,7 +162,7 @@ class PodcastController extends BaseController
$data = [ $data = [
'languageOptions' => $languageOptions, 'languageOptions' => $languageOptions,
'categoryOptions' => $categoryOptions, 'categoryOptions' => $categoryOptions,
'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE'),), 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE')),
]; ];
return view('admin/podcast/create', $data); return view('admin/podcast/create', $data);
@ -207,7 +207,7 @@ class PodcastController extends BaseController
'publisher' => $this->request->getPost('publisher'), 'publisher' => $this->request->getPost('publisher'),
'type' => $this->request->getPost('type'), 'type' => $this->request->getPost('type'),
'copyright' => $this->request->getPost('copyright'), 'copyright' => $this->request->getPost('copyright'),
'location' => new Location($this->request->getPost('location_name'),), 'location' => new Location($this->request->getPost('location_name')),
'payment_pointer' => $this->request->getPost( 'payment_pointer' => $this->request->getPost(
'payment_pointer' 'payment_pointer'
) === '' ? null : $this->request->getPost('payment_pointer'), ) === '' ? null : $this->request->getPost('payment_pointer'),

View File

@ -56,7 +56,7 @@ class PodcastImportController extends BaseController
$data = [ $data = [
'languageOptions' => $languageOptions, 'languageOptions' => $languageOptions,
'categoryOptions' => $categoryOptions, 'categoryOptions' => $categoryOptions,
'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE'),), 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE')),
]; ];
return view('admin/podcast/import', $data); return view('admin/podcast/import', $data);
@ -132,10 +132,10 @@ class PodcastImportController extends BaseController
$podcast = new Podcast([ $podcast = new Podcast([
'name' => $this->request->getPost('name'), 'name' => $this->request->getPost('name'),
'imported_feed_url' => $this->request->getPost('imported_feed_url',), 'imported_feed_url' => $this->request->getPost('imported_feed_url'),
'new_feed_url' => base_url(route_to('podcast_feed', $this->request->getPost('name')),), 'new_feed_url' => base_url(route_to('podcast_feed', $this->request->getPost('name'))),
'title' => (string) $feed->channel[0]->title, 'title' => (string) $feed->channel[0]->title,
'description_markdown' => $converter->convert($channelDescriptionHtml,), 'description_markdown' => $converter->convert($channelDescriptionHtml),
'description_html' => $channelDescriptionHtml, 'description_html' => $channelDescriptionHtml,
'image' => new Image($imageFile), 'image' => new Image($imageFile),
'language_code' => $this->request->getPost('language'), 'language_code' => $this->request->getPost('language'),
@ -323,7 +323,7 @@ class PodcastImportController extends BaseController
property_exists($nsItunes, 'image') && $nsItunes->image !== null && property_exists($nsItunes, 'image') && $nsItunes->image !== null &&
$nsItunes->image->attributes()['href'] !== null $nsItunes->image->attributes()['href'] !== null
) { ) {
$episodeImage = new Image(download_file((string) $nsItunes->image->attributes()['href'],)); $episodeImage = new Image(download_file((string) $nsItunes->image->attributes()['href']));
} else { } else {
$episodeImage = null; $episodeImage = null;
} }
@ -342,8 +342,8 @@ class PodcastImportController extends BaseController
'guid' => $item->guid ?? null, 'guid' => $item->guid ?? null,
'title' => $item->title, 'title' => $item->title,
'slug' => $slug, 'slug' => $slug,
'audio_file' => download_file((string) $item->enclosure->attributes()['url'],), 'audio_file' => download_file((string) $item->enclosure->attributes()['url']),
'description_markdown' => $converter->convert($itemDescriptionHtml,), 'description_markdown' => $converter->convert($itemDescriptionHtml),
'description_html' => $itemDescriptionHtml, 'description_html' => $itemDescriptionHtml,
'image' => $episodeImage, 'image' => $episodeImage,
'parental_advisory' => 'parental_advisory' =>

View File

@ -27,7 +27,7 @@ class PodcastPersonController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null
) { ) {
unset($params[0]); unset($params[0]);
return $this->{$method}(...$params); return $this->{$method}(...$params);
@ -42,7 +42,7 @@ class PodcastPersonController extends BaseController
$data = [ $data = [
'podcast' => $this->podcast, 'podcast' => $this->podcast,
'podcastPersons' => (new PersonModel())->getPodcastPersons($this->podcast->id,), 'podcastPersons' => (new PersonModel())->getPodcastPersons($this->podcast->id),
'personOptions' => (new PersonModel())->getPersonOptions(), 'personOptions' => (new PersonModel())->getPersonOptions(),
'taxonomyOptions' => (new PersonModel())->getTaxonomyOptions(), 'taxonomyOptions' => (new PersonModel())->getTaxonomyOptions(),
]; ];

View File

@ -28,7 +28,7 @@ class PodcastPlatformController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null
) { ) {
unset($params[0]); unset($params[0]);
return $this->{$method}(...$params); return $this->{$method}(...$params);
@ -49,7 +49,7 @@ class PodcastPlatformController extends BaseController
$data = [ $data = [
'podcast' => $this->podcast, 'podcast' => $this->podcast,
'platformType' => $platformType, 'platformType' => $platformType,
'platforms' => (new PlatformModel())->getPlatformsWithLinks($this->podcast->id, $platformType,), 'platforms' => (new PlatformModel())->getPlatformsWithLinks($this->podcast->id, $platformType),
]; ];
replace_breadcrumb_params([ replace_breadcrumb_params([

View File

@ -35,20 +35,25 @@ class EpisodeController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null ($podcast = (new PodcastModel())->getPodcastByName($params[0])) === null
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
$this->podcast = $podcast;
if ( if (
($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1],)) !== null ($episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1])) === null
) { ) {
unset($params[1]); throw PageNotFoundException::forPageNotFound();
unset($params[0]);
return $this->{$method}(...$params);
} }
throw PageNotFoundException::forPageNotFound(); $this->episode = $episode;
unset($params[1]);
unset($params[0]);
return $this->{$method}(...$params);
} }
public function index(): string public function index(): string

View File

@ -155,7 +155,7 @@ class InstallController extends Controller
if (! $this->validate($rules)) { if (! $this->validate($rules)) {
return redirect() return redirect()
->to((host_url() === null ? config('App') ->baseURL : host_url()) . config('App')->installGateway,) ->to((host_url() === null ? config('App') ->baseURL : host_url()) . config('App')->installGateway)
->withInput() ->withInput()
->with('errors', $this->validator->getErrors()); ->with('errors', $this->validator->getErrors());
} }
@ -173,7 +173,7 @@ class InstallController extends Controller
helper('text'); helper('text');
// redirect to full install url with new baseUrl input // redirect to full install url with new baseUrl input
return redirect()->to(reduce_double_slashes($baseUrl . '/' . config('App')->installGateway,)); return redirect()->to(reduce_double_slashes($baseUrl . '/' . config('App')->installGateway));
} }
public function databaseConfig(): string public function databaseConfig(): string
@ -198,10 +198,10 @@ class InstallController extends Controller
} }
self::writeEnv([ self::writeEnv([
'database.default.hostname' => $this->request->getPost('db_hostname',), 'database.default.hostname' => $this->request->getPost('db_hostname'),
'database.default.database' => $this->request->getPost('db_name'), 'database.default.database' => $this->request->getPost('db_name'),
'database.default.username' => $this->request->getPost('db_username',), 'database.default.username' => $this->request->getPost('db_username'),
'database.default.password' => $this->request->getPost('db_password',), 'database.default.password' => $this->request->getPost('db_password'),
'database.default.DBPrefix' => $this->request->getPost('db_prefix'), 'database.default.DBPrefix' => $this->request->getPost('db_prefix'),
]); ]);

View File

@ -39,8 +39,12 @@ class NoteController extends ActivityPubNoteController
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) < 2) {
throw PageNotFoundException::forPageNotFound();
}
if ( if (
($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null ($this->podcast = (new PodcastModel())->getPodcastByName($params[0])) === null
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
@ -48,11 +52,13 @@ class NoteController extends ActivityPubNoteController
$this->actor = $this->podcast->actor; $this->actor = $this->podcast->actor;
if ( if (
count($params) > 1 && ($note = (new NoteModel())->getNoteById($params[1])) === null
! ($this->note = (new NoteModel())->getNoteById($params[1]))
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
$this->note = $note;
unset($params[0]); unset($params[0]);
unset($params[1]); unset($params[1]);
@ -125,7 +131,7 @@ class NoteController extends ActivityPubNoteController
if ( if (
$episodeUri && $episodeUri &&
($params = extract_params_from_episode_uri(new URI($episodeUri))) && ($params = extract_params_from_episode_uri(new URI($episodeUri))) &&
($episode = (new EpisodeModel())->getEpisodeBySlug($params['podcastName'], $params['episodeSlug'],)) ($episode = (new EpisodeModel())->getEpisodeBySlug($params['podcastName'], $params['episodeSlug']))
) { ) {
$newNote->episode_id = $episode->id; $newNote->episode_id = $episode->id;
} }
@ -135,7 +141,7 @@ class NoteController extends ActivityPubNoteController
$noteModel = new NoteModel(); $noteModel = new NoteModel();
if ( if (
! $noteModel ! $noteModel
->addNote($newNote, ! (bool) $newNote->episode_id, true,) ->addNote($newNote, ! (bool) $newNote->episode_id, true)
) { ) {
return redirect() return redirect()
->back() ->back()

View File

@ -16,7 +16,7 @@ use CodeIgniter\Exceptions\PageNotFoundException;
class PageController extends BaseController class PageController extends BaseController
{ {
protected ?Page $page = null; protected Page $page;
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
@ -25,12 +25,14 @@ class PageController extends BaseController
} }
if ( if (
$this->page = (new PageModel())->where('slug', $params[0])->first() ($page = (new PageModel())->where('slug', $params[0])->first()) === null
) { ) {
return $this->{$method}(); throw PageNotFoundException::forPageNotFound();
} }
throw PageNotFoundException::forPageNotFound(); $this->page = $page;
return $this->{$method}();
} }
public function index(): string public function index(): string

View File

@ -30,13 +30,15 @@ class PodcastController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) !== null ($podcast = (new PodcastModel())->getPodcastByName($params[0])) === null
) { ) {
unset($params[0]); throw PageNotFoundException::forPageNotFound();
return $this->{$method}(...$params);
} }
throw PageNotFoundException::forPageNotFound(); $this->podcast = $podcast;
unset($params[0]);
return $this->{$method}(...$params);
} }
public function activity(): string public function activity(): string
@ -61,7 +63,7 @@ class PodcastController extends BaseController
if (! ($cachedView = cache($cacheName))) { if (! ($cachedView = cache($cacheName))) {
$data = [ $data = [
'podcast' => $this->podcast, 'podcast' => $this->podcast,
'notes' => (new NoteModel())->getActorPublishedNotes($this->podcast->actor_id,), 'notes' => (new NoteModel())->getActorPublishedNotes($this->podcast->actor_id),
]; ];
// if user is logged in then send to the authenticated activity view // if user is logged in then send to the authenticated activity view

View File

@ -277,7 +277,7 @@ class AuthSeeder extends Seeder
foreach ($action['has_permission'] as $role) { foreach ($action['has_permission'] as $role) {
// link permission to specified groups // link permission to specified groups
$dataGroupsPermissions[] = [ $dataGroupsPermissions[] = [
'group_id' => $this->getGroupIdByName($role, $dataGroups,), 'group_id' => $this->getGroupIdByName($role, $dataGroups),
'permission_id' => $permissionId, 'permission_id' => $permissionId,
]; ];
} }

View File

@ -24,7 +24,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
public function run(): void public function run(): void
{ {
$jsonUserAgents = json_decode( $jsonUserAgents = json_decode(
file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json',), file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json'),
true, true,
512, 512,
JSON_THROW_ON_ERROR, JSON_THROW_ON_ERROR,
@ -63,7 +63,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
->where('`published_at` <= NOW()', null, false) ->where('`published_at` <= NOW()', null, false)
->findAll(); ->findAll();
foreach ($episodes as $episode) { foreach ($episodes as $episode) {
$age = floor(($date - strtotime((string) $episode->published_at)) / 86400,); $age = floor(($date - strtotime((string) $episode->published_at)) / 86400);
$probability1 = floor(exp(3 - $age / 40)) + 1; $probability1 = floor(exp(3 - $age / 40)) + 1;
for ( for (
@ -97,7 +97,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
'.' . '.' .
rand(0, 255); rand(0, 255);
$cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb',); $cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb');
$countryCode = 'N/A'; $countryCode = 'N/A';
$regionCode = 'N/A'; $regionCode = 'N/A';

View File

@ -396,7 +396,7 @@ class Episode extends Entity
public function getLink(): string public function getLink(): string
{ {
return base_url(route_to('episode', $this->getPodcast() ->name, $this->attributes['slug'],)); return base_url(route_to('episode', $this->getPodcast() ->name, $this->attributes['slug']));
} }
public function getEmbeddablePlayerUrl(string $theme = null): string public function getEmbeddablePlayerUrl(string $theme = null): string
@ -410,7 +410,7 @@ class Episode extends Entity
$this->attributes['slug'], $this->attributes['slug'],
$theme, $theme,
) )
: route_to('embeddable-player', $this->getPodcast() ->name, $this->attributes['slug'],), : route_to('embeddable-player', $this->getPodcast() ->name, $this->attributes['slug']),
); );
} }
@ -471,7 +471,7 @@ class Episode extends Entity
{ {
if ($this->description === null) { if ($this->description === null) {
$this->description = trim( $this->description = trim(
preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html']),), preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html'])),
); );
} }

View File

@ -17,9 +17,6 @@ use RuntimeException;
/** /**
* @property int|null $episode_id * @property int|null $episode_id
* @property Episode|null $episode * @property Episode|null $episode
* @property Actor $actor
* @property Note $reblog_of_note
* @property Note $reply_to_note
*/ */
class Note extends ActivityPubNote class Note extends ActivityPubNote
{ {

View File

@ -320,7 +320,7 @@ class Podcast extends Entity
{ {
if ($this->description === null) { if ($this->description === null) {
$this->description = trim( $this->description = trim(
(string) preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html']),), (string) preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html'])),
); );
} }

View File

@ -96,7 +96,7 @@ if (! function_exists('button')) {
if ($uri !== '') { if ($uri !== '') {
return anchor($uri, $label, array_merge([ return anchor($uri, $label, array_merge([
'class' => $buttonClass, 'class' => $buttonClass,
], $customAttributes,)); ], $customAttributes));
} }
$defaultButtonAttributes = [ $defaultButtonAttributes = [

View File

@ -159,9 +159,9 @@ if (! function_exists('form_multiselect')) {
'data-class' => $customExtra['class'], 'data-class' => $customExtra['class'],
'data-select-text' => lang('Common.forms.multiSelect.selectText'), 'data-select-text' => lang('Common.forms.multiSelect.selectText'),
'data-loading-text' => lang('Common.forms.multiSelect.loadingText'), 'data-loading-text' => lang('Common.forms.multiSelect.loadingText'),
'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText',), 'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText'),
'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText',), 'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText'),
'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText',), 'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText'),
]; ];
$extra = stringify_attributes(array_merge($defaultExtra, $customExtra)); $extra = stringify_attributes(array_merge($defaultExtra, $customExtra));

View File

@ -84,7 +84,7 @@ if (! function_exists('get_rss_feed')) {
$recipientElement->addAttribute('split', '100'); $recipientElement->addAttribute('split', '100');
} }
$channel $channel
->addChild('locked', $podcast->is_locked ? 'yes' : 'no', $podcastNamespace,) ->addChild('locked', $podcast->is_locked ? 'yes' : 'no', $podcastNamespace)
->addAttribute('owner', $podcast->owner_email); ->addAttribute('owner', $podcast->owner_email);
if ($podcast->imported_feed_url !== null) { if ($podcast->imported_feed_url !== null) {
$channel->addChild('previousUrl', $podcast->imported_feed_url, $podcastNamespace); $channel->addChild('previousUrl', $podcast->imported_feed_url, $podcastNamespace);
@ -142,13 +142,13 @@ if (! function_exists('get_rss_feed')) {
$personElement->addAttribute( $personElement->addAttribute(
'role', 'role',
htmlspecialchars( htmlspecialchars(
lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en',), lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en'),
), ),
); );
$personElement->addAttribute( $personElement->addAttribute(
'group', 'group',
htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en',),), htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en')),
); );
} }
} }
@ -253,7 +253,7 @@ if (! function_exists('get_rss_feed')) {
$transcriptElement->addAttribute('url', $episode->transcript_file_url); $transcriptElement->addAttribute('url', $episode->transcript_file_url);
$transcriptElement->addAttribute( $transcriptElement->addAttribute(
'type', 'type',
Mimes::guessTypeFromExtension(pathinfo($episode->transcript_file_url, PATHINFO_EXTENSION,),), Mimes::guessTypeFromExtension(pathinfo($episode->transcript_file_url, PATHINFO_EXTENSION)),
); );
$transcriptElement->addAttribute('language', $podcast->language_code); $transcriptElement->addAttribute('language', $podcast->language_code);
} }
@ -281,13 +281,13 @@ if (! function_exists('get_rss_feed')) {
$personElement->addAttribute( $personElement->addAttribute(
'role', 'role',
htmlspecialchars( htmlspecialchars(
lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en',), lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en'),
), ),
); );
$personElement->addAttribute( $personElement->addAttribute(
'group', 'group',
htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en',),), htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en')),
); );
$personElement->addAttribute('img', $person->image->large_url); $personElement->addAttribute('img', $person->image->large_url);

View File

@ -39,12 +39,17 @@ class ActorController extends Controller
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (count($params) < 1) {
throw PageNotFoundException::forPageNotFound();
}
if ( if (
count($params) > 0 && ($actor = model('ActorModel')->getActorByUsername($params[0])) === null
! ($this->actor = model('ActorModel')->getActorByUsername($params[0],))
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
$this->actor = $actor;
unset($params[0]); unset($params[0]);
return $this->{$method}(...$params); return $this->{$method}(...$params);
@ -109,7 +114,7 @@ class ActorController extends Controller
'actor_id' => $payloadActor->id, 'actor_id' => $payloadActor->id,
'in_reply_to_id' => $replyToNote->id, 'in_reply_to_id' => $replyToNote->id,
'message' => $payload->object->content, 'message' => $payload->object->content,
'published_at' => Time::parse($payload->object->published,), 'published_at' => Time::parse($payload->object->published),
]); ]);
} }
@ -295,7 +300,7 @@ class ActorController extends Controller
{ {
// get followers for a specific actor // get followers for a specific actor
$followers = model('ActorModel') $followers = model('ActorModel')
->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner',) ->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner')
->where('activitypub_follows.target_actor_id', $this->actor->id) ->where('activitypub_follows.target_actor_id', $this->actor->id)
->orderBy('activitypub_follows.created_at', 'DESC'); ->orderBy('activitypub_follows.created_at', 'DESC');
@ -364,7 +369,7 @@ class ActorController extends Controller
} }
return redirect()->to( return redirect()->to(
str_replace('{uri}', urlencode($this->actor->uri), $data->links[$ostatusKey]->template,), str_replace('{uri}', urlencode($this->actor->uri), $data->links[$ostatusKey]->template),
); );
} }

View File

@ -37,7 +37,7 @@ class BlockController extends Controller
if ($parts = split_handle($handle)) { if ($parts = split_handle($handle)) {
if ( if (
($actor = get_or_create_actor($parts['username'], $parts['domain'],)) === null ($actor = get_or_create_actor($parts['username'], $parts['domain'])) === null
) { ) {
return redirect() return redirect()
->back() ->back()

View File

@ -39,9 +39,16 @@ class NoteController extends Controller
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if (! ($this->note = model('NoteModel')->getNoteById($params[0]))) { if (count($params) < 1) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
if (($note = model('NoteModel')->getNoteById($params[0])) === null) {
throw PageNotFoundException::forPageNotFound();
}
$this->note = $note;
unset($params[0]); unset($params[0]);
return $this->{$method}(...$params); return $this->{$method}(...$params);
@ -69,7 +76,7 @@ class NoteController extends Controller
* get note replies * get note replies
*/ */
$noteReplies = model('NoteModel') $noteReplies = model('NoteModel')
->where('in_reply_to_id', service('uuid') ->fromString($this->note->id) ->getBytes(),) ->where('in_reply_to_id', service('uuid') ->fromString($this->note->id) ->getBytes())
->where('`published_at` <= NOW()', null, false) ->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC'); ->orderBy('published_at', 'ASC');
@ -252,7 +259,7 @@ class NoteController extends Controller
} }
return redirect()->to( return redirect()->to(
str_replace('{uri}', urlencode($this->note->uri), $data->links[$ostatusKey]->template,), str_replace('{uri}', urlencode($this->note->uri), $data->links[$ostatusKey]->template),
); );
} }

View File

@ -18,9 +18,9 @@ use RuntimeException;
* @property int $actor_id * @property int $actor_id
* @property Actor $actor * @property Actor $actor
* @property int|null $target_actor_id * @property int|null $target_actor_id
* @property Actor|null $target_actor * @property Actor $target_actor
* @property string|null $note_id * @property string|null $note_id
* @property Note|null $note * @property Note $note
* @property string $type * @property string $type
* @property object $payload * @property object $payload
* @property string|null $status * @property string|null $status
@ -65,7 +65,7 @@ class Activity extends UuidEntity
} }
if ($this->actor === null) { if ($this->actor === null) {
$this->actor = model('ActorModel') $this->actor = model('ActorModel', false)
->getActorById($this->actor_id); ->getActorById($this->actor_id);
} }
@ -79,7 +79,7 @@ class Activity extends UuidEntity
} }
if ($this->target_actor === null) { if ($this->target_actor === null) {
$this->target_actor = model('ActorModel') $this->target_actor = model('ActorModel', false)
->getActorById($this->target_actor_id); ->getActorById($this->target_actor_id);
} }
@ -93,7 +93,7 @@ class Activity extends UuidEntity
} }
if ($this->note === null) { if ($this->note === null) {
$this->note = model('NoteModel') $this->note = model('NoteModel', false)
->getNoteById($this->note_id); ->getNoteById($this->note_id);
} }

View File

@ -101,7 +101,7 @@ class Actor extends Entity
} }
if ($this->followers === null) { if ($this->followers === null) {
$this->followers = (array) model('ActorModel') $this->followers = (array) model('ActorModel', false)
->getFollowers($this->id); ->getFollowers($this->id);
} }

View File

@ -18,12 +18,10 @@ use RuntimeException;
* @property string $id * @property string $id
* @property string $uri * @property string $uri
* @property int $actor_id * @property int $actor_id
* @property Actor|null $actor * @property Actor $actor
* @property string|null $in_reply_to_id * @property string|null $in_reply_to_id
* @property bool $is_reply
* @property Note|null $reply_to_note * @property Note|null $reply_to_note
* @property string|null $reblog_of_id * @property string|null $reblog_of_id
* @property bool $is_reblog
* @property Note|null $reblog_of_note * @property Note|null $reblog_of_note
* @property string $message * @property string $message
* @property string $message_html * @property string $message_html
@ -44,12 +42,8 @@ class Note extends UuidEntity
{ {
protected ?Actor $actor = null; protected ?Actor $actor = null;
protected bool $is_reply = false;
protected ?Note $reply_to_note = null; protected ?Note $reply_to_note = null;
protected bool $is_reblog = false;
protected ?Note $reblog_of_note = null; protected ?Note $reblog_of_note = null;
protected ?PreviewCard $preview_card = null; protected ?PreviewCard $preview_card = null;
@ -97,14 +91,14 @@ class Note extends UuidEntity
/** /**
* Returns the note's actor * Returns the note's actor
*/ */
public function getActor(): ?Actor public function getActor(): Actor
{ {
if ($this->actor_id === null) { if ($this->actor_id === null) {
throw new RuntimeException('Note must have an actor_id before getting actor.'); throw new RuntimeException('Note must have an actor_id before getting actor.');
} }
if ($this->actor === null) { if ($this->actor === null) {
$this->actor = model('ActorModel') $this->actor = model('ActorModel', false)
->getActorById($this->actor_id); ->getActorById($this->actor_id);
} }
@ -118,7 +112,7 @@ class Note extends UuidEntity
} }
if ($this->preview_card === null) { if ($this->preview_card === null) {
$this->preview_card = model('PreviewCardModel') $this->preview_card = model('PreviewCardModel', false)
->getNotePreviewCard($this->id); ->getNotePreviewCard($this->id);
} }
@ -130,11 +124,6 @@ class Note extends UuidEntity
return $this->getPreviewCard() !== null; return $this->getPreviewCard() !== null;
} }
public function getIsReply(): bool
{
return $this->in_reply_to_id && ($this->getReplyToNote() !== null);
}
/** /**
* @return Note[] * @return Note[]
*/ */
@ -145,7 +134,7 @@ class Note extends UuidEntity
} }
if ($this->replies === null) { if ($this->replies === null) {
$this->replies = (array) model('NoteModel') $this->replies = (array) model('NoteModel', false)
->getNoteReplies($this->id); ->getNoteReplies($this->id);
} }
@ -164,7 +153,7 @@ class Note extends UuidEntity
} }
if ($this->reply_to_note === null) { if ($this->reply_to_note === null) {
$this->reply_to_note = model('NoteModel') $this->reply_to_note = model('NoteModel', false)
->getNoteById($this->in_reply_to_id); ->getNoteById($this->in_reply_to_id);
} }
@ -181,18 +170,13 @@ class Note extends UuidEntity
} }
if ($this->reblogs === null) { if ($this->reblogs === null) {
$this->reblogs = (array) model('NoteModel') $this->reblogs = (array) model('NoteModel', false)
->getNoteReblogs($this->id); ->getNoteReblogs($this->id);
} }
return $this->reblogs; return $this->reblogs;
} }
public function getIsReblog(): bool
{
return $this->reblog_of_id !== null;
}
public function getReblogOfNote(): ?self public function getReblogOfNote(): ?self
{ {
if ($this->reblog_of_id === null) { if ($this->reblog_of_id === null) {
@ -200,7 +184,7 @@ class Note extends UuidEntity
} }
if ($this->reblog_of_note === null) { if ($this->reblog_of_note === null) {
$this->reblog_of_note = model('NoteModel') $this->reblog_of_note = model('NoteModel', false)
->getNoteById($this->reblog_of_id); ->getNoteById($this->reblog_of_id);
} }

View File

@ -45,7 +45,7 @@ if (! function_exists('split_handle')) {
function split_handle(string $handle): array | false function split_handle(string $handle): array | false
{ {
if ( if (
! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches,) ! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches)
) { ) {
return false; return false;
} }
@ -171,7 +171,7 @@ if (! function_exists('create_preview_card_from_url')) {
]); ]);
if ( if (
! ($newPreviewCardId = model('PreviewCardModel')->insert($newPreviewCard, true,)) ! ($newPreviewCardId = model('PreviewCardModel')->insert($newPreviewCard, true))
) { ) {
return null; return null;
} }
@ -194,7 +194,7 @@ if (! function_exists('get_or_create_preview_card_from_url')) {
// check if preview card has already been generated // check if preview card has already been generated
if ( if (
$previewCard = model('PreviewCardModel') $previewCard = model('PreviewCardModel')
->getPreviewCardFromUrl((string) $url,) ->getPreviewCardFromUrl((string) $url)
) { ) {
return $previewCard; return $previewCard;
} }
@ -361,7 +361,7 @@ if (! function_exists('linkify')) {
if ( if (
$actor = model( $actor = model(
'ActorModel', 'ActorModel',
)->getActorByUsername($match['username'], $match['domain'],) )->getActorByUsername($match['username'], $match['domain'])
) { ) {
// TODO: check that host is local to remove target blank? // TODO: check that host is local to remove target blank?
return '<' . return '<' .
@ -394,11 +394,11 @@ if (! function_exists('linkify')) {
} }
} else { } else {
if ( if (
$actor = model('ActorModel',) $actor = model('ActorModel')
->getActorByUsername($match['username']) ->getActorByUsername($match['username'])
) { ) {
return '<' . return '<' .
array_push($links, anchor($actor->uri, $match[0]),) . array_push($links, anchor($actor->uri, $match[0])) .
'>'; '>';
} }

View File

@ -35,7 +35,7 @@ class HttpSignature
([\w\-\.#\/@]+) ([\w\-\.#\/@]+)
)", )",
algorithm="(?P<algorithm>[\w\-]+)", algorithm="(?P<algorithm>[\w\-]+)",
(headers="\(request-target\) (?P<headers>[\w\\-\s]+)",)? (headers="\(request-target\) (?P<headers>[\w\\-\s]+)")?
signature="(?P<signature>[\w+\/]+={0,2})" signature="(?P<signature>[\w+\/]+={0,2})"
/x'; /x';

View File

@ -129,7 +129,7 @@ class ActorModel extends Model
config('ActivityPub') config('ActivityPub')
->cachePrefix . "actor#{$actorId}_followers"; ->cachePrefix . "actor#{$actorId}_followers";
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$found = $this->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner',) $found = $this->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner')
->where('activitypub_follows.target_actor_id', $actorId) ->where('activitypub_follows.target_actor_id', $actorId)
->findAll(); ->findAll();

View File

@ -57,7 +57,7 @@ class FavouriteModel extends UuidModel
]); ]);
model('NoteModel') model('NoteModel')
->where('id', service('uuid') ->fromString($note->id) ->getBytes(),) ->where('id', service('uuid') ->fromString($note->id) ->getBytes())
->increment('favourites_count'); ->increment('favourites_count');
if ($registerActivity) { if ($registerActivity) {
@ -97,7 +97,7 @@ class FavouriteModel extends UuidModel
$this->db->transStart(); $this->db->transStart();
model('NoteModel') model('NoteModel')
->where('id', service('uuid') ->fromString($note->id) ->getBytes(),) ->where('id', service('uuid') ->fromString($note->id) ->getBytes())
->decrement('favourites_count'); ->decrement('favourites_count');
$this->db $this->db
@ -125,7 +125,7 @@ class FavouriteModel extends UuidModel
$likeActivity = new LikeActivity(); $likeActivity = new LikeActivity();
$likeActivity $likeActivity
->set('id', base_url(route_to('activity', $actor->username, $activity->id),),) ->set('id', base_url(route_to('activity', $actor->username, $activity->id)))
->set('actor', $actor->uri) ->set('actor', $actor->uri)
->set('object', $note->uri); ->set('object', $note->uri);

View File

@ -83,7 +83,7 @@ class FollowModel extends Model
'queued', 'queued',
); );
$followActivity->set('id', base_url(route_to('activity', $actor->username, $activityId),)); $followActivity->set('id', base_url(route_to('activity', $actor->username, $activityId)));
model('ActivityModel') model('ActivityModel')
->update($activityId, [ ->update($activityId, [

View File

@ -155,7 +155,7 @@ class NoteModel extends UuidModel
*/ */
public function getSecondsToNextUnpublishedNote(int $actorId): int | false public function getSecondsToNextUnpublishedNote(int $actorId): int | false
{ {
$result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff',) $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff')
->where([ ->where([
'actor_id' => $actorId, 'actor_id' => $actorId,
]) ])
@ -185,11 +185,11 @@ class NoteModel extends UuidModel
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
if (! $withBlocked) { if (! $withBlocked) {
$this->select('activitypub_notes.*') $this->select('activitypub_notes.*')
->join('activitypub_actors', 'activitypub_actors.id = activitypub_notes.actor_id', 'inner',) ->join('activitypub_actors', 'activitypub_actors.id = activitypub_notes.actor_id', 'inner')
->where('activitypub_actors.is_blocked', 0); ->where('activitypub_actors.is_blocked', 0);
} }
$this->where('in_reply_to_id', $this->uuid->fromString($noteId) ->getBytes(),) $this->where('in_reply_to_id', $this->uuid->fromString($noteId) ->getBytes())
->where('`published_at` <= NOW()', null, false) ->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC'); ->orderBy('published_at', 'ASC');
$found = $this->findAll(); $found = $this->findAll();
@ -213,7 +213,7 @@ class NoteModel extends UuidModel
->cachePrefix . "note#{$noteId}_reblogs"; ->cachePrefix . "note#{$noteId}_reblogs";
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$found = $this->where('reblog_of_id', $this->uuid->fromString($noteId) ->getBytes(),) $found = $this->where('reblog_of_id', $this->uuid->fromString($noteId) ->getBytes())
->where('`published_at` <= NOW()', null, false) ->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC') ->orderBy('published_at', 'ASC')
->findAll(); ->findAll();
@ -262,7 +262,7 @@ class NoteModel extends UuidModel
if ( if (
$messageUrls !== [] && $messageUrls !== [] &&
($previewCard = get_or_create_preview_card_from_url(new URI($messageUrls[0]),)) && ($previewCard = get_or_create_preview_card_from_url(new URI($messageUrls[0]))) &&
! $this->addPreviewCard($newNoteId, $previewCard->id) ! $this->addPreviewCard($newNoteId, $previewCard->id)
) { ) {
$this->db->transRollback(); $this->db->transRollback();
@ -298,7 +298,7 @@ class NoteModel extends UuidModel
'queued', 'queued',
); );
$createActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); $createActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
model('ActivityModel') model('ActivityModel')
->update($activityId, [ ->update($activityId, [
@ -361,10 +361,10 @@ class NoteModel extends UuidModel
->where('id', $note->actor_id) ->where('id', $note->actor_id)
->decrement('notes_count'); ->decrement('notes_count');
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
// Note to remove is a reply // Note to remove is a reply
model('NoteModel') model('NoteModel')
->where('id', $this->uuid->fromString($note->in_reply_to_id) ->getBytes(),) ->where('id', $this->uuid->fromString($note->in_reply_to_id) ->getBytes())
->decrement('replies_count'); ->decrement('replies_count');
Events::trigger('on_reply_remove', $note); Events::trigger('on_reply_remove', $note);
@ -372,6 +372,7 @@ class NoteModel extends UuidModel
// remove all note reblogs // remove all note reblogs
foreach ($note->reblogs as $reblog) { foreach ($note->reblogs as $reblog) {
// FIXME: issue when actor is not local, can't get actor information
$this->removeNote($reblog); $this->removeNote($reblog);
} }
@ -410,7 +411,7 @@ class NoteModel extends UuidModel
'queued', 'queued',
); );
$deleteActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); $deleteActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
model('ActivityModel') model('ActivityModel')
->update($activityId, [ ->update($activityId, [
@ -444,7 +445,7 @@ class NoteModel extends UuidModel
$noteId = $this->addNote($reply, $createPreviewCard, $registerActivity); $noteId = $this->addNote($reply, $createPreviewCard, $registerActivity);
model('NoteModel') model('NoteModel')
->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes(),) ->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes())
->increment('replies_count'); ->increment('replies_count');
Events::trigger('on_note_reply', $reply); Events::trigger('on_note_reply', $reply);
@ -491,7 +492,7 @@ class NoteModel extends UuidModel
'queued', 'queued',
); );
$announceActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); $announceActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
model('ActivityModel') model('ActivityModel')
->update($activityId, [ ->update($activityId, [
@ -517,7 +518,7 @@ class NoteModel extends UuidModel
->decrement('notes_count'); ->decrement('notes_count');
model('NoteModel') model('NoteModel')
->where('id', $this->uuid->fromString($reblogNote->reblog_of_id) ->getBytes(),) ->where('id', $this->uuid->fromString($reblogNote->reblog_of_id) ->getBytes())
->decrement('reblogs_count'); ->decrement('reblogs_count');
if ($registerActivity) { if ($registerActivity) {
@ -536,7 +537,7 @@ class NoteModel extends UuidModel
$announceActivity = new AnnounceActivity($reblogNote); $announceActivity = new AnnounceActivity($reblogNote);
$announceActivity->set( $announceActivity->set(
'id', 'id',
base_url(route_to('activity', $reblogNote->actor->username, $activity->id,),), base_url(route_to('activity', $reblogNote->actor->username, $activity->id)),
); );
$undoActivity $undoActivity
@ -554,10 +555,7 @@ class NoteModel extends UuidModel
'queued', 'queued',
); );
$undoActivity->set( $undoActivity->set('id', base_url(route_to('activity', $reblogNote->actor->username, $activityId)));
'id',
base_url(route_to('activity', $reblogNote->actor->username, $activityId,),),
);
model('ActivityModel') model('ActivityModel')
->update($activityId, [ ->update($activityId, [
@ -607,11 +605,11 @@ class NoteModel extends UuidModel
cache() cache()
->deleteMatching($cachePrefix . "note-{$hashedNoteUri}*"); ->deleteMatching($cachePrefix . "note-{$hashedNoteUri}*");
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
$this->clearCache($note->reply_to_note); $this->clearCache($note->reply_to_note);
} }
if ($note->is_reblog) { if ($note->reblog_of_id !== null) {
$this->clearCache($note->reblog_of_note); $this->clearCache($note->reblog_of_note);
} }
} }
@ -627,7 +625,7 @@ class NoteModel extends UuidModel
if (! isset($data['data']['uri'])) { if (! isset($data['data']['uri'])) {
$actor = model('ActorModel') $actor = model('ActorModel')
->getActorById($data['data']['actor_id']); ->getActorById((int) $data['data']['actor_id']);
$data['data']['uri'] = base_url(route_to('note', $actor->username, $uuid4->toString())); $data['data']['uri'] = base_url(route_to('note', $actor->username, $uuid4->toString()));
} }

View File

@ -81,7 +81,7 @@ class PreviewCardModel extends Model
'activitypub_notes_preview_cards.preview_card_id = id', 'activitypub_notes_preview_cards.preview_card_id = id',
'inner', 'inner',
) )
->where('note_id', service('uuid') ->fromString($noteId) ->getBytes(),) ->where('note_id', service('uuid') ->fromString($noteId) ->getBytes())
->first(); ->first();
cache() cache()

View File

@ -35,7 +35,7 @@ class NoteObject extends ObjectType
$this->published = $note->published_at->format(DATE_W3C); $this->published = $note->published_at->format(DATE_W3C);
$this->attributedTo = $note->actor->uri; $this->attributedTo = $note->actor->uri;
if ($note->is_reply) { if ($note->in_reply_to_id !== null) {
$this->inReplyTo = $note->reply_to_note->uri; $this->inReplyTo = $note->reply_to_note->uri;
} }

View File

@ -62,7 +62,7 @@ class WebFinger
} }
if ( if (
! ($actor = model('ActorModel')->getActorByUsername($username, $domain,)) ! ($actor = model('ActorModel')->getActorByUsername($username, $domain))
) { ) {
throw new Exception('Could not find actor'); throw new Exception('Could not find actor');
} }

View File

@ -35,13 +35,13 @@ class EpisodeController extends BaseController
} }
if ( if (
($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null ($this->podcast = (new PodcastModel())->getPodcastByName($params[0])) === null
) { ) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
if ( if (
($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1],)) !== null ($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1])) !== null
) { ) {
unset($params[1]); unset($params[1]);
unset($params[0]); unset($params[0]);

View File

@ -64,7 +64,7 @@ if (! function_exists('generate_episode_analytics_url')) {
$audioFileDuration <= 60 $audioFileDuration <= 60
? $audioFileSize ? $audioFileSize
: $audioFileHeaderSize + : $audioFileHeaderSize +
floor((($audioFileSize - $audioFileHeaderSize) / $audioFileDuration) * 60,), floor((($audioFileSize - $audioFileHeaderSize) / $audioFileDuration) * 60),
$audioFileSize, $audioFileSize,
$audioFileDuration, $audioFileDuration,
$publicationDate->getTimestamp(), $publicationDate->getTimestamp(),

View File

@ -45,7 +45,7 @@ class AnalyticsPodcastByCountryModel extends Model
public function getDataWeekly(int $podcastId): array public function getDataWeekly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_by_country_weekly",)) ! ($found = cache("{$podcastId}_analytics_podcast_by_country_weekly"))
) { ) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('country_code as labels') $found = $this->select('country_code as labels')
@ -73,7 +73,7 @@ class AnalyticsPodcastByCountryModel extends Model
public function getDataYearly(int $podcastId): array public function getDataYearly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_by_country_yearly",)) ! ($found = cache("{$podcastId}_analytics_podcast_by_country_yearly"))
) { ) {
$oneYearAgo = date('Y-m-d', strtotime('-1 year')); $oneYearAgo = date('Y-m-d', strtotime('-1 year'));
$found = $this->select('country_code as labels') $found = $this->select('country_code as labels')

View File

@ -43,7 +43,7 @@ class AnalyticsPodcastByEpisodeModel extends Model
public function getDataByDay(int $podcastId, int $episodeId): array public function getDataByDay(int $podcastId, int $episodeId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day",)) ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day"))
) { ) {
$found = $this->select('date as labels') $found = $this->select('date as labels')
->selectSum('hits', 'values') ->selectSum('hits', 'values')
@ -69,7 +69,7 @@ class AnalyticsPodcastByEpisodeModel extends Model
public function getDataByMonth(int $podcastId, int $episodeId = null): array public function getDataByMonth(int $podcastId, int $episodeId = null): array
{ {
if ( if (
! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month",)) ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month"))
) { ) {
$found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels')
->selectSum('hits', 'values') ->selectSum('hits', 'values')

View File

@ -45,7 +45,7 @@ class AnalyticsPodcastByPlayerModel extends Model
public function getDataByAppWeekly(int $podcastId): array public function getDataByAppWeekly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_weekly",)) ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_weekly"))
) { ) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('app as labels') $found = $this->select('app as labels')
@ -73,7 +73,7 @@ class AnalyticsPodcastByPlayerModel extends Model
public function getDataByAppYearly(int $podcastId): array public function getDataByAppYearly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_yearly",)) ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_yearly"))
) { ) {
$oneYearAgo = date('Y-m-d', strtotime('-1 year')); $oneYearAgo = date('Y-m-d', strtotime('-1 year'));
$found = $this->select('app as labels') $found = $this->select('app as labels')
@ -101,7 +101,7 @@ class AnalyticsPodcastByPlayerModel extends Model
public function getDataByOsWeekly(int $podcastId): array public function getDataByOsWeekly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_os_weekly",)) ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_os_weekly"))
) { ) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('os as labels') $found = $this->select('os as labels')
@ -130,7 +130,7 @@ class AnalyticsPodcastByPlayerModel extends Model
public function getDataByDeviceWeekly(int $podcastId): array public function getDataByDeviceWeekly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_device_weekly",)) ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_device_weekly"))
) { ) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('device as labels') $found = $this->select('device as labels')

View File

@ -47,7 +47,7 @@ class AnalyticsPodcastByRegionModel extends Model
$locale = service('request') $locale = service('request')
->getLocale(); ->getLocale();
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_by_region_{$locale}",)) ! ($found = cache("{$podcastId}_analytics_podcast_by_region_{$locale}"))
) { ) {
$found = $this->select('country_code, region_code') $found = $this->select('country_code, region_code')
->selectSum('hits', 'value') ->selectSum('hits', 'value')

View File

@ -45,7 +45,7 @@ class AnalyticsPodcastByServiceModel extends Model
public function getDataByServiceWeekly(int $podcastId): array public function getDataByServiceWeekly(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcasts_by_service_weekly",)) ! ($found = cache("{$podcastId}_analytics_podcasts_by_service_weekly"))
) { ) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select('service as labels') $found = $this->select('service as labels')

View File

@ -67,7 +67,7 @@ class AnalyticsPodcastModel extends Model
public function getDataByWeekday(int $podcastId): array public function getDataByWeekday(int $podcastId): array
{ {
if (! ($found = cache("{$podcastId}_analytics_podcasts_by_weekday"))) { if (! ($found = cache("{$podcastId}_analytics_podcasts_by_weekday"))) {
$found = $this->select('LEFT(DAYNAME(date),3) as labels, WEEKDAY(date) as sort_labels',) $found = $this->select('LEFT(DAYNAME(date),3) as labels, WEEKDAY(date) as sort_labels')
->selectSum('hits', 'values') ->selectSum('hits', 'values')
->where([ ->where([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
@ -91,7 +91,7 @@ class AnalyticsPodcastModel extends Model
public function getDataBandwidthByDay(int $podcastId): array public function getDataBandwidthByDay(int $podcastId): array
{ {
if (! ($found = cache("{$podcastId}_analytics_podcast_by_bandwidth"))) { if (! ($found = cache("{$podcastId}_analytics_podcast_by_bandwidth"))) {
$found = $this->select('date as labels, round(bandwidth / 1048576, 1) as `values`',) $found = $this->select('date as labels, round(bandwidth / 1048576, 1) as `values`')
->where([ ->where([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
'date >' => date('Y-m-d', strtotime('-60 days')), 'date >' => date('Y-m-d', strtotime('-60 days')),
@ -136,7 +136,7 @@ class AnalyticsPodcastModel extends Model
public function getDataUniqueListenersByDay(int $podcastId): array public function getDataUniqueListenersByDay(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_day",)) ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_day"))
) { ) {
$found = $this->select('date as labels, unique_listeners as values') $found = $this->select('date as labels, unique_listeners as values')
->where([ ->where([
@ -160,7 +160,7 @@ class AnalyticsPodcastModel extends Model
public function getDataUniqueListenersByMonth(int $podcastId): array public function getDataUniqueListenersByMonth(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_month",)) ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_month"))
) { ) {
$found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels')
->selectSum('unique_listeners', 'values') ->selectSum('unique_listeners', 'values')
@ -185,7 +185,7 @@ class AnalyticsPodcastModel extends Model
public function getDataTotalListeningTimeByDay(int $podcastId): array public function getDataTotalListeningTimeByDay(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_day",)) ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_day"))
) { ) {
$found = $this->select('date as labels') $found = $this->select('date as labels')
->selectSum('duration', 'values') ->selectSum('duration', 'values')
@ -211,7 +211,7 @@ class AnalyticsPodcastModel extends Model
public function getDataTotalListeningTimeByMonth(int $podcastId): array public function getDataTotalListeningTimeByMonth(int $podcastId): array
{ {
if ( if (
! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_month",)) ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_month"))
) { ) {
$found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels')
->selectSum('duration', 'values') ->selectSum('duration', 'values')

View File

@ -46,7 +46,7 @@ class AnalyticsWebsiteByEntryPageModel extends Model
{ {
if (! ($found = cache("{$podcastId}_analytics_website_by_entry_page"))) { if (! ($found = cache("{$podcastId}_analytics_website_by_entry_page"))) {
$oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
$found = $this->select("IF(entry_page_url='/','/',SUBSTRING_INDEX(entry_page_url,'/',-1)) as labels",) $found = $this->select("IF(entry_page_url='/','/',SUBSTRING_INDEX(entry_page_url,'/',-1)) as labels")
->selectSum('hits', 'values') ->selectSum('hits', 'values')
->where([ ->where([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,

View File

@ -54,7 +54,7 @@ class Router extends CodeIgniterRouter
if (str_contains($key, '{locale}')) { if (str_contains($key, '{locale}')) {
$localeSegment = array_search( $localeSegment = array_search(
'{locale}', '{locale}',
preg_split('~[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+~m', $key,), preg_split('~[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+~m', $key),
true, true,
); );
@ -104,7 +104,7 @@ class Router extends CodeIgniterRouter
// check if the alternate-content has been requested in the accept // check if the alternate-content has been requested in the accept
// header and overwrite the $val with the matching controller method // header and overwrite the $val with the matching controller method
if ( if (
array_key_exists('alternate-content', $this->matchedRouteOptions,) && array_key_exists('alternate-content', $this->matchedRouteOptions) &&
is_array($this->matchedRouteOptions['alternate-content']) is_array($this->matchedRouteOptions['alternate-content'])
) { ) {
$request = Services::request(); $request = Services::request();
@ -119,7 +119,7 @@ class Router extends CodeIgniterRouter
$expectedContentType = $parsedHeader[0]; $expectedContentType = $parsedHeader[0];
foreach ($supported as $available) { foreach ($supported as $available) {
if ( if (
$negotiate->callMatch($expectedContentType, $available, true,) $negotiate->callMatch($expectedContentType, $available, true)
) { ) {
if ( if (
array_key_exists( array_key_exists(

View File

@ -130,7 +130,7 @@ class CategoryModel extends Model
$cacheName = "podcast#{$podcastId}_categories"; $cacheName = "podcast#{$podcastId}_categories";
if (! ($categories = cache($cacheName))) { if (! ($categories = cache($cacheName))) {
$categories = $this->select('categories.*') $categories = $this->select('categories.*')
->join('podcasts_categories', 'podcasts_categories.category_id = categories.id',) ->join('podcasts_categories', 'podcasts_categories.category_id = categories.id')
->where('podcasts_categories.podcast_id', $podcastId) ->where('podcasts_categories.podcast_id', $podcastId)
->findAll(); ->findAll();

View File

@ -265,7 +265,7 @@ class EpisodeModel extends Model
*/ */
public function getSecondsToNextUnpublishedEpisode(int $podcastId): int | false public function getSecondsToNextUnpublishedEpisode(int $podcastId): int | false
{ {
$result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff',) $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff')
->where([ ->where([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
]) ])

View File

@ -423,7 +423,7 @@ class PersonModel extends Model
*/ */
protected function clearCache(array $data): array protected function clearCache(array $data): array
{ {
$personId = is_array($data['id']) ? $data['id']['id'] : $data['id']; $personId = is_array($data['id']) ? $data['id'][0] : $data['id'];
cache() cache()
->delete('person_options'); ->delete('person_options');

View File

@ -99,7 +99,7 @@ class PlatformModel extends Model
public function getPlatformsWithLinks(int $podcastId, string $platformType): array public function getPlatformsWithLinks(int $podcastId, string $platformType): array
{ {
if ( if (
! ($found = cache("podcast#{$podcastId}_platforms_{$platformType}_withLinks",)) ! ($found = cache("podcast#{$podcastId}_platforms_{$platformType}_withLinks"))
) { ) {
$found = $this->select( $found = $this->select(
'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player',
@ -129,7 +129,7 @@ class PlatformModel extends Model
$found = $this->select( $found = $this->select(
'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player',
) )
->join('podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug',) ->join('podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug')
->where('podcasts_platforms.podcast_id', $podcastId) ->where('podcasts_platforms.podcast_id', $podcastId)
->where('platforms.type', $platformType) ->where('platforms.type', $platformType)
->findAll(); ->findAll();

View File

@ -175,7 +175,7 @@ class PodcastModel extends Model
$cacheName = "user{$userId}_podcasts"; $cacheName = "user{$userId}_podcasts";
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$found = $this->select('podcasts.*') $found = $this->select('podcasts.*')
->join('podcasts_users', 'podcasts_users.podcast_id = podcasts.id',) ->join('podcasts_users', 'podcasts_users.podcast_id = podcasts.id')
->where('podcasts_users.user_id', $userId) ->where('podcasts_users.user_id', $userId)
->findAll(); ->findAll();
@ -268,7 +268,7 @@ class PodcastModel extends Model
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$episodeModel = new EpisodeModel(); $episodeModel = new EpisodeModel();
$found = $episodeModel $found = $episodeModel
->select('YEAR(published_at) as year, count(*) as number_of_episodes',) ->select('YEAR(published_at) as year, count(*) as number_of_episodes')
->where([ ->where([
'podcast_id' => $podcastId, 'podcast_id' => $podcastId,
'season_number' => null, 'season_number' => null,

View File

@ -29,7 +29,7 @@ class UserModel extends MythAuthUserModel
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
$found = $this->select('users.*, auth_groups.name as podcast_role') $found = $this->select('users.*, auth_groups.name as podcast_role')
->join('podcasts_users', 'podcasts_users.user_id = users.id') ->join('podcasts_users', 'podcasts_users.user_id = users.id')
->join('auth_groups', 'auth_groups.id = podcasts_users.group_id',) ->join('auth_groups', 'auth_groups.id = podcasts_users.group_id')
->where('podcasts_users.podcast_id', $podcastId) ->where('podcasts_users.podcast_id', $podcastId)
->findAll(); ->findAll();
@ -42,7 +42,7 @@ class UserModel extends MythAuthUserModel
public function getPodcastContributor(int $userId, int $podcastId): ?User public function getPodcastContributor(int $userId, int $podcastId): ?User
{ {
return $this->select('users.*, podcasts_users.podcast_id as podcast_id, auth_groups.name as podcast_role',) return $this->select('users.*, podcasts_users.podcast_id as podcast_id, auth_groups.name as podcast_role')
->join('podcasts_users', 'podcasts_users.user_id = users.id') ->join('podcasts_users', 'podcasts_users.user_id = users.id')
->join('auth_groups', 'auth_groups.id = podcasts_users.group_id') ->join('auth_groups', 'auth_groups.id = podcasts_users.group_id')
->where([ ->where([

View File

@ -40,7 +40,7 @@
<section class="max-w-2xl px-6 py-8 mx-auto space-y-8"> <section class="max-w-2xl px-6 py-8 mx-auto space-y-8">
<?php foreach ($notes as $note): ?> <?php foreach ($notes as $note): ?>
<?php if ($note->is_reblog): ?> <?php if ($note->reblog_of_id !== null): ?>
<?= view('podcast/_partials/reblog', [ <?= view('podcast/_partials/reblog', [
'note' => $note->reblog_of_note, 'note' => $note->reblog_of_note,
]) ?> ]) ?>

View File

@ -85,7 +85,7 @@
<div class="space-y-8"> <div class="space-y-8">
<?php foreach ($notes as $note): ?> <?php foreach ($notes as $note): ?>
<?php if ($note->is_reblog): ?> <?php if ($note->reblog_of_id !== null): ?>
<?= view('podcast/_partials/reblog_authenticated', [ <?= view('podcast/_partials/reblog_authenticated', [
'note' => $note->reblog_of_note, 'note' => $note->reblog_of_note,
]) ?> ]) ?>