do not show episide comment deault

This commit is contained in:
Jigsaw 2025-01-10 14:29:46 +00:00 committed by Henri Dickson
parent b7c04be712
commit bc272fb06c
3 changed files with 7 additions and 3 deletions

View file

@ -4,10 +4,11 @@
{% load mastodon %}
{% load duration %}
{% load user_actions %}
{% load comment_item %}
{% if item.class_name == "tvseason" and not request.GET.last %}
{% if item.all_episodes %}
<div class="season-picker">
<span class="season-number"><a class="current">{% trans "all" %}</a></span>
<span class="season-number"><a class="current">{% trans "season" %}</a></span>
{% for ep in item.all_episodes %}
<span class="season-number" id="ci_{{ ep.uuid }}">
<a hx-swap="innerHTML"

View file

@ -10,7 +10,7 @@
<span class="season-number">
<a hx-swap="innerHTML"
hx-get="{% url "catalog:comments" item.url_path item.uuid %}"
hx-target="#comments">{% trans "all" %}</a>
hx-target="#comments">{% trans "season" %}</a>
</span>
{% for ep in item.all_episodes %}
<span class="season-number" id="ci_{{ ep.uuid }}">

View file

@ -189,6 +189,9 @@ def review_list(request, item_path, item_uuid):
def comments(request, item_path, item_uuid):
item = get_object_or_404(Item, uid=get_uuid_or_404(item_uuid))
if item.class_name == "tvseason":
ids = [item.pk]
else:
ids = item.child_item_ids + [item.pk] + item.sibling_item_ids
queryset = Comment.objects.filter(item_id__in=ids).order_by("-created_time")
queryset = queryset.filter(q_piece_visible_to_user(request.user))