Skip to content

Commit

Permalink
Return file's media_entry_id in response
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ed Schiebel <[email protected]>
QA-Review: Ed Schiebel <[email protected]>
Product-Review: Joe Hernandez <[email protected]>
  • Loading branch information
Joe Hernandez committed Nov 18, 2022
1 parent 42c7ca8 commit 0a8a30e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/api/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ function canvasResponseHandler(request, response, canvasResponse) {
folderId: file.folder_id,
iframeUrl: file.embedded_iframe_url,
thumbnailUrl: file.thumbnail_url || file.url,
category: file.category
category: file.category,
mediaEntryId: file.media_entry_id
};
}),
bookmark: packageBookmark(request, canvasResponse.bookmark)
Expand Down
10 changes: 7 additions & 3 deletions test/service/api/files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ describe("Files API", () => {
folder_id: 1,
embedded_iframe_url: "https://canvas.com/foo/bar",
thumbnail_url: "https://canvas.com/foo/bar/thumbnail",
category: "foo"
category: "foo",
media_entry_id: "bar"
};
});

Expand All @@ -139,7 +140,8 @@ describe("Files API", () => {
folderId: 1,
iframeUrl: "https://canvas.com/foo/bar",
thumbnailUrl: "someurl",
category: "foo"
category: "foo",
mediaEntryId: "bar"
});
});
});
Expand All @@ -156,6 +158,7 @@ describe("Files API", () => {
});

it("files have correctly tranformed properties", () => {
file.media_entry_id = null;
canvasResponse.body = [file];
canvasResponse.statusCode = 200;
canvasResponseHandler(request, response, canvasResponse);
Expand All @@ -170,7 +173,8 @@ describe("Files API", () => {
folderId: 1,
iframeUrl: "https://canvas.com/foo/bar",
thumbnailUrl: "https://canvas.com/foo/bar/thumbnail",
category: "foo"
category: "foo",
mediaEntryId: null
});
});

Expand Down

0 comments on commit 0a8a30e

Please sign in to comment.