if changeset.user.status == "deleted"
t("user.no_such_user.deleted")
elsif changeset.user.data_public?
- link_to(changeset.user.display_name, user_path(changeset.user.display_name))
+ link_to(changeset.user.display_name, user_path(changeset.user))
else
t("browse.anonymous")
end
<% comments.each do |comment| %>
<div class="comment">
<div style="float:left">
- <%= link_to user_thumbnail(comment.user), user_path(comment.user.display_name) %>
+ <%= link_to user_thumbnail(comment.user), user_path(comment.user) %>
</div>
- <b> <%= link_to comment.user.display_name, user_path(comment.user.display_name) %> </b> <br/>
+ <b> <%= link_to comment.user.display_name, user_path(comment.user) %> </b> <br/>
<%= comment.body %>
</div>
<span class="deemphasize">
<% reports.each do |report| %>
<div class="report">
<div style="float:left">
- <%= link_to user_thumbnail(report.user), user_path(report.user.display_name) %>
+ <%= link_to user_thumbnail(report.user), user_path(report.user) %>
</div>
- <%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, user_path(report.user.display_name)) %>
+ <%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, user_path(report.user)) %>
<br/>
<span class="deemphasize">
<%= t(".updated_at", :datetime => l(report.updated_at.to_datetime, :format => :friendly)) %>
<td><%= t ".states.#{issue.status}" %></td>
<td><%= link_to t(".reports_count", :count => issue.reports_count), issue %></td>
<td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
- <td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user.display_name) if issue.reported_user %></td>
+ <td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user) if issue.reported_user %></td>
<td>
<% if issue.user_updated %>
- <%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated.display_name)),
+ <%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
:time => distance_of_time_in_words_to_now(issue.updated_at),
:title => l(issue.updated_at) %>
<% else %>
<% end %>
</li>
<li>
- <%= link_to t('user.show.my profile'), user_path(:display_name => current_user.display_name) %>
+ <%= link_to t('user.show.my profile'), user_path(current_user) %>
</li>
<li>
<%= link_to t('user.show.my settings'), :controller => 'user', :action => 'account', :display_name => current_user.display_name %>
}
end
assert_response :redirect
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
end
def test_new_report_with_incomplete_details
}
end
assert_response :redirect
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
issue = Issue.last
}
end
assert_response :redirect
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
issue = Issue.last
assert_difference "ActionMailer::Base.deliveries.size", 1 do
post :make_friend, :params => { :display_name => friend.display_name }, :session => { :user => user }
end
- assert_redirected_to user_path(:display_name => friend.display_name)
+ assert_redirected_to user_path(friend)
assert_match /is now your friend/, flash[:notice]
assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
email = ActionMailer::Base.deliveries.first
assert_no_difference "ActionMailer::Base.deliveries.size" do
post :make_friend, :params => { :display_name => friend.display_name }, :session => { :user => user }
end
- assert_redirected_to user_path(:display_name => friend.display_name)
+ assert_redirected_to user_path(friend)
assert_match /You are already friends with/, flash[:warning]
assert Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
end
# When logged in a POST should remove the friendship
post :remove_friend, :params => { :display_name => friend.display_name }, :session => { :user => user }
- assert_redirected_to user_path(:display_name => friend.display_name)
+ assert_redirected_to user_path(friend)
assert_match /was removed from your friends/, flash[:notice]
assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
# A second POST should report that the friendship does not exist
post :remove_friend, :params => { :display_name => friend.display_name }, :session => { :user => user }
- assert_redirected_to user_path(:display_name => friend.display_name)
+ assert_redirected_to user_path(friend)
assert_match /is not one of your friends/, flash[:error]
assert_nil Friend.where(:user_id => user.id, :friend_user_id => friend.id).first
end
# Granting should still fail
post :grant, :params => { :display_name => target_user.display_name, :role => "moderator" }
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "Only administrators can perform user role management, and you are not an administrator.", flash[:error]
# Login as an administrator
assert_no_difference "UserRole.count" do
post :grant, :params => { :display_name => super_user.display_name, :role => role }
end
- assert_redirected_to user_path(super_user.display_name)
+ assert_redirected_to user_path(super_user)
assert_equal "The user already has role #{role}.", flash[:error]
# Granting a role to a user that doesn't have it should work...
assert_difference "UserRole.count", 1 do
post :grant, :params => { :display_name => target_user.display_name, :role => role }
end
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
# ...but trying a second time should fail
assert_no_difference "UserRole.count" do
post :grant, :params => { :display_name => target_user.display_name, :role => role }
end
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "The user already has role #{role}.", flash[:error]
end
assert_difference "UserRole.count", 0 do
post :grant, :params => { :display_name => target_user.display_name, :role => "no_such_role" }
end
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "The string `no_such_role' is not a valid role.", flash[:error]
end
# Revoking should still fail
post :revoke, :params => { :display_name => target_user.display_name, :role => "moderator" }
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "Only administrators can perform user role management, and you are not an administrator.", flash[:error]
# Login as an administrator
assert_no_difference "UserRole.count" do
post :revoke, :params => { :display_name => target_user.display_name, :role => role }
end
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "The user does not have role #{role}.", flash[:error]
# Removing a role from a user that has it should work...
assert_difference "UserRole.count", -1 do
post :revoke, :params => { :display_name => super_user.display_name, :role => role }
end
- assert_redirected_to user_path(super_user.display_name)
+ assert_redirected_to user_path(super_user)
# ...but trying a second time should fail
assert_no_difference "UserRole.count" do
post :revoke, :params => { :display_name => super_user.display_name, :role => role }
end
- assert_redirected_to user_path(super_user.display_name)
+ assert_redirected_to user_path(super_user)
assert_equal "The user does not have role #{role}.", flash[:error]
end
assert_difference "UserRole.count", 0 do
post :revoke, :params => { :display_name => target_user.display_name, :role => "no_such_role" }
end
- assert_redirected_to user_path(target_user.display_name)
+ assert_redirected_to user_path(target_user)
assert_equal "The string `no_such_role' is not a valid role.", flash[:error]
# Revoking administrator role from current user should fail
post :revoke, :params => { :display_name => administrator_user.display_name, :role => "administrator" }
- assert_redirected_to user_path(administrator_user.display_name)
+ assert_redirected_to user_path(administrator_user)
assert_equal "Cannot revoke administrator role from current user.", flash[:error]
end
end
def test_can_report_user
user = create(:user)
sign_in_as(create(:user))
- visit user_path(user.display_name)
+ visit user_path(user)
click_on I18n.t("user.show.report")
assert page.has_content? "Report"
def test_it_promotes_issues
user = create(:user)
sign_in_as(create(:user))
- visit user_path(user.display_name)
+ visit user_path(user)
click_on I18n.t("user.show.report")
assert page.has_content? "Report"
assert_equal user, Issue.last.reportable
assert_equal "moderator", Issue.last.assigned_role
- visit user_path(user.display_name)
+ visit user_path(user)
click_on I18n.t("user.show.report")
assert page.has_content? "Report"