diff --git a/bookwyrm/templates/feed/status.html b/bookwyrm/templates/feed/status.html index 8f354fb8d..5febf4e22 100644 --- a/bookwyrm/templates/feed/status.html +++ b/bookwyrm/templates/feed/status.html @@ -1,5 +1,6 @@ {% extends 'feed/layout.html' %} {% load i18n %} +{% load bookwyrm_tags %} {% block panel %}
@@ -12,13 +13,13 @@
{% for parent in ancestors %} - {% if parent %} + {% if parent.id %}
- {% include 'snippets/status/status.html' with status=parent %} + {% include 'snippets/status/status.html' with status=parent|load_subclass %}
{% endif %} {% endfor %} -
+
{% include 'snippets/status/status.html' with status=status main=True %}
diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index e683f9c24..2e03c13b4 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -53,18 +53,24 @@ def get_next_shelf(current_shelf): return "to-read" +@register.filter(name="load_subclass") +def load_subclass(status): + """sometimes you didn't select_subclass""" + if hasattr(status, "quotation"): + return status.quotation + if hasattr(status, "review"): + return status.review + if hasattr(status, "comment"): + return status.comment + return status + + @register.simple_tag(takes_context=False) def related_status(notification): """for notifications""" if not notification.related_status: return None - if hasattr(notification.related_status, "quotation"): - return notification.related_status.quotation - if hasattr(notification.related_status, "review"): - return notification.related_status.review - if hasattr(notification.related_status, "comment"): - return notification.related_status.comment - return notification.related_status + return load_subclass(notification.related_status) @register.simple_tag(takes_context=True)