feat(UI): Fallback to username where ever display name is shown

This commit is contained in:
Stephen Burgess 2018-06-12 07:17:02 -05:00
parent 4b0114917d
commit df0fcb886d
4 changed files with 29 additions and 9 deletions

View File

@ -1,7 +1,12 @@
{% macro post_card(article) %} {% macro post_card(article) %}
{% if article.author.display_name %}
{% set name = article.author.display_name %}
{% else %}
{% set name = article.author.username %}
{% endif %}
<div class="card"> <div class="card">
<h3><a href="{{ article.url }}">{{ article.post.title }}</a></h3> <h3><a href="{{ article.url }}">{{ article.post.title }}</a></h3>
<main><p>{{ article.post.content | striptags | truncate(length=200) }}</p></main> <main><p>{{ article.post.content | striptags | truncate(length=200) }}</p></main>
<p>By <a href="/@/{{ article.author.fqn }}/">{{ article.author.display_name }}</a> ⋅ {{ article.date | date(format="%B %e") }}</p> <p>By <a href="/@/{{ article.author.fqn }}/">{{ name }}</a> ⋅ {{ article.date | date(format="%B %e") }}</p>
</div> </div>
{% endmacro post_card %} {% endmacro post_card %}

View File

@ -55,12 +55,12 @@
<div class="list"> <div class="list">
{% for comment in comments %} {% for comment in comments %}
{% if comment.author.display_name %} {% if comment.author.display_name %}
{% set commentAuthorName = comment.author.display_name %} {% set comment_author_name = comment.author.display_name %}
{% else %} {% else %}
{% set commentAuthorName = comment.author.username %} {% set comment_author_name = comment.author.username %}
{% endif %} {% endif %}
<div class="card" id="comment-{{ comment.id }}"> <div class="card" id="comment-{{ comment.id }}">
<b>{{ name }}</b> <b>{{ comment_author_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>

View File

@ -2,13 +2,17 @@
{% import "macros" as macros %} {% import "macros" as macros %}
{% block title %} {% block title %}
{{ user.display_name }} {% if author.display_name %}
{% set name = author.display_name %}
{% else %}
{% set name = user.username %}
{% endif %}
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
<div> <div>
<h1> <h1>
{{ user.display_name }} {{ name }}
{% if user.is_admin %} {% if user.is_admin %}
<span class="badge">Admin</span> <span class="badge">Admin</span>
{% endif %} {% endif %}

View File

@ -1,13 +1,19 @@
{% extends "base" %} {% extends "base" %}
{% block title %} {% block title %}
{{ user.display_name }}'s Followers {% if user.display_name %}
{% set name = user.display_name %}
{% else %}
{% set name = user.username %}
{% endif %}
{{ name }}'s Followers
{% endblock title %} {% endblock title %}
{% block content %} {% block content %}
<div> <div>
<h1> <h1>
{{ user.display_name }} {{ name }}
{% if user.is_admin %} {% if user.is_admin %}
<span class="badge">Admin</span> <span class="badge">Admin</span>
{% endif %} {% endif %}
@ -21,8 +27,13 @@
<h2>Followers</h2> <h2>Followers</h2>
<div class="cards"> <div class="cards">
{% for follower in followers %} {% for follower in followers %}
{% if follower.display_name %}
{% set follower_name = follower.display_name %}
{% else %}
{% set follower_name = follower.username %}
{% endif %}
<div class="card"> <div class="card">
<h3><a href="{{ follower.ap_url }}/">{{ follower.display_name }}</a> &mdash; @{{ follower.fqn }}</h3> <h3><a href="{{ follower.ap_url }}/">{{ follower_name }}</a> &mdash; @{{ follower.fqn }}</h3>
<main><p>{{ follower.summary | safe }}</p></main> <main><p>{{ follower.summary | safe }}</p></main>
</div> </div>
{% endfor %} {% endfor %}