From b06c664cd5eef40ad86e6b5c17774277c1b168ae Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Fri, 15 Feb 2019 20:09:32 -0500 Subject: [PATCH] Fix a crash on threads with filters --- brutaldon/templates/main/thread.html | 12 ++++++------ brutaldon/views.py | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/brutaldon/templates/main/thread.html b/brutaldon/templates/main/thread.html index 4e3f7c5..7566bd9 100644 --- a/brutaldon/templates/main/thread.html +++ b/brutaldon/templates/main/thread.html @@ -18,15 +18,15 @@ mastodon.status_context()

Thread

- {% for ancestor in context.ancestors %} - {% include "main/toot_partial.html" with toot=ancestor %} - + {% for ancestor in ancestors %} + {% include "main/toot_partial.html" with toot=ancestor %} + {% endfor %} {% include "main/toot_partial.html" with toot=toot active=True %} - {% for descendant in context.descendants %} - {% include "main/toot_partial.html" with toot=descendant %} - + {% for descendant in descendants %} + {% include "main/toot_partial.html" with toot=descendant %} + {% endfor %} {% if not preferences.no_javascript %} diff --git a/brutaldon/views.py b/brutaldon/views.py index 7fd8c02..30049a6 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -425,12 +425,14 @@ def thread(request, id): filters = get_filters(mastodon, context='thread') # Apply filters - context.ancestors = [x for x in context.ancestors if not toot_matches_filters(x, filters)] - context.descendants = [x for x in context.descendants if not toot_matches_filters(x, filters)] + ancestors = [x for x in context.ancestors if not toot_matches_filters(x, filters)] + descendants = [x for x in context.descendants if not toot_matches_filters(x, filters)] return render(request, 'main/thread.html', {'context': context, 'toot': toot, + 'ancestors': ancestors, + 'descendants': descendants, 'own_acct': request.session['user'], 'notifications': notifications, 'preferences': account.preferences})