Remove message box when editing topic of change
I do not recall why I added this message box below the topic name field in ChangeScreen2. I suspect the original idea was to permit more notes to be added, for example why the topic is being assigned. At the recent Gerrit hackathon it sounded like nobody ever uses this box. Remove it to simplify the UI. Also remove message from the PutTopic REST API. We suspect nobody will notice the missing field. Change-Id: I8d32287ee3b08d9409dd7d58688cd9effdfd380f
This commit is contained in:
committed by
David Pursehouse
parent
61cc430957
commit
6b9159abe7
@@ -3362,9 +3362,6 @@ The `TopicInput` entity contains information for setting a topic.
|
|||||||
|Field Name ||Description
|
|Field Name ||Description
|
||||||
|`topic` |optional|The topic. +
|
|`topic` |optional|The topic. +
|
||||||
The topic will be deleted if not set.
|
The topic will be deleted if not set.
|
||||||
|`message` |optional|
|
|
||||||
Message to be added as review comment to the change when setting the
|
|
||||||
topic.
|
|
||||||
|===========================
|
|===========================
|
||||||
|
|
||||||
[[included-in-info]]
|
[[included-in-info]]
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
|||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.InlineLabel;
|
import com.google.gwt.user.client.ui.InlineLabel;
|
||||||
import com.google.gwt.user.client.ui.UIObject;
|
import com.google.gwt.user.client.ui.UIObject;
|
||||||
import com.google.gwtexpui.globalkey.client.NpTextArea;
|
|
||||||
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
||||||
|
|
||||||
/** Displays (and edits) the change topic string. */
|
/** Displays (and edits) the change topic string. */
|
||||||
@@ -53,7 +52,6 @@ class Topic extends Composite {
|
|||||||
|
|
||||||
@UiField Element form;
|
@UiField Element form;
|
||||||
@UiField NpTextBox input;
|
@UiField NpTextBox input;
|
||||||
@UiField NpTextArea message;
|
|
||||||
@UiField Button save;
|
@UiField Button save;
|
||||||
@UiField Button cancel;
|
@UiField Button cancel;
|
||||||
|
|
||||||
@@ -116,22 +114,11 @@ class Topic extends Composite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("message")
|
|
||||||
void onKeyDownMessage(KeyDownEvent e) {
|
|
||||||
if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
|
|
||||||
onCancel(null);
|
|
||||||
} else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER
|
|
||||||
&& e.isControlKeyDown()) {
|
|
||||||
onSave(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiHandler("save")
|
@UiHandler("save")
|
||||||
void onSave(ClickEvent e) {
|
void onSave(ClickEvent e) {
|
||||||
ChangeApi.topic(
|
ChangeApi.topic(
|
||||||
psId.getParentKey().get(),
|
psId.getParentKey().get(),
|
||||||
input.getValue().trim(),
|
input.getValue().trim(),
|
||||||
message.getValue().trim(),
|
|
||||||
new GerritCallback<String>() {
|
new GerritCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
|
|||||||
@@ -39,11 +39,6 @@ limitations under the License.
|
|||||||
<div>
|
<div>
|
||||||
<c:NpTextBox ui:field='input' visibleLength='55'/>
|
<c:NpTextBox ui:field='input' visibleLength='55'/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<c:NpTextArea ui:field='message'
|
|
||||||
visibleLines='3'
|
|
||||||
characterWidth='40'/>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<g:Button ui:field='save' styleName='{res.style.button}'>
|
<g:Button ui:field='save' styleName='{res.style.button}'>
|
||||||
<div>Update</div>
|
<div>Update</div>
|
||||||
|
|||||||
@@ -48,14 +48,12 @@ public class ChangeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Update the topic of a change. */
|
/** Update the topic of a change. */
|
||||||
public static void topic(int id, String topic, String msg, AsyncCallback<String> cb) {
|
public static void topic(int id, String topic, AsyncCallback<String> cb) {
|
||||||
RestApi call = call(id, "topic");
|
RestApi call = call(id, "topic");
|
||||||
topic = emptyToNull(topic);
|
topic = emptyToNull(topic);
|
||||||
msg = emptyToNull(msg);
|
if (topic != null) {
|
||||||
if (topic != null || msg != null) {
|
|
||||||
Input input = Input.create();
|
Input input = Input.create();
|
||||||
input.topic(topic);
|
input.topic(topic);
|
||||||
input.message(msg);
|
|
||||||
call.put(input, NativeString.unwrap(cb));
|
call.put(input, NativeString.unwrap(cb));
|
||||||
} else {
|
} else {
|
||||||
call.delete(NativeString.unwrap(cb));
|
call.delete(NativeString.unwrap(cb));
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public class ChangeInfoBlock extends Composite {
|
|||||||
super(Util.C.alterTopicTitle(), Util.C.headingAlterTopicMessage(),
|
super(Util.C.alterTopicTitle(), Util.C.headingAlterTopicMessage(),
|
||||||
new ChangeDetailCache.IgnoreErrorCallback());
|
new ChangeDetailCache.IgnoreErrorCallback());
|
||||||
change = chg;
|
change = chg;
|
||||||
|
message.setVisible(false);
|
||||||
|
|
||||||
newTopic = new TextBox();
|
newTopic = new TextBox();
|
||||||
newTopic.addKeyPressHandler(this);
|
newTopic.addKeyPressHandler(this);
|
||||||
@@ -190,7 +191,7 @@ public class ChangeInfoBlock extends Composite {
|
|||||||
|
|
||||||
private void doTopicEdit() {
|
private void doTopicEdit() {
|
||||||
String topic = newTopic.getText();
|
String topic = newTopic.getText();
|
||||||
ChangeApi.topic(change.getId().get(), topic, getMessageText(),
|
ChangeApi.topic(change.getId().get(), topic,
|
||||||
new GerritCallback<String>() {
|
new GerritCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ class PutTopic implements RestModifyView<ChangeResource, Input>,
|
|||||||
static class Input {
|
static class Input {
|
||||||
@DefaultInput
|
@DefaultInput
|
||||||
String topic;
|
String topic;
|
||||||
String message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -92,12 +91,7 @@ class PutTopic implements RestModifyView<ChangeResource, Input>,
|
|||||||
new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(db)),
|
new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(db)),
|
||||||
currentUser.getAccountId(), TimeUtil.nowTs(),
|
currentUser.getAccountId(), TimeUtil.nowTs(),
|
||||||
change.currentPatchSetId());
|
change.currentPatchSetId());
|
||||||
StringBuilder msgBuf = new StringBuilder(summary);
|
cmsg.setMessage(summary);
|
||||||
if (!Strings.isNullOrEmpty(input.message)) {
|
|
||||||
msgBuf.append("\n\n");
|
|
||||||
msgBuf.append(input.message);
|
|
||||||
}
|
|
||||||
cmsg.setMessage(msgBuf.toString());
|
|
||||||
|
|
||||||
db.changes().beginTransaction(change.getId());
|
db.changes().beginTransaction(change.getId());
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user