Handle links to course home in course copy
fixes LS-2325 flag=none test plan: - Create a page - In the content of the page create a link to the course home by clicking the dropdown next to the link button in the RCE menu, then clicking Course Links, expand Course Navigation, then select Home - With the Home link in the content, save the page - Export the course - Import the course content into a new course - Verify the link in the imported page content is linked to the new page's home navigation and not the old course - Also verify just using the Copy Course from Import Course Content also changes the home navigiation link as expected Change-Id: Ib7779a4c42f9669ac4da6408a2fbd453ae31a039 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267975 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jackson Howe <jackson.howe@instructure.com> QA-Review: Jackson Howe <jackson.howe@instructure.com> Product-Review: Eric Saupe <eric.saupe@instructure.com>
This commit is contained in:
parent
744aea34d9
commit
dc1069ce81
|
@ -223,6 +223,11 @@ module CCHelper
|
|||
match.url.sub(/course( |%20)files/, WEB_CONTENT_TOKEN)
|
||||
end
|
||||
end
|
||||
@rewriter.set_handler('courses') do |match|
|
||||
if match.obj_id == @course.id
|
||||
"#{COURSE_TOKEN}/"
|
||||
end
|
||||
end
|
||||
@rewriter.set_handler('files') do |match|
|
||||
if match.obj_id.nil?
|
||||
if match_data = match.url.match(%r{/files/folder/(.*)})
|
||||
|
|
|
@ -72,7 +72,7 @@ module UserContent
|
|||
if !use_updated_math_rendering
|
||||
mathml = UserContent.latex_to_mathml(equation)
|
||||
next if mathml.blank?
|
||||
|
||||
|
||||
mathml_span = node.fragment(
|
||||
"<span class=\"hidden-readable\">#{mathml}</span>"
|
||||
).children.first
|
||||
|
@ -150,6 +150,7 @@ module UserContent
|
|||
'assignments' => :Assignment,
|
||||
'announcements' => :Announcement,
|
||||
'calendar_events' => :CalendarEvent,
|
||||
'courses' => :Course,
|
||||
'discussion_topics' => :DiscussionTopic,
|
||||
'collaborations' => :Collaboration,
|
||||
'files' => :Attachment,
|
||||
|
@ -213,7 +214,7 @@ module UserContent
|
|||
|
||||
html.gsub(@toplevel_regex) do |url|
|
||||
_absolute_part, prefix, type, obj_id, rest = [$1, $2, $3, $4, $5]
|
||||
next url if !@contextless_types.include?(type) && prefix != @context_prefix
|
||||
next url if !@contextless_types.include?(type) && prefix != @context_prefix && url != @context_prefix
|
||||
|
||||
if type != "wiki" && type != "pages"
|
||||
if obj_id.to_i > 0
|
||||
|
|
|
@ -197,6 +197,13 @@ describe CC::CCHelper do
|
|||
expect(translated).to match %r{\$CANVAS_COURSE_REFERENCE\$/files}
|
||||
end
|
||||
|
||||
it "should interpret links to the home page as normal course pages" do
|
||||
@exporter = CC::CCHelper::HtmlContentExporter.new(@course, @user, :for_course_copy => true)
|
||||
html = %{<a href="/courses/#{@course.id}">Home page index</a>}
|
||||
translated = @exporter.html_content(html)
|
||||
expect(translated).to match %r{\$CANVAS_COURSE_REFERENCE\$/}
|
||||
end
|
||||
|
||||
it "should prepend the domain to links outside the course" do
|
||||
allow(HostUrl).to receive(:protocol).and_return('http')
|
||||
allow(HostUrl).to receive(:context_host).and_return('www.example.com:8080')
|
||||
|
|
Loading…
Reference in New Issue