diff --git a/app/Controllers/EpisodeController.php b/app/Controllers/EpisodeController.php
index ebfedc22..5465474e 100644
--- a/app/Controllers/EpisodeController.php
+++ b/app/Controllers/EpisodeController.php
@@ -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 = [
diff --git a/app/Controllers/PodcastController.php b/app/Controllers/PodcastController.php
index 1242e910..4e2450f4 100644
--- a/app/Controllers/PodcastController.php
+++ b/app/Controllers/PodcastController.php
@@ -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,
]),
);
diff --git a/modules/Admin/Language/en/Breadcrumb.php b/modules/Admin/Language/en/Breadcrumb.php
index 4b4cd3a0..46863af3 100644
--- a/modules/Admin/Language/en/Breadcrumb.php
+++ b/modules/Admin/Language/en/Breadcrumb.php
@@ -47,4 +47,5 @@ return [
'video-clips' => 'video clips',
'embed' => 'embeddable player',
'notifications' => 'notifications',
+ 'suspend' => 'suspend',
];
diff --git a/modules/Admin/Language/en/Episode.php b/modules/Admin/Language/en/Episode.php
index f800ee95..92631ddf 100644
--- a/modules/Admin/Language/en/Episode.php
+++ b/modules/Admin/Language/en/Episode.php
@@ -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?',
diff --git a/modules/PremiumPodcasts/Config/Routes.php b/modules/PremiumPodcasts/Config/Routes.php
index f657acf4..2859b596 100644
--- a/modules/PremiumPodcasts/Config/Routes.php
+++ b/modules/PremiumPodcasts/Config/Routes.php
@@ -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',
diff --git a/modules/PremiumPodcasts/Controllers/LockController.php b/modules/PremiumPodcasts/Controllers/LockController.php
index 8d57947e..2a507273 100644
--- a/modules/PremiumPodcasts/Controllers/LockController.php
+++ b/modules/PremiumPodcasts/Controllers/LockController.php
@@ -45,33 +45,15 @@ class LockController extends BaseController
public function index(): string
{
- $locale = service('request')
- ->getLocale();
- $cacheName =
- "page_podcast#{$this->podcast->id}_{$locale}_unlock" .
- (can_user_interact() ? '_authenticated' : '');
+ $data = [
+ // TODO: metatags for locked premium podcasts
+ 'metatags' => '',
+ 'podcast' => $this->podcast,
+ ];
- if (! ($cachedView = cache($cacheName))) {
- $data = [
- // TODO: metatags for locked premium podcasts
- 'metatags' => '',
- 'podcast' => $this->podcast,
- ];
+ helper('form');
- helper('form');
-
- if (can_user_interact()) {
- return view('podcast/unlock', $data);
- }
-
- // The page cache is set to a decade so it is deleted manually upon podcast update
- return view('podcast/unlock', $data, [
- 'cache' => DECADE,
- 'cache_name' => $cacheName,
- ]);
- }
-
- return $cachedView;
+ return view('podcast/unlock', $data);
}
public function attemptUnlock(): RedirectResponse
diff --git a/modules/PremiumPodcasts/Controllers/SubscriptionController.php b/modules/PremiumPodcasts/Controllers/SubscriptionController.php
index d5147f23..055de5b8 100644
--- a/modules/PremiumPodcasts/Controllers/SubscriptionController.php
+++ b/modules/PremiumPodcasts/Controllers/SubscriptionController.php
@@ -88,6 +88,10 @@ class SubscriptionController extends BaseController
service('settings')
->set('Subscription.link', $subscriptionLink, 'podcast:' . $this->podcast->id);
+ // clear cached podcast pages to render Call To Action
+ cache()
+ ->deleteMatching("page_podcast#{$this->podcast->id}*");
+
return redirect()->route('subscription-list', [$this->podcast->id])->with(
'message',
lang('Subscription.messages.linkSaveSuccess')
@@ -396,7 +400,7 @@ class SubscriptionController extends BaseController
);
}
- public function remove(): string
+ public function delete(): string
{
helper('form');
@@ -412,7 +416,7 @@ class SubscriptionController extends BaseController
return view('subscription/delete', $data);
}
- public function attemptRemove(): RedirectResponse
+ public function attemptDelete(): RedirectResponse
{
$db = db_connect();
$db->transStart();
@@ -423,15 +427,15 @@ class SubscriptionController extends BaseController
$email = service('email');
if (! $email->setTo($this->subscription->email)
- ->setSubject(lang('Subscription.emails.removed_subject', [], $this->podcast->language_code))
- ->setMessage(view('subscription/email/removed', [
+ ->setSubject(lang('Subscription.emails.deleted_subject', [], $this->podcast->language_code))
+ ->setMessage(view('subscription/email/deleted', [
'subscription' => $this->subscription,
]))->setMailType('html')
->send()) {
$db->transRollback();
return redirect()->route('subscription-list', [$this->podcast->id])->with(
'errors',
- [lang('Subscription.messages.removeError'), $email->printDebugger([])]
+ [lang('Subscription.messages.deleteError'), $email->printDebugger([])]
);
}
@@ -439,7 +443,7 @@ class SubscriptionController extends BaseController
return redirect()->route('subscription-list', [$this->podcast->id])->with(
'messages',
- lang('Subscription.messages.removeSuccess', [
+ lang('Subscription.messages.deleteSuccess', [
'subscriber' => $this->subscription->email,
])
);
diff --git a/modules/PremiumPodcasts/Language/en/Subscription.php b/modules/PremiumPodcasts/Language/en/Subscription.php
index 7371c8ab..f8af256f 100644
--- a/modules/PremiumPodcasts/Language/en/Subscription.php
+++ b/modules/PremiumPodcasts/Language/en/Subscription.php
@@ -60,8 +60,8 @@ return [
'editError' => 'Subscription could not be edited.',
'regenerateTokenSuccess' => 'Token regenerated! An email was sent to {subscriber} with the new token.',
'regenerateTokenError' => 'Token could not be regenerated.',
- 'removeSuccess' => 'Subscription was canceled! An email was sent to {subscriber} to tell him.',
- 'removeError' => 'Subscription could not be canceled.',
+ 'deleteSuccess' => 'Subscription was removed! An email was sent to {subscriber}.',
+ 'deleteError' => 'Subscription could not be removed.',
'suspendSuccess' => 'Subscription was suspended! An email was sent to {subscriber}.',
'suspendError' => 'Subscription could not be suspended.',
'resumeSuccess' => 'Subscription was resumed! An email was sent to {subscriber}.',
@@ -93,8 +93,8 @@ return [
'suspended_reason' => 'That is for the following reason: {0}',
'resumed_subject' => 'Your subscription has been resumed!',
'resumed' => 'Your subscription for {podcastTitle} has been resumed! You may access the podcast\'s premium episodes again.',
- 'removed_subject' => 'Your subscription has been removed!',
- 'removed' => 'Your subscription for {podcastTitle} has been removed! You no longer have access to the podcast\'s premium episodes.',
+ 'deleted_subject' => 'Your subscription has been removed!',
+ 'deleted' => 'Your subscription for {podcastTitle} has been removed! You no longer have access to the podcast\'s premium episodes.',
'footer' => '{castopod} hosted on {host}',
],
];
diff --git a/themes/cp_admin/subscription/email/removed.php b/themes/cp_admin/subscription/email/deleted.php
similarity index 87%
rename from themes/cp_admin/subscription/email/removed.php
rename to themes/cp_admin/subscription/email/deleted.php
index 909067dc..093b6156 100644
--- a/themes/cp_admin/subscription/email/removed.php
+++ b/themes/cp_admin/subscription/email/deleted.php
@@ -1,6 +1,6 @@
= lang('Subscription.emails.greeting', [], $subscription->podcast->language_code) ?>
-= lang('Subscription.emails.removed', [
+= lang('Subscription.emails.deleted', [
'podcastTitle' => '' . $subscription->podcast->title . '',
], $subscription->podcast->language_code, false) ?>
diff --git a/themes/cp_admin/subscription/list.php b/themes/cp_admin/subscription/list.php
index 3d09685e..c63833a6 100644
--- a/themes/cp_admin/subscription/list.php
+++ b/themes/cp_admin/subscription/list.php
@@ -94,7 +94,7 @@
[
'type' => 'link',
'title' => lang('Subscription.delete'),
- 'uri' => route_to('subscription-remove', $podcast->id, $subscription->id),
+ 'uri' => route_to('subscription-delete', $podcast->id, $subscription->id),
'class' => 'font-semibold text-red-600',
],
];
diff --git a/themes/cp_app/podcast/unlock.php b/themes/cp_app/podcast/unlock.php
index 1e89af15..78ec988c 100644
--- a/themes/cp_app/podcast/unlock.php
+++ b/themes/cp_app/podcast/unlock.php
@@ -75,7 +75,7 @@