Skip to content

Commit

Permalink
GIT-2986: Fixed incorrect display of room recordings title (Fixes big…
Browse files Browse the repository at this point in the history
…bluebutton#2986). (bigbluebutton#3003)

Co-authored-by: Ahmad Farhat <[email protected]>
  • Loading branch information
KH-Amir-TN and farhatahmad authored Dec 14, 2021
1 parent 53d8b80 commit f85aa74
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,9 @@ def perm_to_record_meeting
def protected_recording?(rec)
!rec[:protected].nil?
end

# Takes any expression and stringify it decoding any html charachter entity if found.
def html_entities_decode(expr)
CGI.unescapeHTML expr
end
end
4 changes: 2 additions & 2 deletions app/views/shared/components/_public_recording_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<div id="recording-title" class="edit_hover_class" data-recordid="<%= recording[:recordID] %>" data-room-uid="<%= room_uid_from_bbb(recording[:meetingID]) %>" data-path="<%= rename_recording_path(meetingID: recording[:meetingID], record_id: recording[:recordID]) %>">
<% if recording[:metadata][:name] %>
<span id="recording-text" title="<%= recording[:metadata][:name] %>">
<%= recording[:metadata][:name] %>
<%= html_entities_decode(recording[:metadata][:name]) %>
<% else %>
<span id="recording-text" title="<%= recording[:name] %>">
<%= recording[:name] %>
<%= html_entities_decode(recording[:name]) %>
<% end %>
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/components/_recording_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<div id="recording-title" class="edit_hover_class" data-recordid="<%= recording[:recordID] %>" data-room-uid="<%= room_uid_from_bbb(recording[:meetingID]) %>" data-path="<%= rename_recording_path(meetingID: recording[:meetingID], record_id: recording[:recordID]) %>">
<% if recording[:metadata][:name] %>
<span id='recording-text' title="<%= recording[:metadata][:name] %>">
<%= recording[:metadata][:name] %>
<%= html_entities_decode(recording[:metadata][:name]) %>
<% else %>
<span id='recording-text' title="<%= recording[:name] %>">
<%= recording[:name] %>
<%= html_entities_decode(recording[:name]) %>
<% end %>
</span>
<a><i id="edit-record" class="fa fa-edit align-top ml-2" data-edit-recordid="<%= recording[:recordID] %>"></i></a>
Expand Down
16 changes: 15 additions & 1 deletion spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,21 @@
expect(helper.omniauth_login_url(provider)).to eql("/b/auth/#{provider}")
end
end

describe "#html_decode" do
let(:expr_with_html_entities) { '&lt;&gt;&amp;&quot;' }
let(:expr_with_html_entities_decoded) { '<>&"' }
let(:expr_with_no_html_entities) { "this is some regular text!!" }
context "with html charachter entities" do
it "should return the decoded version of the expression" do
expect(html_entities_decode(expr_with_html_entities)).to eq(expr_with_html_entities_decoded)
end
end
context "with no html charachter entities" do
it "should return the expression stringified" do
expect(html_entities_decode(expr_with_no_html_entities)).to eq(expr_with_no_html_entities)
end
end
end
describe "role_colur" do
it "should use default if the user doesn't have a role" do
expect(helper.role_colour(Role.create(name: "test"))).to eq(Rails.configuration.primary_color_default)
Expand Down

0 comments on commit f85aa74

Please sign in to comment.