give wiki-pages a media redirect path

refs FOO-1186
flag=none

TEST PLAN:
  1) make a new wiki page with a video
     embed.
  2) notification should get sent, and it should
     have a media download url pointing at the
     course the page lives in

Change-Id: I7b5b3599bf264b5b3aa0cc1c4bb4d09fc135b2cf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253934
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Ethan Vizitei 2020-11-30 16:05:36 -06:00
parent f0bb319837
commit 8077f72d6d
2 changed files with 9 additions and 0 deletions

View File

@ -109,6 +109,8 @@ module Api
context.discussion_topic.course
when Group
context.context
when WikiPage
context.course
else
context
end

View File

@ -54,6 +54,13 @@ module Api
expect(proxy.media_redirect_url("123", "video")).to eq("http://example.com/courses/#{course.id}/media_download?entryId=123&media_type=video&redirect=1")
end
it "has media redirect for wiki pages" do
course = course_model
page = course.wiki_pages.create(:title => "some page")
proxy = UrlProxy.new(StubUrlHelper.new, page, "example.com", "http")
expect(proxy.media_redirect_url("123", "video")).to eq("http://example.com/courses/#{course.id}/media_download?entryId=123&media_type=video&redirect=1")
end
it "can produce a redirect route for announcements" do
course = course_model
announcement = Announcement.new