diff --git a/app/models/plan.rb b/app/models/plan.rb index 2561373..5c97fb2 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -642,10 +642,7 @@ ## # returns the shared roles of a plan, excluding the creator def shared - role_values = Role.access_values_for(:commenter) - .concat(Role.access_values_for(:editor)) - .concat(Role.access_values_for(:administrator)).uniq! - Role.access_values_for(:creator) - Role.where(plan: self, access: role_values) + role_values = Role.where(plan: self).where(Role.not_creator_condition).any? end ## diff --git a/app/views/paginable/plans/_privately_visible.html.erb b/app/views/paginable/plans/_privately_visible.html.erb index 2ff6bcf..1deafb2 100644 --- a/app/views/paginable/plans/_privately_visible.html.erb +++ b/app/views/paginable/plans/_privately_visible.html.erb @@ -44,8 +44,8 @@ <%= plan.visibility === 'is_test' ? _('N/A') : raw(display_visibility(plan.visibility)) %> - <% unless plan.shared.empty? %> - <%= _("Yes(#{plan.shared.length})") %> + <% if plan.shared %> + <%= _("Yes") %> <% else %> <%= _('No') %> <% end %> diff --git a/test/unit/plan_test.rb b/test/unit/plan_test.rb index d825435..d092536 100644 --- a/test/unit/plan_test.rb +++ b/test/unit/plan_test.rb @@ -279,8 +279,7 @@ Role.create(user: User.first, plan: plan, access: 14) Role.create(user: User.last, plan: plan, access: 8) # assert that the plan is shared with above roles and doesnt include owner - assert_equal(plan.shared.length, 2) - assert_equal(plan.roles.count, 3) + assert_equal(plan.shared, true) end # ---------------------------------------------------