canvas_link_migrator 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db94154546720e46dbc316e28fd6b42ee03c51ee13df32d1601924fd78d158d6
|
4
|
+
data.tar.gz: f4a71b858889356c765fcce8360d6266b1b4cd43648cd99eed291287a5229dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2499b2e3764c0bf76ae4f840345104cae6187e970c4bd8f8965254836387221ae84c96041527824fd27edeff602587afb21f629b062c6e83b74e80defd14997
|
7
|
+
data.tar.gz: 49c3e7eb354ea51183ad44706002bb3c92dbc2c98db12371fc420f00eb2616e19fd4b6a8c3e01345d69c7d8b2b81ba71b79341f7ea2802ee8b738b3c56c3a349
|
@@ -96,12 +96,15 @@ module CanvasLinkMigrator
|
|
96
96
|
|
97
97
|
# Replace old style media anchor tags with iframes
|
98
98
|
doc.search("a[id*='media_comment_']").each do |media_node|
|
99
|
+
next unless media_node["class"].match('instructure_inline_media_comment')
|
100
|
+
|
99
101
|
media_node.name = "iframe"
|
100
102
|
# smallest accepted size for iframe since we don't have the size available for these
|
101
103
|
media_node["style"] = "width: 320px; height: 240px; display: inline-block;"
|
102
104
|
media_node["title"] = media_node.text
|
103
105
|
media_node.child&.remove
|
104
|
-
|
106
|
+
media_type = media_node["class"].match(/(audio|video)/)&.[](1)
|
107
|
+
media_node["data-media-type"] = media_type if media_type
|
105
108
|
media_node["src"] = media_node["href"]
|
106
109
|
media_node.delete("href")
|
107
110
|
media_node["allowfullscreen"] = "allowfullscreen"
|
@@ -51,4 +51,17 @@ describe CanvasLinkMigrator::LinkParser do
|
|
51
51
|
expect{ parser.convert_link(doc.at_css('a'), "href", "wiki_page", "migrationid", "") }.not_to raise_error
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
describe "convert" do
|
56
|
+
it "does not change media anchor tags into iframes if they don't have inline_media_comment in the class" do
|
57
|
+
doc = Nokogiri::HTML5.fragment(%Q(<p><a id="media_comment_m-5HHT5LqZqPf7qhEJ7PbKtehCiunxM4BB" class=" instructure_video_link instructure_file_link" title="00-Personal Intro.m4v" href="https://xu.instructure.com/courses/83206/files/12176377/download?wrap=1" target="" data-api-endpoint="https://xu.instructure.com/api/v1/courses/83206/files/12176377" data-api-returntype="File">Click here to watch personal introduction</a></p>))
|
58
|
+
parser.convert(doc.to_html, "type", "lookup_id", "field")
|
59
|
+
expect(doc.to_html).to match(%Q(<p><a id="media_comment_m-5HHT5LqZqPf7qhEJ7PbKtehCiunxM4BB" class=" instructure_video_link instructure_file_link" title="00-Personal Intro.m4v" href="https://xu.instructure.com/courses/83206/files/12176377/download?wrap=1" target="" data-api-endpoint="https://xu.instructure.com/api/v1/courses/83206/files/12176377" data-api-returntype="File">Click here to watch personal introduction</a></p>))
|
60
|
+
end
|
61
|
+
|
62
|
+
it "does not crash if it can't find a video/audio_comment class name" do
|
63
|
+
doc = Nokogiri::HTML5.fragment(%Q(<a id="media_comment_m-4uoGqVdEqXhpqu2ZMytHSy9XMV73aQ7E" class="instructure_inline_media_comment" data-media_comment_type="video" data-alt=""></a>))
|
64
|
+
expect{ parser.convert(doc.to_html, "type", "lookup_id", "field") }.not_to raise_error
|
65
|
+
end
|
66
|
+
end
|
54
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_link_migrator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mysti Lilla
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-05-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|