Fix HTML escaping issues with user role icons

This commit is contained in:
Tom Hughes 2020-11-13 15:13:37 +00:00
parent bfffe7ed96
commit 99e537859a
4 changed files with 8 additions and 16 deletions

View file

@ -1,8 +1,6 @@
module UserRolesHelper
def role_icons(user)
UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
"#{acc} #{role_icon(user, elem)}"
end
safe_join(UserRole::ALL_ROLES.collect { |role| role_icon(user, role) }.compact, " ")
end
def role_icon(user, role)

View file

@ -2,7 +2,7 @@
<div id='userinformation'>
<%= user_image @user %>
<div class='userinformation-inner'>
<h1><%= @user.display_name %><%= role_icons(@user) %></h1>
<h1><%= @user.display_name %> <%= role_icons(@user) %></h1>
<% if current_user and @user.id == current_user.id %>
<!-- Displaying user's own profile page to themself -->
<ul class='secondary-actions clearfix'>