Hide submit button when change is submittable but user cannot submit

If the change was submittable (all labels were approved, no veto
votes), but the user had no submit privileges (or was not signed in)
the submit button was shown without any label text.

Change-Id: Icce5a28155af8d7bbf043b9ec3848e44ca9609ec
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2015-01-21 10:02:32 +01:00 committed by David Pursehouse
parent 2d5c7179d8
commit f1cbbe8739

View File

@ -133,6 +133,7 @@ public class ChangeScreen extends Screen {
private ChangeInfo changeInfo;
private CommentLinkProcessor commentLinkProcessor;
private EditInfo edit;
private boolean canSubmit;
private KeyCommandSet keysNavigation;
private KeyCommandSet keysAction;
@ -441,6 +442,7 @@ public class ChangeScreen extends Screen {
.openDiv()
.append(action.label())
.closeDiv());
canSubmit = true;
}
if (revInfo.draft()) {
@ -929,8 +931,9 @@ public class ChangeScreen extends Screen {
}));
}
private void loadSubmitType(final Change.Status status, final boolean canSubmit) {
if (canSubmit) {
private void loadSubmitType(final Change.Status status,
final boolean isSubmittable) {
if (isSubmittable) {
submit.setVisible(canSubmit);
if (status == Change.Status.NEW) {
statusText.setInnerText(Util.C.readyToSubmit());
@ -941,7 +944,7 @@ public class ChangeScreen extends Screen {
.get(new AsyncCallback<NativeString>() {
@Override
public void onSuccess(NativeString result) {
if (canSubmit) {
if (isSubmittable) {
if (status == Change.Status.NEW) {
statusText.setInnerText(changeInfo.mergeable()
? Util.C.readyToSubmit()