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/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def index
end

def manage
@page_subtitle = t(".page_title", username: @user.login)
status = params[:status]
@invitations = @user.invitations
if %w(unsent unredeemed redeemed).include?(status)
Expand Down
9 changes: 8 additions & 1 deletion app/views/invitations/manage.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= logged_in_as_admin? ? (@user.login + "'s") : "Your" %> Invitations</h2>
<h2 class="heading">
<% if logged_in_as_admin? %>
<%= t(".page_heading.admin", username: @user.login) %>
<% else %>
<%= t(".page_heading.user") %>
<% end %>
</h2>

<!--/descriptions-->

<!--subnav -->
Expand Down
3 changes: 3 additions & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ en:
update:
must_select_item: Please select at least one comment first.
success: Inbox successfully updated.
invitations:
manage:
page_title: "%{username} - Manage Invitations"
invite_requests:
create:
queue_disabled:
Expand Down
4 changes: 4 additions & 0 deletions config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,10 @@ en:
sent_at: Sent at
sent_to: Sent to
user_id_deleted: User %{user_id} (Deleted)
manage:
page_heading:
admin: Manage Invitations for %{username}
user: Manage Invitations
user_invitations:
table:
actions:
Expand Down
1 change: 1 addition & 0 deletions features/admins/admin_invitations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ Feature: Admin Actions to Manage Invitations
And I am logged in as a "<role>" admin
When I go to creator's manage invitations page
Then I should see "invitee"
And the page title should include "creator - Manage Invitations"
When I view the most recent invitation for "creator"
Then I should see "invitee"
When I follow "invitee"
Expand Down
17 changes: 17 additions & 0 deletions spec/controllers/invitations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@

expect(response).to render_template("manage")
end

it "assigns subtitle with username in it" do
Comment thread
jmalark marked this conversation as resolved.
admin.update!(roles: ["policy_and_abuse"])
fake_login_admin(admin)
get :manage, params: { user_id: user.login }

expect(assigns[:page_subtitle]).to eq("#{user.login} - Manage Invitations")
end
end

context "when not an admin" do
it "assigns subtitle with username in it" do
fake_login_known_user(user)
get :manage, params: { user_id: user.login }

expect(assigns[:page_subtitle]).to eq("#{user.login} - Manage Invitations")
end
end
end

Expand Down
Loading