Commit b1303c52 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(premium-podcasts): return different cached page when podcast is unlocked

- clear podcast cache when setting subscription link
- update and add missing translation keys
parent 65173e51
Loading
Loading
Loading
Loading
Loading
+25 −10
Original line number Diff line number Diff line
@@ -70,11 +70,18 @@ class EpisodeController extends BaseController
            $this->registerPodcastWebpageHit($this->episode->podcast_id);
        }

        $locale = service('request')
            ->getLocale();
        $cacheName =
            "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_{$locale}" .
            (can_user_interact() ? '_authenticated' : '');
        $cacheName = implode(
            '_',
            array_filter([
                'page',
                "podcast#{$this->podcast->id}",
                "episode#{$this->episode->id}",
                service('request')
                    ->getLocale(),
                is_unlocked($this->podcast->handle) ? 'unlocked' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

        if (! ($cachedView = cache($cacheName))) {
            $data = [
@@ -112,11 +119,19 @@ class EpisodeController extends BaseController
            $this->registerPodcastWebpageHit($this->episode->podcast_id);
        }

        $locale = service('request')
            ->getLocale();
        $cacheName =
            "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_activity_{$locale}" .
            (can_user_interact() ? '_authenticated' : '');
        $cacheName = implode(
            '_',
            array_filter([
                'page',
                "podcast#{$this->podcast->id}",
                "episode#{$this->episode->id}",
                'activity',
                service('request')
                    ->getLocale(),
                is_unlocked($this->podcast->handle) ? 'unlocked' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

        if (! ($cachedView = cache($cacheName))) {
            $data = [
+3 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ class PodcastController extends BaseController
                'activity',
                service('request')
                    ->getLocale(),
                is_unlocked($this->podcast->handle) ? 'unlocked' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );
@@ -122,6 +123,7 @@ class PodcastController extends BaseController
                'about',
                service('request')
                    ->getLocale(),
                is_unlocked($this->podcast->handle) ? 'unlocked' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );
@@ -188,6 +190,7 @@ class PodcastController extends BaseController
                $seasonQuery ? 'season' . $seasonQuery : null,
                service('request')
                    ->getLocale(),
                is_unlocked($this->podcast->handle) ? 'unlocked' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );
+1 −0
Original line number Diff line number Diff line
@@ -47,4 +47,5 @@ return [
    'video-clips' => 'video clips',
    'embed' => 'embeddable player',
    'notifications' => 'notifications',
    'suspend' => 'suspend',
];
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ return [
            'bonus_hint' => 'Extra content for the show (for example, behind the scenes info or interviews with the cast) or cross-promotional content for another show',
        ],
        'premium_title' => 'Premium',
        'premium' => 'Episode must only be accessible to premium subscribers',
        'premium' => 'Episode must be accessible to premium subscribers only',
        'parental_advisory' => [
            'label' => 'Parental advisory',
            'hint' => 'Does the episode contain explicit content?',
+5 −5
Original line number Diff line number Diff line
@@ -99,17 +99,17 @@ $routes->group(
                    ],
                );
                $routes->get(
                    'remove',
                    'SubscriptionController::remove/$1/$2',
                    'delete',
                    'SubscriptionController::delete/$1/$2',
                    [
                        'as' => 'subscription-remove',
                        'as' => 'subscription-delete',
                        'filter' =>
                            'permission:podcast-manage_subscriptions',
                    ],
                );
                $routes->post(
                    'remove',
                    'SubscriptionController::attemptRemove/$1/$2',
                    'delete',
                    'SubscriptionController::attemptDelete/$1/$2',
                    [
                        'filter' =>
                            'permission:podcast-manage_subscriptions',
Loading