ChangeScreen2: Display draft comments in the reply box

Display all pending draft comments between the label radio buttons
and the Send/Cancel button row.  Use a scrolling panel to keep the
box from exploding in height when there are many comments.

Include the comments in the /review POST body and do not publish
anything other than what was displayed on the UI.

Change-Id: I5d749ef1276aed04d603da45e618210c3a557a00
This commit is contained in:
Shawn Pearce
2013-11-23 22:42:12 -08:00
parent 0ca2b59c89
commit ca1539796f
5 changed files with 111 additions and 4 deletions

View File

@@ -14,31 +14,59 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.client.rpc.NativeMap;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
public class ReviewInput extends JavaScriptObject {
public static enum NotifyHandling {
NONE, OWNER, OWNER_REVIEWERS, ALL
}
public static enum DraftHandling {
DELETE, PUBLISH, KEEP
}
public static ReviewInput create() {
ReviewInput r = createObject().cast();
r.init();
r.drafts(DraftHandling.PUBLISH);
return r;
}
public final native void message(String m) /*-{ if(m)this.message=m; }-*/;
public final native void label(String n, short v) /*-{ this.labels[n]=v; }-*/;
public final native void comments(NativeMap<JsArray<CommentInfo>> m)
/*-{ this.comments=m }-*/;
public final void notify(NotifyHandling e) {
_notify(e.name());
}
private final native void _notify(String n) /*-{ this.notify=n; }-*/;
public final void drafts(DraftHandling e) {
_drafts(e.name());
}
private final native void _drafts(String n) /*-{ this.drafts=n; }-*/;
private final native void init() /*-{
this.labels = {};
this.strict_labels = true;
this.drafts = 'PUBLISH';
}-*/;
public final native void prePost() /*-{
var m=this.comments;
if (m) {
for (var p in m) {
var l=m[p];
for (var i=0;i<l.length;i++) {
var c=l[i];
delete c['kind'];
delete c['path'];
delete c['updated'];
}
}
}
}-*/;
protected ReviewInput() {