diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index ec74b1ca..e95babcc 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -370,6 +370,11 @@ impl User { pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value { let mut json = serde_json::to_value(self).unwrap(); json["fqn"] = serde_json::Value::String(self.get_fqn(conn)); + json["name"] = if self.display_name.len() > 0 { + json!(self.display_name) + } else { + json!(self.get_fqn(conn)) + }; json } diff --git a/templates/blogs/details.html.tera b/templates/blogs/details.html.tera index 9c484f60..8a639f39 100644 --- a/templates/blogs/details.html.tera +++ b/templates/blogs/details.html.tera @@ -11,12 +11,7 @@

{{ "{{ count }} authors in this blog: " | _n(singular="One author in this blog: ", count = n_authors) }} {% for author in authors %} - {% if author.display_name %} - {% set name = author.display_name %} - {% else %} - {% set name = author.username %} - {% endif %} - {{ name }}{% if not loop.last %},{% endif %} + {{ author.name }}{% if not loop.last %},{% endif %} {% endfor %}

diff --git a/templates/macros.html.tera b/templates/macros.html.tera index 48fbb110..50a192e4 100644 --- a/templates/macros.html.tera +++ b/templates/macros.html.tera @@ -1,9 +1,4 @@ {% macro post_card(article) %} - {% if article.author.display_name %} - {% set name = article.author.display_name %} - {% else %} - {% set name = article.author.username %} - {% endif %}

{{ article.post.title }}

- {{ comm.author.display_name | default(value=comm.author.username) }} + {{ comm.author.name }} @{{ comm.author.username }}
{{ comm.content | safe }}
diff --git a/templates/notifications/index.html.tera b/templates/notifications/index.html.tera index a6ba98d1..b608da1b 100644 --- a/templates/notifications/index.html.tera +++ b/templates/notifications/index.html.tera @@ -14,7 +14,7 @@

- {{ "{{ user }} commented your article." | _(user=notification.object.user.display_name | escape) }} + {{ "{{ user }} commented your article." | _(user=notification.object.user.name | escape) }}

{{ notification.object.post.post.title }}

@@ -24,7 +24,7 @@

- {{ "{{ user }} is now following you." | _(user=notification.object.follower.display_name | escape) }} + {{ "{{ user }} is now following you." | _(user=notification.object.follower.name | escape) }}

{{ notification.creation_date | date(format="%B %e, %H:%m") }}

@@ -33,7 +33,7 @@

- {{ "{{ user }} liked your article." | _(user=notification.object.user.display_name | escape) }} + {{ "{{ user }} liked your article." | _(user=notification.object.user.name | escape) }}

{{ notification.object.post.post.title }}

@@ -43,7 +43,7 @@

- {{ "{{ user }} mentioned you." | _(user=notification.object.user.display_name | escape) }} + {{ "{{ user }} mentioned you." | _(user=notification.object.user.name | escape) }}

{{ notification.creation_date | date(format="%B %e, %H:%m") }}

@@ -52,7 +52,7 @@

- {{ "{{ user }} reshared your article." | _(user=notification.object.user.display_name | escape) }} + {{ "{{ user }} reshared your article." | _(user=notification.object.user.name | escape) }}

{{ notification.object.post.post.title }}

diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index cc893adc..0ac3f44f 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -12,18 +12,11 @@ {% block content %}

{{ post.title }}

{{ "Followers" | _ }}

{% for follower in followers %} - {% if follower.display_name %} - {% set follower_name = follower.display_name %} - {% else %} - {% set follower_name = follower.username %} - {% endif %}
-

{{ follower_name }} @{{ follower.fqn }}

+

{{ follower.name }} @{{ follower.fqn }}

{{ follower.summary | safe }}

{% endfor %} diff --git a/templates/users/header.html.tera b/templates/users/header.html.tera index 155081b0..8f66eb69 100644 --- a/templates/users/header.html.tera +++ b/templates/users/header.html.tera @@ -1,6 +1,6 @@

- {{ name }} + {{ user.name }} {% if user.is_admin %} {{ "Admin" | _ }} {% endif %}