ChangeScreen2: Make LGTM affect only the Code-Review label
Some users don't like how "LGTM" will set both Code-Review+2 and Verified+1 on a change. Instead of setting all radio buttons to the maximal value granted to the user, update only one named after the default "Code-Review" category. Change-Id: I051570922d5f113e821d3cfb283709677183213c
This commit is contained in:
@@ -56,6 +56,8 @@ import java.util.Set;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
class ReplyBox extends Composite {
|
class ReplyBox extends Composite {
|
||||||
|
private static final String CODE_REVIEW = "Code-Review";
|
||||||
|
|
||||||
interface Binder extends UiBinder<HTMLPanel, ReplyBox> {}
|
interface Binder extends UiBinder<HTMLPanel, ReplyBox> {}
|
||||||
private static final Binder uiBinder = GWT.create(Binder.class);
|
private static final Binder uiBinder = GWT.create(Binder.class);
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ class ReplyBox extends Composite {
|
|||||||
private final PatchSet.Id psId;
|
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 Runnable lgtm;
|
||||||
|
|
||||||
@UiField Styles style;
|
@UiField Styles style;
|
||||||
@UiField NpTextArea message;
|
@UiField NpTextArea message;
|
||||||
@@ -91,7 +93,6 @@ class ReplyBox extends Composite {
|
|||||||
UIObject.setVisible(labelsParent, false);
|
UIObject.setVisible(labelsParent, false);
|
||||||
} else {
|
} else {
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
lgtm = new ArrayList<Runnable>(names.size());
|
|
||||||
renderLabels(names, all, permitted);
|
renderLabels(names, all, permitted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,11 +119,7 @@ class ReplyBox extends Composite {
|
|||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if (message.getValue().startsWith("LGTM")) {
|
lgtm.run();
|
||||||
for (Runnable r : lgtm) {
|
|
||||||
r.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -236,8 +233,8 @@ class ReplyBox extends Composite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group.isEmpty()) {
|
if (CODE_REVIEW.equalsIgnoreCase(id) && !group.isEmpty()) {
|
||||||
lgtm.add(new Runnable() {
|
lgtm = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int i = 0; i < group.size() - 1; i++) {
|
for (int i = 0; i < group.size() - 1; i++) {
|
||||||
@@ -245,7 +242,7 @@ class ReplyBox extends Composite {
|
|||||||
}
|
}
|
||||||
group.get(group.size() - 1).setValue(true, true);
|
group.get(group.size() - 1).setValue(true, true);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,12 +266,14 @@ class ReplyBox extends Composite {
|
|||||||
b.setStyleName(style.label_name());
|
b.setStyleName(style.label_name());
|
||||||
labelsTable.setWidget(row, 0, b);
|
labelsTable.setWidget(row, 0, b);
|
||||||
|
|
||||||
lgtm.add(new Runnable() {
|
if (CODE_REVIEW.equalsIgnoreCase(id)) {
|
||||||
@Override
|
lgtm = new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
b.setValue(true, true);
|
public void run() {
|
||||||
}
|
b.setValue(true, true);
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isCheckBox(Set<Short> values) {
|
private static boolean isCheckBox(Set<Short> values) {
|
||||||
|
Reference in New Issue
Block a user