include tags in replies

I was against this but apparently it helps the replies actually WORK
This commit is contained in:
Mouse Reeve 2020-12-30 16:33:04 -08:00
parent d42ebbaf4a
commit d821a08cff
2 changed files with 10 additions and 3 deletions

View file

@ -9,7 +9,7 @@
{% include 'snippets/content_warning_field.html' with parent_status=activity %}
<div class="field">
<textarea class="textarea" name="content" placeholder="Leave a comment..." id="id_content_{{ activity.id }}-{{ uuid }}" required="true"></textarea>
<textarea class="textarea" name="content" placeholder="Leave a comment..." id="id_content_{{ activity.id }}-{{ uuid }}" required="true">{{ activity|mentions:request.user }}</textarea>
</div>
</div>
<div class="column is-narrow">

View file

@ -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 '''