Show correct change status for draft patch sets

If a change is draft, the change status is correctly shown as
"Draft".  However if a new patch set is uploaded as draft to an
already published change, the draft status is not considered.

Add checks for the status of the currently viewed patch set, and
show the status as "Draft" as appropriate.

Bug: Issue 3478
Change-Id: Ic2bd739050a85d4897819162e6eee4633888c53f
This commit is contained in:
David Pursehouse
2015-08-03 15:05:18 +09:00
parent ca4f9a03a2
commit 4bc067eeb7

View File

@@ -1016,7 +1016,10 @@ public class ChangeScreen extends Screen {
}
private boolean isSubmittable(ChangeInfo info) {
boolean canSubmit = info.status().isOpen();
boolean canSubmit =
info.status().isOpen() &&
revision.equals(info.current_revision()) &&
!info.revision(revision).draft();
if (canSubmit && info.status() == Change.Status.NEW) {
for (String name : info.labels()) {
LabelInfo label = info.label(name);
@@ -1053,7 +1056,8 @@ public class ChangeScreen extends Screen {
statusText.setInnerText(Util.C.notCurrent());
labels.setVisible(false);
} else {
statusText.setInnerText(Util.toLongString(info.status()));
Status s = info.revision(revision).draft() ? Status.DRAFT : info.status();
statusText.setInnerText(Util.toLongString(s));
}
labels.set(info);