Skip to content

Commit 0a8a30e

Browse files
author
Joe Hernandez
committed
Return file's media_entry_id in response
fixes MAT-959 flag=none Test Plan 1: Backwards compatibility - Get the changes in this commit locally in your RCS - In your local canvas, run a recent version of master - In canvas, go to an RCE - From tools menu: Insert > Document > Course documents - In the dropdown that says "Document", change to "All" - Select a file from either "Course files" or "My files" VERIFY: - file is properly embedded in the RCE. Test Plan 2: Together with corresponding changes in the canvas-lms repo - https://gerrit.instructure.com/c/canvas-lms/+/305518 - follow the test plan outlined in that commit Change-Id: I4aeaf098c8192d9664f7ef89cfa89466d328a5c0 Reviewed-on: https://gerrit.instructure.com/c/canvas-rce-api/+/305519 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Ed Schiebel <eschiebel@instructure.com> QA-Review: Ed Schiebel <eschiebel@instructure.com> Product-Review: Joe Hernandez <joe.hernandez@instructure.com>
1 parent 42c7ca8 commit 0a8a30e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

app/api/files.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function canvasResponseHandler(request, response, canvasResponse) {
3838
folderId: file.folder_id,
3939
iframeUrl: file.embedded_iframe_url,
4040
thumbnailUrl: file.thumbnail_url || file.url,
41-
category: file.category
41+
category: file.category,
42+
mediaEntryId: file.media_entry_id
4243
};
4344
}),
4445
bookmark: packageBookmark(request, canvasResponse.bookmark)

test/service/api/files.test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ describe("Files API", () => {
115115
folder_id: 1,
116116
embedded_iframe_url: "https://canvas.com/foo/bar",
117117
thumbnail_url: "https://canvas.com/foo/bar/thumbnail",
118-
category: "foo"
118+
category: "foo",
119+
media_entry_id: "bar"
119120
};
120121
});
121122

@@ -139,7 +140,8 @@ describe("Files API", () => {
139140
folderId: 1,
140141
iframeUrl: "https://canvas.com/foo/bar",
141142
thumbnailUrl: "someurl",
142-
category: "foo"
143+
category: "foo",
144+
mediaEntryId: "bar"
143145
});
144146
});
145147
});
@@ -156,6 +158,7 @@ describe("Files API", () => {
156158
});
157159

158160
it("files have correctly tranformed properties", () => {
161+
file.media_entry_id = null;
159162
canvasResponse.body = [file];
160163
canvasResponse.statusCode = 200;
161164
canvasResponseHandler(request, response, canvasResponse);
@@ -170,7 +173,8 @@ describe("Files API", () => {
170173
folderId: 1,
171174
iframeUrl: "https://canvas.com/foo/bar",
172175
thumbnailUrl: "https://canvas.com/foo/bar/thumbnail",
173-
category: "foo"
176+
category: "foo",
177+
mediaEntryId: null
174178
});
175179
});
176180

0 commit comments

Comments
 (0)