Merge "ChangeScreen: Highlight selected outdated patch set"
diff --git a/Documentation/images/user-review-ui-change-screen-not-current.png b/Documentation/images/user-review-ui-change-screen-not-current.png
new file mode 100644
index 0000000..9a87c67
--- /dev/null
+++ b/Documentation/images/user-review-ui-change-screen-not-current.png
Binary files differ
diff --git a/Documentation/user-review-ui.txt b/Documentation/user-review-ui.txt
index 55bc0cb..57dca8c 100644
--- a/Documentation/user-review-ui.txt
+++ b/Documentation/user-review-ui.txt
@@ -391,6 +391,10 @@
 
 image::images/user-review-ui-change-screen-patch-sets.png[width=800, link="images/user-review-ui-change-screen-patch-sets.png"]
 
+Another indication is a highlighted drop-down label.
+
+image::images/user-review-ui-change-screen-not-current.png[width=800, link="images/user-review-ui-change-screen-not-current.png"]
+
 [[patch-set-drop-down]]
 The patch set drop-down list shows the list of patch sets and allows to
 switch between them. The patch sets are sorted in descending order so
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java
index 171a1df..294573b 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java
@@ -126,6 +126,7 @@
     String pushCertStatus();
     String replyBox();
     String selected();
+    String notCurrentPatchSet();
   }
 
   static ChangeScreen get(NativeEvent in) {
@@ -420,6 +421,14 @@
     }
   }
 
+  private void updatePatchSetsTextStyle(boolean isPatchSetCurrent) {
+    if (isPatchSetCurrent) {
+      patchSetsText.removeClassName(style.notCurrentPatchSet());
+    } else {
+      patchSetsText.addClassName(style.notCurrentPatchSet());
+    }
+  }
+
   private void initRevisionsAction(ChangeInfo info, String revision,
       NativeMap<ActionInfo> actions) {
     int currentPatchSet;
@@ -433,16 +442,22 @@
     }
 
     String currentlyViewedPatchSet;
-    if (info.revision(revision).id().equals("edit")) {
+    boolean isPatchSetCurrent = true;
+    String revisionId = info.revision(revision).id();
+    if (revisionId.equals("edit")) {
       currentlyViewedPatchSet =
           Resources.M.editPatchSet(RevisionInfo.findEditParent(info.revisions()
               .values()));
       currentPatchSet = info.revisions().values().length() - 1;
     } else {
-      currentlyViewedPatchSet = info.revision(revision).id();
+      currentlyViewedPatchSet = revisionId;
+      if (!currentlyViewedPatchSet.equals(Integer.toString(currentPatchSet))) {
+        isPatchSetCurrent = false;
+      }
     }
     patchSetsText.setInnerText(Resources.M.patchSets(
         currentlyViewedPatchSet, currentPatchSet));
+    updatePatchSetsTextStyle(isPatchSetCurrent);
     patchSetsAction = new PatchSetsAction(
         info.legacyId(), revision, edit,
         style, headerLine, patchSets);
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml
index 86f3bb3..2eb4ae9 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml
@@ -350,6 +350,10 @@
     .pushCertStatus {
       padding-left: 5px;
     }
+
+    .notCurrentPatchSet {
+      background-color: #FFA62F;
+    }
   </ui:style>
 
   <g:HTMLPanel styleName='{style.cs2}'>