fix some async functions in upload_file.js

note: if you are going to ‘return’ a promise at the bottom
of a function, don’t make it an async function

if you make a function an async function it will return a promise that 
fulfills with whatever you return

@mlemon: let’s sit down together and make sure this is doing what we
want it to be doing. I’m pretty sure you didn’t mean to return a promise
whose resolved value is another promise (which is what this does before
this change) but I want to make sure

test plan:
* everything should pass

Change-Id: Icf1fca4ed7bbb15df2fcc501771bf724ba3ef51d
Reviewed-on: https://gerrit.instructure.com/206239
Tested-by: Jenkins
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
Ryan Shaw 2019-08-21 22:11:59 -06:00
parent b7bafa5fa3
commit 6c6510e8c8
1 changed files with 2 additions and 2 deletions

View File

@ -192,7 +192,7 @@ export function completeUpload(preflightResponse, file, options={}) {
* @returns an array of attachment objects. The attachment objects contain ids
* that a submissions comment can link to
*/
export async function submissionCommentAttachmentsUpload(files, courseId, assignmentId) {
export function submissionCommentAttachmentsUpload(files, courseId, assignmentId) {
const preflightFileUploadUrl = `/api/v1/courses/${courseId}/assignments/${assignmentId}/submissions/self/comments/files`
const uploadPromises = files.map(currentFile => {
const preflightFileData = {
@ -210,7 +210,7 @@ export async function submissionCommentAttachmentsUpload(files, courseId, assign
*
* @returns an array of attachment objects.
*/
export async function uploadFiles(files, uploadUrl) {
export function uploadFiles(files, uploadUrl) {
// We differentiate between a normal file and an lti content item
// based on the existence of a url attribute on the object. Then we invoke
// the uploadFile function with different parameters based on whether its a