Commit 418a70b2 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(cache): suffix cache names with authenticated for credits, map and pages

parent 18ae557e
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -20,9 +20,12 @@ class CreditsController extends BaseController
    {
        $locale = service('request')
            ->getLocale();
        $allPodcasts = (new PodcastModel())->findAll();

        $cacheName = "page_credits_{$locale}";
        $cacheName = implode(
            '_',
            array_filter(['page', 'credits', $locale, can_user_interact() ? 'authenticated' : null]),
        );

        if (! ($found = cache($cacheName))) {
            $page = new Page([
                'title' => lang('Person.credits', [], $locale),
@@ -30,6 +33,7 @@ class CreditsController extends BaseController
                'content_markdown' => '',
            ]);

            $allPodcasts = (new PodcastModel())->findAll();
            $allCredits = (new CreditModel())->findAll();

            // Unlike the carpenter, we make a tree from a table:
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ class EpisodeCommentController extends BaseController
                "comment#{$this->comment->id}",
                service('request')
                    ->getLocale(),
                can_user_interact() ? '_authenticated' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

+11 −3
Original line number Diff line number Diff line
@@ -17,9 +17,17 @@ class MapController extends BaseController
{
    public function index(): string
    {
        $locale = service('request')
            ->getLocale();
        $cacheName = "page_map_{$locale}";
        $cacheName = implode(
            '_',
            array_filter([
                'page',
                'map',
                service('request')
                    ->getLocale(),
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

        if (! ($found = cache($cacheName))) {
            $found = view('pages/map', [], [
                'cache' => DECADE,
+11 −3
Original line number Diff line number Diff line
@@ -37,9 +37,17 @@ class PageController extends BaseController

    public function index(): string
    {
        $locale = service('request')
            ->getLocale();
        $cacheName = "page-{$this->page->slug}-{$locale}";
        $cacheName = implode(
            '_',
            array_filter([
                'page',
                $this->page->slug,
                service('request')
                    ->getLocale(),
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

        if (! ($found = cache($cacheName))) {
            $data = [
                'metatags' => get_page_metatags($this->page),
+3 −3
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ class PodcastController extends BaseController
                'activity',
                service('request')
                    ->getLocale(),
                can_user_interact() ? '_authenticated' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

@@ -122,7 +122,7 @@ class PodcastController extends BaseController
                'about',
                service('request')
                    ->getLocale(),
                can_user_interact() ? '_authenticated' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

@@ -188,7 +188,7 @@ class PodcastController extends BaseController
                $seasonQuery ? 'season' . $seasonQuery : null,
                service('request')
                    ->getLocale(),
                can_user_interact() ? '_authenticated' : null,
                can_user_interact() ? 'authenticated' : null,
            ]),
        );

Loading