Related Changes: Additionally add black dot based on state

It used to be the case that the
    (!info.hasChangeNumber() || !info.hasRevisionNumber()))
triggered on merged or abandoned changes. This is not the case any more
for all merged and abandoned changes, so we need to transport depend on
the state of the change directly to also mark those changes, not covered
by the condition as above.

Change-Id: I08f97c844d8981a3b400705108e494570d25fc78
This commit is contained in:
Stefan Beller
2015-06-18 11:40:18 -07:00
parent 3e8bd6e30d
commit 7e23cd08d3
3 changed files with 15 additions and 1 deletions

View File

@@ -536,12 +536,13 @@ result in a completely different related changes listing.
** [[closed-ancestor]]Black Dot:
+
Indicates a merged ancestor, e.g. the commit was directly pushed into
Indicates a closed ancestor, e.g. the commit was directly pushed into
the repository bypassing code review, or the ancestor change was
reviewed and submitted on another branch. The latter may indicate that
the user has accidentally pushed the commit to the wrong branch, e.g.
the commit was done on `branch-a`, but was then pushed to
`refs/for/branch-b`.
A black dot is also present if the change was abandoned.
+
image::images/user-review-ui-change-screen-related-changes-indicators.png[width=800, link="images/user-review-ui-change-screen-related-changes-indicators.png"]

View File

@@ -333,6 +333,7 @@ public class RelatedChanges extends TabPanel {
c.setBranch(i.branch());
c.setProject(i.project());
c.setSubmittable(i.submittable() && i.mergeable());
c.setStatus(i.status().asChangeStatus().toString());
arr.push(c);
}
}
@@ -356,6 +357,11 @@ public class RelatedChanges extends TabPanel {
final native String branch() /*-{ return this.branch }-*/;
final native String project() /*-{ return this.project }-*/;
final native boolean submittable() /*-{ return this._submittable ? true : false; }-*/;
final Change.Status status() {
String s = statusRaw();
return s != null ? Change.Status.valueOf(s) : null;
}
private final native String statusRaw() /*-{ return this.status; }-*/;
final native void setId(String i)
/*-{ if(i)this.change_id=i; }-*/;
@@ -409,6 +415,9 @@ public class RelatedChanges extends TabPanel {
final native void setSubmittable(boolean s)
/*-{ this._submittable=s; }-*/;
final native void setStatus(String s)
/*-{ if(s)this.status=s; }-*/;
protected ChangeAndCommit() {
}
}

View File

@@ -306,6 +306,10 @@ class RelatedChangesTab implements IsWidget {
sb.setStyleName(RelatedChanges.R.css().gitweb());
sb.setAttribute("title", gw.getLinkName());
sb.append('\u25CF'); // Unicode 'BLACK CIRCLE'
} else if (info.status() != null && !info.status().isOpen()) {
sb.setStyleName(RelatedChanges.R.css().gitweb());
sb.setAttribute("title", Util.toLongString(info.status()));
sb.append('\u25CF'); // Unicode 'BLACK CIRCLE'
} else if (notConnected) {
sb.setStyleName(RelatedChanges.R.css().indirect());
sb.setAttribute("title", Resources.C.indirectAncestor());