Create new changes from the UI as drafts
When creating a new change from the UI, the initial patch set is empty and the change remains empty until the user adds files and publishes an edit via the inline editor. However the change is visible to reviewers, which is not ideal because usually the owner will not want the change to be reviewed until the content is added. Change the behavior of the project screen's "Create Change" button and the change screen's "Follow Up" button to always create new changes as draft. With this change, the new change is created as draft and any subsequent patch sets created via the inline editor are also created as draft. This means that the change owner can publish as many edits as necessary to get the change in shape before publishing it for review. Change-Id: I33a3cccb0c872d69aa6f61d0eb22d3f4fe068834
This commit is contained in:
		| @@ -35,7 +35,7 @@ class CreateChangeAction { | ||||
|  | ||||
|       @Override | ||||
|       public void onSend() { | ||||
|         ChangeApi.createChange(project, getDestinationBranch(), | ||||
|         ChangeApi.createDraftChange(project, getDestinationBranch(), | ||||
|           message.getText(), null, | ||||
|           new GerritCallback<ChangeInfo>() { | ||||
|             @Override | ||||
|   | ||||
| @@ -35,7 +35,7 @@ class FollowUpAction extends ActionMessageBox { | ||||
|  | ||||
|   @Override | ||||
|   void send(String message) { | ||||
|     ChangeApi.createChange(project, branch, message, base, | ||||
|     ChangeApi.createDraftChange(project, branch, message, base, | ||||
|         new GerritCallback<ChangeInfo>() { | ||||
|           @Override | ||||
|           public void onSuccess(ChangeInfo result) { | ||||
|   | ||||
| @@ -20,6 +20,7 @@ import com.google.gerrit.client.changes.ChangeInfo.IncludedInInfo; | ||||
| import com.google.gerrit.client.rpc.CallbackGroup.Callback; | ||||
| import com.google.gerrit.client.rpc.NativeString; | ||||
| import com.google.gerrit.client.rpc.RestApi; | ||||
| import com.google.gerrit.reviewdb.client.Change; | ||||
| import com.google.gerrit.reviewdb.client.PatchSet; | ||||
| import com.google.gwt.core.client.JavaScriptObject; | ||||
| import com.google.gwt.user.client.rpc.AsyncCallback; | ||||
| @@ -36,14 +37,15 @@ public class ChangeApi { | ||||
|     call(id, "abandon").post(input, cb); | ||||
|   } | ||||
|  | ||||
|   /** Create a new change. */ | ||||
|   public static void createChange(String project, String branch, | ||||
|   /** Create a draft change. */ | ||||
|   public static void createDraftChange(String project, String branch, | ||||
|       String subject, String base, AsyncCallback<ChangeInfo> cb) { | ||||
|     CreateChangeInput input = CreateChangeInput.create(); | ||||
|     input.project(emptyToNull(project)); | ||||
|     input.branch(emptyToNull(branch)); | ||||
|     input.subject(emptyToNull(subject)); | ||||
|     input.base_change(emptyToNull(base)); | ||||
|     input.status(Change.Status.DRAFT.toString()); | ||||
|  | ||||
|     new RestApi("/changes/").post(input, cb); | ||||
|   } | ||||
| @@ -224,6 +226,7 @@ public class ChangeApi { | ||||
|     public final native void project(String p) /*-{ if(p)this.project=p; }-*/; | ||||
|     public final native void subject(String s) /*-{ if(s)this.subject=s; }-*/; | ||||
|     public final native void base_change(String b) /*-{ if(b)this.base_change=b; }-*/; | ||||
|     public final native void status(String s)  /*-{ if(s)this.status=s; }-*/; | ||||
|  | ||||
|     protected CreateChangeInput() { | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Pursehouse
					David Pursehouse