Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/challenge_signups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def index
if params[:user_id] && (@user = User.find_by(login: params[:user_id]))
if current_user == @user
@challenge_signups = @user.challenge_signups.order_by_date
@page_subtitle = t(".page_title", username: @user.login)
render action: :index and return
else
flash[:error] = ts("You aren't allowed to see that user's sign-ups.")
Expand Down
2 changes: 2 additions & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ en:
index:
page_title: "%{username} - Challenge Claims"
challenge_signups:
index:
page_title: "%{username} - Challenge Sign-ups"
new:
page_title: New Challenge Sign-up
chapters:
Expand Down
8 changes: 8 additions & 0 deletions spec/controllers/challenge_signups_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
it_redirects_to_with_error(closed_collection,
"You aren't allowed to see the CSV summary.")
end

context "when user visits their own sign-ups" do
it "sets the page subtitle correctly" do
fake_login_known_user(user)
get :index, params: { user_id: user.login }
expect(assigns(:page_subtitle)).to eq("#{user.login} - Challenge Sign-ups")
end
end
end

describe "destroy" do
Expand Down
Loading