Always set change status to NEW when a patch set gets published

When a draft patch set of a draft change gets published the status of
the change should change from DRAFT to NEW. Before this change the
change status was only updated when the draft patch set that was
published was the current patch set. This meant that if a previous
draft patch set was published the change stayed in status DRAFT and
the published patch set was not getting visible to other users. Also
for changes in status DRAFT the WebUI allows to delete the complete
change, which is failing if one of the patch sets was already
published. If the change status is correctly updated to NEW the WebUI
doesn't offer the deletion of the complete change anymore.

Change-Id: I252e11d25b72621d27d1439d59e8d9d795c10010
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-02-07 15:37:03 +01:00
parent 388ba60191
commit 2970f75eaf

View File

@@ -81,8 +81,7 @@ public class PublishDraft implements Callable<ReviewResult> {
new AtomicUpdate<Change>() {
@Override
public Change update(Change change) {
if (change.getStatus() == Change.Status.DRAFT
&& change.currentPatchSetId().equals(patchSetId)) {
if (change.getStatus() == Change.Status.DRAFT) {
change.setStatus(Change.Status.NEW);
ChangeUtil.updated(change);
return change;