Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
guswhitten authored Jun 12, 2024
2 parents a0abf07 + 73ffd95 commit a1c6c62
Show file tree
Hide file tree
Showing 8 changed files with 797 additions and 911 deletions.
25 changes: 13 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ GEM
blueprinter (1.0.2)
brakeman (6.1.2)
racc
bugsnag (6.26.4)
bugsnag (6.27.0)
concurrent-ruby (~> 1.0)
builder (3.2.4)
builder (3.3.0)
bullet (7.1.6)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
Expand Down Expand Up @@ -144,9 +144,10 @@ GEM
caxlsx (>= 3.0)
cliver (0.3.2)
coderay (1.1.3)
concurrent-ruby (1.3.1)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
crack (0.4.5)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
cssbundling-rails (1.4.0)
Expand Down Expand Up @@ -240,7 +241,7 @@ GEM
activesupport (>= 6.1)
groupdate (6.4.0)
activesupport (>= 6.1)
hashdiff (1.0.1)
hashdiff (1.1.0)
htmlentities (4.3.4)
httparty (0.22.0)
csv
Expand Down Expand Up @@ -289,7 +290,7 @@ GEM
method_source (1.0.0)
mini_magick (4.11.0)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
mini_portile2 (2.8.7)
minitest (5.23.1)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
Expand Down Expand Up @@ -483,12 +484,12 @@ GEM
spring (4.2.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (4.1.1)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
standard (1.36.0)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -531,7 +532,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.23.0)
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
7 changes: 7 additions & 0 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<header class="header pt-0">
<%= render 'layouts/banner' %>

<% if current_user != true_user %>
<%= link_to stop_impersonating_volunteers_path, method: :post, class: "pt-4 pb-4 bg-danger", style: "padding-left: 15px; display: block;" do %>
You (<%= true_user.display_name %>) are signed in as <%= current_user.display_name %>.
Click here to stop impersonating.
<% end %>
<% end %>

<div class="container-fluid pt-30">
<div class="row">
<div class="col-lg-5 col-md-5 col-6">
Expand Down
8 changes: 0 additions & 8 deletions app/views/layouts/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@
{ title: "Edit Organization", icon: "cogs", path: edit_casa_org_path(current_organization), render_check: policy(:application).modify_organization? }
]) %>
<% end %>
<li>
<% if current_user != true_user %>
<%= link_to stop_impersonating_volunteers_path, method: :post, class: "mr-10 ml-10" do %>
You (<%= true_user.display_name %>) are signed in as <%= current_user.display_name %>.
Click here to stop impersonating.
<% end %>
<% end %>
</li>
</ul>
</nav>
</nav>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build:css:dev": "sass app/assets/stylesheets/application.scss app/assets/builds/application.css --load-path=node_modules --watch"
},
"dependencies": {
"@babel/core": "^7.24.6",
"@babel/core": "^7.24.7",
"@fortawesome/fontawesome-free": "^6.5.2",
"@hotwired/stimulus": "^3.2.2",
"@popperjs/core": "^2.11.8",
Expand All @@ -29,7 +29,7 @@
"chart.js": "^4.4.3",
"chartjs-adapter-luxon": "^1.3.1",
"datatables.net-dt": "^1.13.10",
"esbuild": "^0.21.4",
"esbuild": "^0.21.5",
"faker": "^5.5.3",
"jquery": "^3.7.1",
"js-cookie": "^3.0.5",
Expand All @@ -49,12 +49,12 @@
},
"version": "0.1.0",
"devDependencies": {
"@babel/preset-env": "^7.24.5",
"@babel/preset-env": "^7.24.7",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"markdown-toc": "^1.2.0",
"standard": "^17.1.0",
"start-server-and-test": "^2.0.3"
"start-server-and-test": "^2.0.4"
},
"standard": {
"globals": [
Expand Down
4 changes: 2 additions & 2 deletions spec/system/volunteers/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@

click_on "Impersonate"

within(".sidebar-nav-wrapper") do
within(".header") do
expect(page).to have_text(
"You (#{admin.display_name}) are signed in as John Doe. " \
"Click here to stop impersonating."
Expand All @@ -579,7 +579,7 @@

click_on "Impersonate"

within(".sidebar-nav-wrapper") do
within(".header") do
expect(page).to have_text(
"You (#{supervisor.display_name}) are signed in as John Doe. " \
"Click here to stop impersonating."
Expand Down
8 changes: 8 additions & 0 deletions spec/views/layouts/header.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,13 @@ def true_user

expect(rendered).to match "<strong>Role: Volunteer</strong>"
end

it "renders a stop impersonating link when impersonating" do
allow(view).to receive(:true_user).and_return(true_user)

render partial: "layouts/header"

expect(rendered).to have_link(href: "/volunteers/stop_impersonating")
end
end
end
13 changes: 0 additions & 13 deletions spec/views/layouts/sidebar.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,4 @@ def true_user
expect(rendered).to_not have_link("Emancipation Checklist", href: "/emancipation_checklists")
end
end

context "impersonation" do
let(:user) { build_stubbed :volunteer }
let(:true_user) { build_stubbed :casa_admin }

it "renders a stop impersonating link when impersonating" do
allow(view).to receive(:true_user).and_return(true_user)

render partial: "layouts/sidebar"

expect(rendered).to have_link(href: "/volunteers/stop_impersonating")
end
end
end
Loading

0 comments on commit a1c6c62

Please sign in to comment.