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:
Shawn Pearce
2014-03-27 17:37:29 -07:00
committed by David Pursehouse
parent 61cc430957
commit 6b9159abe7
6 changed files with 5 additions and 33 deletions

View File

@@ -3362,9 +3362,6 @@ The `TopicInput` entity contains information for setting a topic.
|Field Name ||Description
|`topic` |optional|The topic. +
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]]

View File

@@ -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.InlineLabel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwtexpui.globalkey.client.NpTextArea;
import com.google.gwtexpui.globalkey.client.NpTextBox;
/** Displays (and edits) the change topic string. */
@@ -53,7 +52,6 @@ class Topic extends Composite {
@UiField Element form;
@UiField NpTextBox input;
@UiField NpTextArea message;
@UiField Button save;
@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")
void onSave(ClickEvent e) {
ChangeApi.topic(
psId.getParentKey().get(),
input.getValue().trim(),
message.getValue().trim(),
new GerritCallback<String>() {
@Override
public void onSuccess(String result) {

View File

@@ -39,11 +39,6 @@ limitations under the License.
<div>
<c:NpTextBox ui:field='input' visibleLength='55'/>
</div>
<div>
<c:NpTextArea ui:field='message'
visibleLines='3'
characterWidth='40'/>
</div>
<div>
<g:Button ui:field='save' styleName='{res.style.button}'>
<div>Update</div>

View File

@@ -48,14 +48,12 @@ public class ChangeApi {
}
/** 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");
topic = emptyToNull(topic);
msg = emptyToNull(msg);
if (topic != null || msg != null) {
if (topic != null) {
Input input = Input.create();
input.topic(topic);
input.message(msg);
call.put(input, NativeString.unwrap(cb));
} else {
call.delete(NativeString.unwrap(cb));

View File

@@ -174,6 +174,7 @@ public class ChangeInfoBlock extends Composite {
super(Util.C.alterTopicTitle(), Util.C.headingAlterTopicMessage(),
new ChangeDetailCache.IgnoreErrorCallback());
change = chg;
message.setVisible(false);
newTopic = new TextBox();
newTopic.addKeyPressHandler(this);
@@ -190,7 +191,7 @@ public class ChangeInfoBlock extends Composite {
private void doTopicEdit() {
String topic = newTopic.getText();
ChangeApi.topic(change.getId().get(), topic, getMessageText(),
ChangeApi.topic(change.getId().get(), topic,
new GerritCallback<String>() {
@Override
public void onSuccess(String result) {

View File

@@ -48,7 +48,6 @@ class PutTopic implements RestModifyView<ChangeResource, Input>,
static class Input {
@DefaultInput
String topic;
String message;
}
@Inject
@@ -92,12 +91,7 @@ class PutTopic implements RestModifyView<ChangeResource, Input>,
new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(db)),
currentUser.getAccountId(), TimeUtil.nowTs(),
change.currentPatchSetId());
StringBuilder msgBuf = new StringBuilder(summary);
if (!Strings.isNullOrEmpty(input.message)) {
msgBuf.append("\n\n");
msgBuf.append(input.message);
}
cmsg.setMessage(msgBuf.toString());
cmsg.setMessage(summary);
db.changes().beginTransaction(change.getId());
try {