Skip to content

Commit a56168b

Browse files
authored
Resolves #5000 (#5107)
* Add if statement and rspec to remove my co-workers from org user dropdown * Remove old test to fix lint, make new require test
1 parent 5e80e11 commit a56168b

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,4 +831,4 @@ DEPENDENCIES
831831
webmock (~> 3.24)
832832

833833
BUNDLED WITH
834-
2.6.5
834+
2.6.6

app/views/layouts/_lte_navbar.html.erb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@
5050
<i class="fa fa-repeat text-aqua"></i><%= "Switch to: #{role.resource&.name || "Super Admin"}" %>
5151
<% end %>
5252
<% end %>
53-
<% if current_user.has_cached_role?(Role::ORG_ADMIN, current_organization) %>
53+
<% if current_user.has_cached_role?(Role::ORG_ADMIN, current_organization) %>
5454
<div class="dropdown-divider"></div>
55-
<%= link_to users_path, class:"dropdown-item" do %>
56-
<i class="fas fa-users mr-2"></i> My Co-Workers
55+
<% if current_user.has_cached_role?(:partner) %>
56+
<%= link_to users_path, class:"dropdown-item" do %>
57+
<i class="fas fa-users mr-2"></i> My Co-Workers
58+
<% end %>
5759
<% end %>
5860
<%= link_to organization_path, class:"dropdown-item" do %>
5961
<i class="fas fa-sitemap mr-2"></i> My Organization
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
RSpec.describe "UsernameDropdown", type: :request do
2+
let(:organization) { create(:organization) }
3+
4+
describe "My Co-Workers link visibility" do
5+
context "when user does not have partner role" do
6+
let(:user) { create(:user, organization: organization) }
7+
8+
before do
9+
user.add_role(Role::ORG_ADMIN, organization)
10+
sign_in(user)
11+
end
12+
13+
it "does not show the My Co-Workers link" do
14+
get dashboard_path
15+
expect(response.body).not_to include("My Co-Workers")
16+
end
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)