feat(Posts): Show username if no display name is present

This commit is contained in:
Stephen Burgess 2018-06-11 18:30:31 -05:00
parent eaf0622b86
commit 4ae19c6fa7

View File

@ -9,8 +9,13 @@
{% endblock header %} {% endblock header %}
{% block content %} {% block content %}
{% if author.display_name %}
{% set name = author.display_name %}
{% else %}
{% set name = author.username %}
{% endif %}
<p> <p>
<b>Written by <a href="/@/{{ author.fqn }}/">{{ author.display_name }}</a></b> <b>Written by <a href="/@/{{ author.fqn }}/">{{name }}</a></b>
&mdash; &mdash;
<span>{{ date | date(format="%B %e, %Y") }}</span> <span>{{ date | date(format="%B %e, %Y") }}</span>
</p> </p>
@ -49,8 +54,13 @@
<h2>Comments</h2> <h2>Comments</h2>
<div class="list"> <div class="list">
{% for comment in comments %} {% for comment in comments %}
{% if comment.author.display_name %}
{% set commentAuthorName = comment.author.display_name %}
{% else %}
{% set commentAuthorName = comment.author.username %}
{% endif %}
<div class="card" id="comment-{{ comment.id }}"> <div class="card" id="comment-{{ comment.id }}">
<b>{{ comment.author.display_name }}</b> <b>{{ name }}</b>
<div>{{ comment.content | safe }}</div> <div>{{ comment.content | safe }}</div>
<a href="comment?responding_to={{ comment.id }}">Respond</a> <a href="comment?responding_to={{ comment.id }}">Respond</a>
</div> </div>