Early return from org follow check (#20761)
* Early return from org follow check * Adjust podcast follow button * Move early return to later
This commit is contained in:
parent
501b900108
commit
f4b94ce7f2
5 changed files with 7 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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") %>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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") %>
|
||||
</button>
|
||||
</h2>
|
||||
<% if @episode.title.size > 60 %>
|
||||
|
|
|
|||
|
|
@ -34,3 +34,4 @@ en:
|
|||
latest_episodes: Latest episodes
|
||||
suggest_a_podcast: Suggest a Podcast
|
||||
view_all_podcasts: View all podcasts
|
||||
follow: Follow
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue