ChangeScreen2: Display revision after posting review
Instead of displaying the current revision display the revision the review was commenting on. This keeps the UI roughly static, but updates the change history at the bottom of the screen. Change-Id: I67453230fd60fb6e57feb86293cdd9c6526d6a32
This commit is contained in:
@@ -17,7 +17,7 @@ package com.google.gerrit.client.change;
|
|||||||
import com.google.gerrit.client.changes.ChangeInfo;
|
import com.google.gerrit.client.changes.ChangeInfo;
|
||||||
import com.google.gerrit.client.changes.ChangeInfo.LabelInfo;
|
import com.google.gerrit.client.changes.ChangeInfo.LabelInfo;
|
||||||
import com.google.gerrit.client.rpc.NativeMap;
|
import com.google.gerrit.client.rpc.NativeMap;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gwt.core.client.JsArrayString;
|
import com.google.gwt.core.client.JsArrayString;
|
||||||
import com.google.gwt.event.logical.shared.CloseEvent;
|
import com.google.gwt.event.logical.shared.CloseEvent;
|
||||||
import com.google.gwt.event.logical.shared.CloseHandler;
|
import com.google.gwt.event.logical.shared.CloseHandler;
|
||||||
@@ -27,7 +27,7 @@ import com.google.gwtexpui.globalkey.client.GlobalKey;
|
|||||||
import com.google.gwtexpui.user.client.PluginSafePopupPanel;
|
import com.google.gwtexpui.user.client.PluginSafePopupPanel;
|
||||||
|
|
||||||
class ReplyAction {
|
class ReplyAction {
|
||||||
private final Change.Id changeId;
|
private final PatchSet.Id psId;
|
||||||
private final String revision;
|
private final String revision;
|
||||||
private final ChangeScreen2.Style style;
|
private final ChangeScreen2.Style style;
|
||||||
private final Widget replyButton;
|
private final Widget replyButton;
|
||||||
@@ -43,7 +43,9 @@ class ReplyAction {
|
|||||||
String revision,
|
String revision,
|
||||||
ChangeScreen2.Style style,
|
ChangeScreen2.Style style,
|
||||||
Widget replyButton) {
|
Widget replyButton) {
|
||||||
this.changeId = info.legacy_id();
|
this.psId = new PatchSet.Id(
|
||||||
|
info.legacy_id(),
|
||||||
|
info.revisions().get(revision)._number());
|
||||||
this.revision = revision;
|
this.revision = revision;
|
||||||
this.style = style;
|
this.style = style;
|
||||||
this.replyButton = replyButton;
|
this.replyButton = replyButton;
|
||||||
@@ -63,7 +65,7 @@ class ReplyAction {
|
|||||||
|
|
||||||
if (replyBox == null) {
|
if (replyBox == null) {
|
||||||
replyBox = new ReplyBox(
|
replyBox = new ReplyBox(
|
||||||
changeId,
|
psId,
|
||||||
revision,
|
revision,
|
||||||
allLabels,
|
allLabels,
|
||||||
permittedLabels);
|
permittedLabels);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.google.gerrit.client.rpc.GerritCallback;
|
|||||||
import com.google.gerrit.client.rpc.NativeMap;
|
import com.google.gerrit.client.rpc.NativeMap;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.common.data.LabelValue;
|
import com.google.gerrit.common.data.LabelValue;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.JsArrayString;
|
import com.google.gwt.core.client.JsArrayString;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
@@ -64,7 +64,7 @@ class ReplyBox extends Composite {
|
|||||||
String label_value();
|
String label_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Change.Id changeId;
|
private final PatchSet.Id psId;
|
||||||
private final String revision;
|
private final String revision;
|
||||||
private ReviewInput in = ReviewInput.create();
|
private ReviewInput in = ReviewInput.create();
|
||||||
private List<Runnable> lgtm;
|
private List<Runnable> lgtm;
|
||||||
@@ -77,11 +77,11 @@ class ReplyBox extends Composite {
|
|||||||
@UiField CheckBox email;
|
@UiField CheckBox email;
|
||||||
|
|
||||||
ReplyBox(
|
ReplyBox(
|
||||||
Change.Id changeId,
|
PatchSet.Id psId,
|
||||||
String revision,
|
String revision,
|
||||||
NativeMap<LabelInfo> all,
|
NativeMap<LabelInfo> all,
|
||||||
NativeMap<JsArrayString> permitted) {
|
NativeMap<JsArrayString> permitted) {
|
||||||
this.changeId = changeId;
|
this.psId = psId;
|
||||||
this.revision = revision;
|
this.revision = revision;
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
@@ -139,12 +139,14 @@ class ReplyBox extends Composite {
|
|||||||
@UiHandler("send")
|
@UiHandler("send")
|
||||||
void onSend(ClickEvent e) {
|
void onSend(ClickEvent e) {
|
||||||
in.message(message.getText().trim());
|
in.message(message.getText().trim());
|
||||||
ChangeApi.revision(changeId.get(), revision)
|
ChangeApi.revision(psId.getParentKey().get(), revision)
|
||||||
.view("review")
|
.view("review")
|
||||||
.post(in, new GerritCallback<ReviewInput>() {
|
.post(in, new GerritCallback<ReviewInput>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ReviewInput result) {
|
public void onSuccess(ReviewInput result) {
|
||||||
Gerrit.display(PageLinks.toChange2(changeId));
|
Gerrit.display(PageLinks.toChange2(
|
||||||
|
psId.getParentKey(),
|
||||||
|
String.valueOf(psId.get())));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user