include new rce media comments in discussion podcast feed
test plan: * with rce enhancements, create a discussion and enable podcast * add a reply with media * the podcast feed should include the media closes #LS-1137 Change-Id: I06ac6b1550f09c0b63a3883c06d792d13e9887e3 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243667 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jackson Howe <jackson.howe@instructure.com> Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Robin Kuss <rkuss@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
f59dbfbcaa
commit
9a00067013
|
@ -1500,8 +1500,8 @@ class DiscussionTopic < ActiveRecord::Base
|
|||
txt = (message.message || "")
|
||||
attachment_matches = txt.scan(/\/#{context.class.to_s.pluralize.underscore}\/#{context.id}\/files\/(\d+)\/download/)
|
||||
attachment_ids += (attachment_matches || []).map{|m| m[0] }
|
||||
media_object_matches = txt.scan(/media_comment_([\w\-]+)/)
|
||||
media_object_ids += (media_object_matches || []).map{|m| m[0] }
|
||||
media_object_matches = txt.scan(/media_comment_([\w\-]+)/) + txt.scan(/data-media-id=\"([\w\-]+)\"/)
|
||||
media_object_ids += (media_object_matches || []).map{|m| m[0] }.uniq
|
||||
(attachment_ids + media_object_ids).each do |id|
|
||||
messages_hash[id] ||= message
|
||||
end
|
||||
|
|
|
@ -243,6 +243,20 @@ describe DiscussionEntriesController do
|
|||
expect(rss.items.length).to eql(0)
|
||||
end
|
||||
|
||||
it "should include media comments generated with rce enhancements" do
|
||||
topic_with_media_reply
|
||||
@topic.update_attribute(:podcast_has_student_posts, true)
|
||||
@entry.update_attribute(:message, "<iframe data-media-id=\"#{@mo1.media_id}\"></iframe>")
|
||||
get 'public_feed', params: {:discussion_topic_id => @topic.id, :feed_code => @enrollment.feed_code}, :format => 'rss'
|
||||
require 'rss/2.0'
|
||||
rss = RSS::Parser.parse(response.body, false) rescue nil
|
||||
expect(rss).not_to be_nil
|
||||
expect(rss.channel.title).to eql("some topic Posts Podcast Feed")
|
||||
expect(rss.items.length).to eql(1)
|
||||
expected_url = "courses/#{@course.id}/media_download.mp4?type=mp4&entryId=#{@mo1.media_id}&redirect=1"
|
||||
expect(rss.items.first.enclosure.url).to end_with(expected_url)
|
||||
end
|
||||
|
||||
it "should leave out media objects if the attachment is already included" do
|
||||
topic_with_media_reply
|
||||
@topic.update_attribute(:podcast_has_student_posts, true)
|
||||
|
|
Loading…
Reference in New Issue