From d821a08cffb5cd96406dd7358db1a529e9d11c22 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 30 Dec 2020 16:33:04 -0800 Subject: [PATCH] include tags in replies I was against this but apparently it helps the replies actually WORK --- bookwyrm/templates/snippets/reply_form.html | 2 +- bookwyrm/templatetags/bookwyrm_tags.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/snippets/reply_form.html b/bookwyrm/templates/snippets/reply_form.html index 787a3ac5..8150b8a5 100644 --- a/bookwyrm/templates/snippets/reply_form.html +++ b/bookwyrm/templates/snippets/reply_form.html @@ -9,7 +9,7 @@ {% include 'snippets/content_warning_field.html' with parent_status=activity %}
- +
diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 61b097bd..89c1690a 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -110,7 +110,7 @@ def get_uuid(identifier): return '%s%s' % (identifier, uuid4()) -@register.filter(name="post_date") +@register.filter(name='post_date') def time_since(date): ''' concise time ago function ''' if not isinstance(date, datetime): @@ -133,13 +133,20 @@ def time_since(date): return '%ds' % delta.seconds -@register.filter(name="to_markdown") +@register.filter(name='to_markdown') def get_markdown(content): ''' convert markdown to html ''' if content: return to_markdown(content) return None +@register.filter(name='mentions') +def get_mentions(status, user): + ''' anyone tagged or replied to in this status ''' + mentions = set([status.user] + list(status.mention_users.all())) + return ' '.join( + '@' + get_user_identifier(m) for m in mentions if not m == user) + @register.simple_tag(takes_context=True) def active_shelf(context, book): ''' check what shelf a user has a book on, if any '''