diff --git a/app/javascript/packs/followButtons.js b/app/javascript/packs/followButtons.js index 18f68b13b..2ad625f96 100644 --- a/app/javascript/packs/followButtons.js +++ b/app/javascript/packs/followButtons.js @@ -416,7 +416,6 @@ function initializeNonUserFollowButtons() { document.body.getAttribute('data-user-status') === 'logged-in'; const user = userLoggedIn ? userData() : null; - const followedTags = user ? JSON.parse(user.followed_tags).map((tag) => tag.id) : []; @@ -428,6 +427,9 @@ function initializeNonUserFollowButtons() { const buttonInfo = JSON.parse(info); const { className, name } = buttonInfo; addAriaLabelToButton({ button, followType: className, followName: name }); + if (user === null) { + return; // No need to fetch the status if the user is logged out + } if (className === 'Tag' && user) { // We don't need to make a network request to 'fetch' the status of tag buttons button.dataset.fetched = true; diff --git a/app/views/podcast_episodes/index.html.erb b/app/views/podcast_episodes/index.html.erb index 6e3c7949d..a1bf6f363 100644 --- a/app/views/podcast_episodes/index.html.erb +++ b/app/views/podcast_episodes/index.html.erb @@ -21,7 +21,7 @@ class="crayons-btn crayons-btn--inverted follow-action-button" style="min-width: 100px;" data-info='<%= DataInfo.to_json(object: @podcast) %>'> -   + <%= t("views.podcasts.follow") %>

diff --git a/app/views/podcast_episodes/show.html.erb b/app/views/podcast_episodes/show.html.erb index 7dcfa754e..8b8418955 100644 --- a/app/views/podcast_episodes/show.html.erb +++ b/app/views/podcast_episodes/show.html.erb @@ -39,7 +39,7 @@ id="user-follow-butt" class="crayons-btn follow-action-button" data-info='<%= DataInfo.to_json(object: @podcast) %>'> -   + <%= t("views.podcasts.follow") %> <% if @episode.title.size > 60 %> diff --git a/config/locales/views/podcasts/en.yml b/config/locales/views/podcasts/en.yml index 0bf92f053..c0852d3d4 100644 --- a/config/locales/views/podcasts/en.yml +++ b/config/locales/views/podcasts/en.yml @@ -34,3 +34,4 @@ en: latest_episodes: Latest episodes suggest_a_podcast: Suggest a Podcast view_all_podcasts: View all podcasts + follow: Follow diff --git a/config/locales/views/podcasts/fr.yml b/config/locales/views/podcasts/fr.yml index ac7d5d845..c79c5af0c 100644 --- a/config/locales/views/podcasts/fr.yml +++ b/config/locales/views/podcasts/fr.yml @@ -34,3 +34,4 @@ fr: latest_episodes: Épisodes Récents suggest_a_podcast: Suggérer un podcast view_all_podcasts: Voir tous les podcasts + follow: Follow \ No newline at end of file