UX: Unify reviewable scores + history

UX: Unify reviewable scores + history

diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs
index 80495bc..7631c0d 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs
@@ -30,10 +30,7 @@
       </div>
     {{else}}
       {{#component reviewableComponent reviewable=reviewable tagName=''}}
-        <div class='reviewable-scores-and-history'>
-          {{reviewable-scores reviewable=reviewable tagName=''}}
-          {{reviewable-histories histories=reviewable.reviewable_histories tagName=''}}
-        </div>
+        {{reviewable-scores reviewable=reviewable tagName=''}}
       {{/component}}
     {{/if}}
   </div>
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs
index 7d8a72e..2a75664 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs
@@ -1,5 +1,8 @@
 <tr class='reviewable-score'>
   <td>
+    {{format-date rs.created_at}}
+  </td>
+  <td>
     {{d-icon rs.score_type.icon}}
     {{title}}
     <span class="badge-notification new-posts score">{{format-score rs.score}}</span>
@@ -9,8 +12,6 @@
       {{avatar rs.user imageSize="tiny"}}
       {{rs.user.username}}
     {{/user-link}}
-  </td>
-  <td>
     {{user-flag-percentage
       agreed=rs.agree_stats.agreed
       disagreed=rs.agree_stats.disagreed
@@ -19,10 +20,21 @@
   <td>
     {{reviewable-status rs.status}}
   </td>
+  <td class='reviewed-by'>
+    {{#if rs.reviewed_by}}
+      {{#user-link user=rs.reviewed_by}}
+        {{avatar rs.reviewed_by imageSize="tiny"}}
+        {{rs.reviewed_by.username}}
+      {{/user-link}}
+      {{format-date rs.reviewed_at}}
+    {{else}}
+      &mdash;
+    {{/if}}
+  </td>
 </tr>
 {{#if rs.reviewable_conversation}}
   <tr>
-    <td colspan='3'>
+    <td colspan='4'>
       <div class='reviewable-conversation'>
         {{#each rs.reviewable_conversation.conversation_posts as |p index|}}
           {{reviewable-conversation-post post=p index=index}}
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs
index e811554..3ea03a1 100644
--- a/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs
+++ b/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs
@@ -1,5 +1,14 @@
 {{#if reviewable.reviewable_scores}}
   <table class='reviewable-scores'>
+    <thead>
+      <tr>
+        <th>{{i18n "review.scores.date"}}</th>
+        <th>{{i18n "review.scores.type"}}</th>
+        <th>{{i18n "review.scores.submitted_by"}}</th>
+        <th>{{i18n "review.scores.status"}}</th>
+        <th>{{i18n "review.scores.reviewed_by"}}</th>
+      </tr>
+    </thead>
     <tbody>
     {{#each reviewable.reviewable_scores as |rs|}}
       {{reviewable-score rs=rs reviewable=reviewable}}
diff --git a/app/assets/stylesheets/common/base/reviewables.scss b/app/assets/stylesheets/common/base/reviewables.scss
index 9a5821f..9d86d3a 100644
--- a/app/assets/stylesheets/common/base/reviewables.scss
+++ b/app/assets/stylesheets/common/base/reviewables.scss
@@ -224,15 +224,15 @@
   margin-top: 1em;
 }
 
-.reviewable-scores-and-history {
-  display: inline-block;
-  margin-top: 1em;
-}
-
 .reviewable-scores,
 .reviewable-histories {
   min-width: 50%;
 
+  .reviewed-by {
+    .date {
+      margin-left: 0.5em;
+    }
+  }
   .user {
     display: flex;
     align-items: center;
@@ -251,6 +251,11 @@
     line-height: $line-height-medium;
   }
 
+  thead {
+    th {
+      white-space: nowrap;
+    }
+  }
   tbody {
     border-width: 1px;
     td {
@@ -268,7 +273,7 @@
     }
     > tr > th,
     > tr > td {
-      padding: 0.5em;
+      padding: 0.5em 1em 0.5em 0.5em;
     }
   }
 }
diff --git a/app/controllers/reviewables_controller.rb b/app/controllers/reviewables_controller.rb
index 274e4ba..f91dcbf 100644
--- a/app/controllers/reviewables_controller.rb
+++ b/app/controllers/reviewables_controller.rb
@@ -180,7 +180,8 @@ protected
   def meta_types
     {
       created_by: 'user',
-      target_created_by: 'user'
+      target_created_by: 'user',
+      reviewed_by: 'user'
     }
   end
 
diff --git a/app/serializers/reviewable_score_serializer.rb b/app/serializers/reviewable_score_serializer.rb
index 8916599..c585689 100644
--- a/app/serializers/reviewable_score_serializer.rb
+++ b/app/serializers/reviewable_score_serializer.rb
@@ -2,10 +2,11 @@ require_dependency 'reviewable_score_type_serializer'
 
 class ReviewableScoreSerializer < ApplicationSerializer
 
-  attributes :id, :score, :agree_stats, :status
+  attributes :id, :score, :agree_stats, :status, :created_at, :reviewed_at
   has_one :user, serializer: BasicUserSerializer, root: 'users'
   has_one :score_type, serializer: ReviewableScoreTypeSerializer
   has_one :reviewable_conversation, serializer: ReviewableConversationSerializer
+  has_one :reviewed_by, serializer: BasicUserSerializer, root: 'users'
 
   def agree_stats
     {
diff --git a/app/serializers/reviewable_serializer.rb b/app/serializers/reviewable_serializer.rb
index ba86ea9..5719934 100644
--- a/app/serializers/reviewable_serializer.rb
+++ b/app/serializers/reviewable_serializer.rb
@@ -25,7 +25,6 @@ class ReviewableSerializer < ApplicationSerializer
   has_many :editable_fields, serializer: ReviewableEditableFieldSerializer, embed: :objects
   has_many :reviewable_scores, serializer: ReviewableScoreSerializer
   has_many :bundled_actions, serializer: ReviewableBundledActionSerializer
-  has_many :reviewable_histories, serializer: ReviewableHistorySerializer
 
   # Used to keep track of our payload attributes
   class_attribute :_payload_for_serialization
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 7833fe2..9b4c052 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -426,13 +426,13 @@ en:
         category: "Category:"
       conversation:
         view_full: "view full conversation"
-      history:
-        title: "History"
-        edited: "Edited"
       scores:
-        description: "Description"
-        score: "Score"
+        date: "Date"
+        type: "Type"
+        status: "Status"
         submitted_by: "Submitted By"
+        reviewed_by: "Reviewed By"
+
       statuses:
         pending:
           title: "Pending"

GitHub sha: 9ebfdaa3

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: