diff --git a/Gemfile.lock b/Gemfile.lock index 159ed3895d..f2ee4ef768 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -826,4 +826,4 @@ DEPENDENCIES webmock (~> 3.24) BUNDLED WITH - 2.6.5 + 2.6.6 diff --git a/app/views/layouts/_lte_navbar.html.erb b/app/views/layouts/_lte_navbar.html.erb index fa66552b8e..20fac86455 100644 --- a/app/views/layouts/_lte_navbar.html.erb +++ b/app/views/layouts/_lte_navbar.html.erb @@ -50,10 +50,12 @@ <%= "Switch to: #{role.resource&.name || "Super Admin"}" %> <% end %> <% end %> - <% if current_user.has_cached_role?(Role::ORG_ADMIN, current_organization) %> + <% if current_user.has_cached_role?(Role::ORG_ADMIN, current_organization) %>
- <%= link_to users_path, class:"dropdown-item" do %> - My Co-Workers + <% if current_user.has_cached_role?(:partner) %> + <%= link_to users_path, class:"dropdown-item" do %> + My Co-Workers + <% end %> <% end %> <%= link_to organization_path, class:"dropdown-item" do %> My Organization diff --git a/spec/requests/user_dropdown_requests_spec.rb b/spec/requests/user_dropdown_requests_spec.rb new file mode 100644 index 0000000000..f6e1a72913 --- /dev/null +++ b/spec/requests/user_dropdown_requests_spec.rb @@ -0,0 +1,19 @@ +RSpec.describe "UsernameDropdown", type: :request do + let(:organization) { create(:organization) } + + describe "My Co-Workers link visibility" do + context "when user does not have partner role" do + let(:user) { create(:user, organization: organization) } + + before do + user.add_role(Role::ORG_ADMIN, organization) + sign_in(user) + end + + it "does not show the My Co-Workers link" do + get dashboard_path + expect(response.body).not_to include("My Co-Workers") + end + end + end +end