UX: Better display for deleted users in the review queue

UX: Better display for deleted users in the review queue

diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-created-by-name.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-created-by-name.hbs
new file mode 100644
index 0000000..e2f2afd
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-created-by-name.hbs
@@ -0,0 +1,12 @@
+<div class='names'>
+  <span class="username">
+    {{#if user}}
+      {{#user-link user=user}}{{user.username}}{{/user-link}}
+      {{#if user.silenced}}
+        {{d-icon "ban" title="user.silenced_tooltip"}}
+      {{/if}}
+    {{else}}
+      {{i18n "review.deleted_user"}}
+    {{/if}}
+  </span>
+</div>
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-created-by.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-created-by.hbs
new file mode 100644
index 0000000..be0d081
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-created-by.hbs
@@ -0,0 +1,7 @@
+<div class='created-by'>
+  {{#if user}}
+    {{#user-link user=user}}{{avatar user imageSize="large"}}{{/user-link}}
+  {{else}}
+    {{fa-icon "far-trash-alt" class="deleted-user-avatar"}}
+  {{/if}}
+</div>
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs
index f7dc947..b25387a 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs
@@ -1,18 +1,7 @@
-<div class='created-by'>
-  {{#user-link user=reviewable.target_created_by}}
-    {{avatar reviewable.target_created_by imageSize="large"}}
-  {{/user-link}}
-</div>
+{{reviewable-created-by user=reviewable.target_created_by tagName=''}}
 
 <div class='post-contents'>
-  <div class='names'>
-    <span class="username">
-      {{#user-link user=reviewable.target_created_by}}
-        {{reviewable.target_created_by.username}}
-      {{/user-link}}
-    </span>
-  </div>
-
+  {{reviewable-created-by-name user=reviewable.target_created_by tagName=''}}
   {{reviewable-topic-link topic=reviewable.topic}}
 
   <div class='post-body'>
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
index 54a03fc..5c5279a 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs
@@ -1,20 +1,7 @@
-<div class='created-by'>
-  {{#user-link user=reviewable.created_by}}
-    {{avatar reviewable.created_by imageSize="large"}}
-  {{/user-link}}
-</div>
+{{reviewable-created-by user=reviewable.created_by tagName=''}}
 
 <div class='post-contents'>
-  <div class='names'>
-    <span class="username">
-      {{#user-link user=reviewable.created_by}}
-        {{reviewable.created_by.username}}
-      {{/user-link}}
-      {{#if reviewable.created_by.silenced}}
-        {{d-icon "ban" title="user.silenced_tooltip"}}
-      {{/if}}
-    </span>
-  </div>
+  {{reviewable-created-by-name user=reviewable.created_by tagName=''}}
 
   {{#reviewable-topic-link topic=reviewable.topic}}
     {{i18n "review.new_topic"}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e89fa65..22e66bf 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -372,6 +372,7 @@ en:
       filtered_topic: "You have filtered to reviewable content in a single topic."
       filtered_user: "User:"
       show_all_topics: "show all topics"
+      deleted_user: "(deleted user)"
       user_percentage:
         summary:
           one: "{{agreed}}, {{disagreed}}, {{ignored}} ({{count}} total flag)"

GitHub sha: a55e7ebe

1 Like