Merge "Show "create change" button even when no actions returned"

This commit is contained in:
David Pursehouse
2014-09-18 01:36:56 +00:00
committed by Gerrit Code Review

View File

@@ -554,9 +554,13 @@ public class ProjectInfoScreen extends ProjectScreen {
private void initProjectActions(ConfigInfo info) { private void initProjectActions(ConfigInfo info) {
actionsGrid.clear(true); actionsGrid.clear(true);
actionsGrid.removeAllRows(); actionsGrid.removeAllRows();
boolean showCreateChange = Gerrit.isSignedIn();
NativeMap<ActionInfo> actions = info.actions(); NativeMap<ActionInfo> actions = info.actions();
if (actions == null || actions.isEmpty()) { if (actions == null) {
actions = NativeMap.create().cast();
}
if (actions.isEmpty() && !showCreateChange) {
return; return;
} }
actions.copyKeysIntoChildren("id"); actions.copyKeysIntoChildren("id");
@@ -571,7 +575,9 @@ public class ProjectInfoScreen extends ProjectScreen {
actions.get(id))); actions.get(id)));
} }
if (Gerrit.isSignedIn()) { // TODO: The user should have create permission on the branch referred to by
// HEAD. This would have to happen on the server side.
if (showCreateChange) {
actionsPanel.add(createChangeAction()); actionsPanel.add(createChangeAction());
} }
} }