From 7e90035c0927c6d0dace891b617abf1dd83b3a32 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 12 Jul 2013 11:03:37 -0700 Subject: [PATCH] Filter out core UiCommands from legacy PatchSet view Don't send any core commands to the legacy patch set view. These are currently handled in a different API and UI display code, most of which I am trying to rewrite and delete. Assume for now that there will be no new interesting core commands while we switch the view. Change-Id: If129a413d673ac1eb20981f0e25a0c9382e71ff9 --- .../httpd/rpc/changedetail/PatchSetDetailFactory.java | 4 ++-- .../gerrit/server/extensions/webui/UiCommands.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java index 868b625ed6..9287278f76 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/changedetail/PatchSetDetailFactory.java @@ -173,10 +173,10 @@ class PatchSetDetailFactory extends Handler { } } - detail.setCommands(UiCommands.sorted(UiCommands.from( + detail.setCommands(UiCommands.sorted(UiCommands.plugins(UiCommands.from( revisions, new RevisionResource(new ChangeResource(control), patchSet), - EnumSet.of(UiCommand.Place.PATCHSET_ACTION_PANEL)))); + EnumSet.of(UiCommand.Place.PATCHSET_ACTION_PANEL))))); return detail; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/extensions/webui/UiCommands.java b/gerrit-server/src/main/java/com/google/gerrit/server/extensions/webui/UiCommands.java index 43d79e13ff..8a612d7495 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/extensions/webui/UiCommands.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/extensions/webui/UiCommands.java @@ -60,6 +60,16 @@ public class UiCommands { return s; } + public static Iterable plugins(Iterable in) { + return Iterables.filter(in, + new Predicate() { + @Override + public boolean apply(UiCommandDetail input) { + return input.id.indexOf('~') > 0; + } + }); + } + public static Iterable from( ChildCollection collection, R resource,