3388: Workbench only lists user groups when sharing a project with groups.
authorBrett Smith <brett@curoverse.com>
Wed, 6 Aug 2014 22:16:10 +0000 (18:16 -0400)
committerBrett Smith <brett@curoverse.com>
Wed, 6 Aug 2014 22:16:10 +0000 (18:16 -0400)
This ensures that projects aren't included in the listing, which is
not useful and confusing.  Closes #3388.

apps/workbench/app/views/projects/_show_sharing.html.erb
apps/workbench/test/integration/projects_test.rb

index a5482efc1d3efbd0fb6d36ca48f1873b74730f9b..89a79503c38131e1edf35717e07546f2e01ba67a 100644 (file)
      perms_json << {value: link_name, text: link_desc}
    end
    perms_json = perms_json.to_json
+   choose_filters = {
+     "groups" => [["group_class", "=", nil]],
+   }
+   choose_filters.default = []
    owner_icon = fa_icon_class_for_uuid(@object.owner_uuid)
    if owner_icon == "fa-users"
      owner_icon = "fa-folder"
@@ -30,6 +34,7 @@
       preview_pane: false,
       multiple: true,
       limit: 10000,
+      filters: choose_filters[share_class].to_json,
       action_method: 'post',
       action_href: share_with_project_path,
       action_name: 'Add',
index adac0bf999c563ec46cc64016df5226c95da6083..d8b4cb14d604273af3663a07f82d3f3932a2ff72 100644 (file)
@@ -151,4 +151,16 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     add_share_and_check("groups", new_name)
     modify_share_and_check(new_name)
   end
+
+  test "'share with group' listing does not offer projects" do
+    show_project_using("active")
+    click_on "Sharing"
+    click_on "Share with groups"
+    good_uuid = api_fixture("groups")["private"]["uuid"]
+    assert(page.has_selector?(".selectable[data-object-uuid=\"#{good_uuid}\"]"),
+           "'share with groups' listing missing owned user group")
+    bad_uuid = api_fixture("groups")["asubproject"]["uuid"]
+    assert(page.has_no_selector?(".selectable[data-object-uuid=\"#{bad_uuid}\"]"),
+           "'share with groups' listing includes project")
+  end
 end