Skip to content
Snippets Groups Projects
Commit 92d5cc50 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(home): remove hardcoded prefix in getAllPodcasts query

parent b5c0b720
No related branches found
No related tags found
No related merge requests found
...@@ -178,10 +178,10 @@ class PodcastModel extends Model ...@@ -178,10 +178,10 @@ class PodcastModel extends Model
if ($orderBy === 'activity') { if ($orderBy === 'activity') {
$prefix = $this->db->getPrefix(); $prefix = $this->db->getPrefix();
$fediverseTablePrefix = config('Fediverse') $fediverseTablePrefix = $prefix . config('Fediverse')
->tablesPrefix; ->tablesPrefix;
$this->select( $this->select(
'podcasts.*, MAX(' . $prefix . $fediverseTablePrefix . 'posts.published_at' . ') as max_published_at' 'podcasts.*, MAX(' . $fediverseTablePrefix . 'posts.published_at' . ') as max_published_at'
) )
->join( ->join(
$fediverseTablePrefix . 'posts', $fediverseTablePrefix . 'posts',
...@@ -189,11 +189,11 @@ class PodcastModel extends Model ...@@ -189,11 +189,11 @@ class PodcastModel extends Model
'left' 'left'
) )
->where( ->where(
'`' . $prefix . $fediverseTablePrefix . 'posts`.`published_at` <= UTC_TIMESTAMP()', '`' . $fediverseTablePrefix . 'posts`.`published_at` <= UTC_TIMESTAMP()',
null, null,
false false
)->orWhere($fediverseTablePrefix . 'posts.published_at', null) )->orWhere($fediverseTablePrefix . 'posts.published_at', null)
->groupBy('cp_podcasts.actor_id') ->groupBy('podcasts.actor_id')
->orderBy('max_published_at', 'DESC'); ->orderBy('max_published_at', 'DESC');
} elseif ($orderBy === 'created_desc') { } elseif ($orderBy === 'created_desc') {
$this->orderBy('created_at', 'DESC'); $this->orderBy('created_at', 'DESC');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment