FIX: Missing iframe closing tag in discobot certificate (#13052)

When issuing the discobot certificate, we were not closing the
iframe tag, which meant that the final message instruction to
the user was swallowed up.
This commit is contained in:
Martin Brennan 2021-05-13 15:51:12 +10:00 committed by GitHub
parent 3d2cace94f
commit b690e7787e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -137,7 +137,7 @@ module DiscourseNarrativeBot
src = Discourse.base_url + DiscourseNarrativeBot::Engine.routes.url_helpers.certificate_path(options)
alt = CGI.escapeHTML(I18n.t("#{self.class::I18N_KEY}.certificate.alt"))
"<iframe class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{alt}'>"
"<iframe class='discobot-certificate' src='#{src}' width='650' height='464' alt='#{alt}'></iframe>"
end
protected

View File

@ -715,7 +715,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
it 'should create the right reply' do
it 'should create the right reply and issue the discobot certificate' do
post.update!(raw: "[details=\"This is a test\"]\nwooohoo\n[/details]")
narrative.input(:reply, user, post: post)
@ -729,6 +729,12 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(user.badges.where(name: DiscourseNarrativeBot::AdvancedUserNarrative.badge_name).exists?)
.to eq(true)
expect(topic.ordered_posts.last.cooked).to include("<iframe")
expect(Nokogiri::HTML5(topic.ordered_posts.last.cooked).at("iframe").text).not_to include(
"Bye for now"
)
expect(topic.ordered_posts.last.cooked).to include("</iframe>")
end
end
end