Broken "Show list of file types for file limitation on assignment uploads" feature?

Jump to solution
emlarson
Community Participant

Reaching out to my fellow Admins: We discovered that a feature we had in the Assignments area to show checkboxes of some common filetypes when teachers opt to restrict file uploads apparently isn't the core Canvas feature that we thought it was. That's relevant because it just broke, and we have no idea where it came from... and, if it wasn't unique to us, it might be broken in other systems out there now?

The code doesn't have much commenting beyond its description of "Show list of file types for file limitation on assignment uploads" and a reference that it "uses onPage function by RPFlorence" which points to a GitHub site of Ryan Florence's InstructureCon code from 11 years ago.

I guess I'm not surprised it broke given that the Assignments page was just redesigned... and I can't blame Instructure for not supporting something that isn't in their core code... but we didn't put it there, so I have a feeling our Instructure implementation team in 2016 added it (and they've all left the company in the years since).

Does anyone else have this code for Assignments in their instance and, if so, is it still working?

1 Solution

@emlarson and @JamesSekcienski 

First off, I do not like jQuery and agree with moving away from it.

Second, I'm a Python programmer but understand how jQuery works with HTML and can dabble in it when needed 🙂

The reason why your code isn't working is because it's relying on behavior that was present in 1.6 jQuery and was changed for 1.7+ jQuery. 

Remember that jQuery on Canvas got updated for security reasons a few months ago, which also probably broke a lot of scripts (including this one!) This very much has shades of when Python moved from 2.x to 3.x and broke backwards compability.

The good news is that I think the fix is one line and it's straightforward.

Find the line 

if($(this).attr('checked') == "checked"){

and change it to

if ($(this).prop("checked")) {

Save your custom JS and load it into Beta first, then check with an assignment. I loaded it up in my Canvas beta instance and it looks like it worked and saved the assignment correctly.

Good luck!

View solution in original post