Set category when creating button & icon files
closes MAT-631 flag=rce_buttons_and_icons Test Plan: - Create a button and icon and observe the network requests being made for the file upload - Verify a category: "buttons_and_icons" param is sent in the post request to the "http://rce.canvas.docker/api/upload" endpoint Change-Id: I21ee4d7af00f6b8642c44c4388497df62759674b Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283594 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Joe Hernandez <joe.hernandez@instructure.com> QA-Review: Joe Hernandez <joe.hernandez@instructure.com> Product-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
parent
23c4ef7fe6
commit
2af540b641
|
@ -365,7 +365,8 @@ class RceApiSource {
|
|||
contextType: apiProps.contextType,
|
||||
file: fileProps,
|
||||
no_redirect: true,
|
||||
onDuplicate: apiProps.onDuplicate
|
||||
onDuplicate: apiProps.onDuplicate,
|
||||
category: apiProps.category
|
||||
}
|
||||
|
||||
return this.apiPost(uri, headers, body)
|
||||
|
|
|
@ -266,7 +266,13 @@ export function uploadToButtonsAndIconsFolder(svg, uploadSettings = {}) {
|
|||
.then(({folders}) => {
|
||||
fileMetaProps.parentFolderId = folders[0].id
|
||||
return source
|
||||
.preflightUpload(fileMetaProps, {host, contextId, contextType, onDuplicate})
|
||||
.preflightUpload(fileMetaProps, {
|
||||
host,
|
||||
contextId,
|
||||
contextType,
|
||||
onDuplicate,
|
||||
category: 'buttons_and_icons'
|
||||
})
|
||||
.then(results => {
|
||||
return source.uploadFRD(svgAsFile, results)
|
||||
})
|
||||
|
|
|
@ -564,6 +564,17 @@ describe('sources/api', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('includes "category"', () => {
|
||||
fetchMock.mock(uri, '{}')
|
||||
|
||||
return apiSource
|
||||
.preflightUpload(fileProps, {category: 'buttons_and_icons'}, apiProps)
|
||||
.then(() => {
|
||||
const body = JSON.parse(fetchMock.lastOptions(uri).body)
|
||||
assert.equal(body.category, 'buttons_and_icons')
|
||||
})
|
||||
})
|
||||
|
||||
it('includes jwt in Authorization header', () => {
|
||||
fetchMock.mock(uri, '{}')
|
||||
|
||||
|
|
|
@ -230,7 +230,8 @@ describe('Upload data actions', () => {
|
|||
host: 'http://host:port',
|
||||
contextId: 101,
|
||||
contextType: 'course',
|
||||
onDuplicate: undefined
|
||||
onDuplicate: undefined,
|
||||
category: 'buttons_and_icons'
|
||||
}
|
||||
|
||||
return store.dispatch(actions.uploadToButtonsAndIconsFolder(svg)).then(() => {
|
||||
|
@ -273,6 +274,7 @@ describe('Upload data actions', () => {
|
|||
parentFolderId: 2
|
||||
},
|
||||
{
|
||||
category: 'buttons_and_icons',
|
||||
contextId: 101,
|
||||
contextType: 'course',
|
||||
host: 'http://host:port',
|
||||
|
|
Loading…
Reference in New Issue