diff --git a/app/main/routes.py b/app/main/routes.py index 2356b3cf..b23ca282 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -218,7 +218,7 @@ def list_communities(): return render_template('list_communities.html', communities=communities, search=search_param, title=_('Communities'), SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, - next_url=next_url, prev_url=prev_url, + next_url=next_url, prev_url=prev_url, current_user=current_user, topics=topics, languages=languages, topic_id=topic_id, language_id=language_id, sort_by=sort_by, low_bandwidth=low_bandwidth, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), @@ -270,7 +270,7 @@ def list_local_communities(): return render_template('list_communities.html', communities=communities, search=search_param, title=_('Local Communities'), SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, - next_url=next_url, prev_url=prev_url, + next_url=next_url, prev_url=prev_url, current_user=current_user, topics=topics, languages=languages, topic_id=topic_id, language_id=language_id, sort_by=sort_by, low_bandwidth=low_bandwidth, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), @@ -322,7 +322,7 @@ def list_subscribed_communities(): return render_template('list_communities.html', communities=communities, search=search_param, title=_('Joined Communities'), SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, - next_url=next_url, prev_url=prev_url, + next_url=next_url, prev_url=prev_url, current_user=current_user, topics=topics, languages=languages, topic_id=topic_id, language_id=language_id, sort_by=sort_by, low_bandwidth=low_bandwidth, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), @@ -366,6 +366,10 @@ def list_not_subscribed_communities(): banned_from = communities_banned_from(current_user.id) if banned_from: communities = communities.filter(Community.id.not_in(banned_from)) + if current_user.hide_nsfw == 1: + communities = communities.filter(Community.nsfw == False) + if current_user.hide_nsfl == 1: + communities = communities.filter(Community.nsfl == False) communities = communities.order_by(text('community.' + sort_by)) @@ -383,7 +387,7 @@ def list_not_subscribed_communities(): return render_template('list_communities.html', communities=communities, search=search_param, title=_('Not Joined Communities'), SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, - next_url=next_url, prev_url=prev_url, + next_url=next_url, prev_url=prev_url, current_user=current_user, topics=topics, languages=languages, topic_id=topic_id, language_id=language_id, sort_by=sort_by, low_bandwidth=low_bandwidth, moderating_communities=moderating_communities(current_user.get_id()), menu_topics=menu_topics(), site=g.site) diff --git a/app/templates/list_communities.html b/app/templates/list_communities.html index 6ae9f83a..98416594 100644 --- a/app/templates/list_communities.html +++ b/app/templates/list_communities.html @@ -16,12 +16,14 @@ {{ _('Local') }} + {% if current_user.is_authenticated -%} {{ _('Joined') }} {{ _('Not Joined') }} + {% endif -%}