mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-17 23:08:32 +02:00
Fix groups with subgroups for logged-out viewers
This commit is contained in:
@@ -108,7 +108,7 @@
|
|||||||
{% set is_single_group = False %}
|
{% set is_single_group = False %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if is_single_group and subgroups %}
|
{% if request.user and is_single_group and subgroups %}
|
||||||
<div class="topic-listing-filter">
|
<div class="topic-listing-filter">
|
||||||
{% if all_subgroups %}
|
{% if all_subgroups %}
|
||||||
Includes topics from all subgroups.
|
Includes topics from all subgroups.
|
||||||
|
|||||||
@@ -178,14 +178,20 @@ def get_group_topics( # noqa
|
|||||||
group for group in request.query(Group).all() if group.path != "test"
|
group for group in request.query(Group).all() if group.path != "test"
|
||||||
]
|
]
|
||||||
subgroups = None
|
subgroups = None
|
||||||
|
include_subgroups = False
|
||||||
else:
|
else:
|
||||||
# otherwise, just topics from the single group that we're looking at
|
# otherwise, just topics from the single group that we're looking at
|
||||||
groups = [request.context]
|
groups = [request.context]
|
||||||
|
|
||||||
groups.extend([
|
if request.user:
|
||||||
sub.group for sub in request.user.subscriptions
|
groups.extend([
|
||||||
if sub.group.is_subgroup_of(request.context)
|
sub.group for sub in request.user.subscriptions
|
||||||
])
|
if sub.group.is_subgroup_of(request.context)
|
||||||
|
])
|
||||||
|
|
||||||
|
include_subgroups = all_subgroups
|
||||||
|
else:
|
||||||
|
include_subgroups = True
|
||||||
|
|
||||||
subgroups = (
|
subgroups = (
|
||||||
request.query(Group)
|
request.query(Group)
|
||||||
@@ -214,9 +220,7 @@ def get_group_topics( # noqa
|
|||||||
query = (
|
query = (
|
||||||
request.query(Topic)
|
request.query(Topic)
|
||||||
.join_all_relationships()
|
.join_all_relationships()
|
||||||
.inside_groups(
|
.inside_groups(groups, include_subgroups=include_subgroups)
|
||||||
groups, include_subgroups=not is_home_page and all_subgroups
|
|
||||||
)
|
|
||||||
.exclude_ignored()
|
.exclude_ignored()
|
||||||
.apply_sort_option(order)
|
.apply_sort_option(order)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user