new stylesheet for new features with bootstrap

visit /styleguide to see the new styles and how to
use them in new/updated pages.

set the `@use_new_styles` variable in your
actions to tell canvas to include the new
stylesheets

by drawing a hard line between the old and new
styles we can:

1. deliver only the stylesheets the new page needs
2. not worry about inherited styles and overriding
   them for new pages
3. be able to easily remove old stylesheets when
   all pages are updated to the new styles

Change-Id: I00989e485f2e35a291b2630d75e11d21efe6c76f
Reviewed-on: https://gerrit.instructure.com/10416
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Remove user's avatar url when profile picture is deleted. Fixes #8225

When an file attachment is deleted, check to see if it is used as the user's
profile picture. If so, delete the avatar url that references the file.
Also adds an "active" named scope to Attachment that is used in FilesController
to not return image_thumbnails for deleted attachments.
Adds a User method "clear_avatar_image_url_with_uuid" and specs to test it.

Test Plan:
* Add a profile picture to a user.
* Verify that the image shows up on GradeBook2
* Delete the file used as the profile picture from the user's "Files" area.
* Revisit the GradeBook2 page and the user's profile image should be the
   default one used when none is assigned (silhouette).

Change-Id: Iaa0941a84503e341158615a12c62a77e951c283f
Reviewed-on: https://gerrit.instructure.com/10654
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Data fix migration to recompute unread conversations count. Fixes #8308

 Current code that trigger incremental changes to users.unread_conversations_count
 appears to be correct. Believe the problem is a legacy data problem where data was
 incorrect from previous code issues and wasn't fixed previously.

 Test Plan:
 * setup a user with conversations
 * in the database, modify users.unread_conversations_count to be wrong (high or low)
 * run the migration and the conversation count should be corrected

Change-Id: Ibe5c1db2fb494e9800f89e9316f2a9519df77c43
Reviewed-on: https://gerrit.instructure.com/10702
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
use unicode compliant sorting for User#sortable_name (if possible)

fixes #7202

test plan:
 * Use postgres
 * Have pg_collkey installed
 * Add users whose last names are subsets of each other
 * Grade CSV, speedgrader, accounts page, etc. should sort them correctly
   (shorter last name first; case insensitively)

Change-Id: Idec2a9f0e89c4f4479b4fd54136291273ba49ad9
Reviewed-on: https://gerrit.instructure.com/10497
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
1.9 - fix content tag asset lookup

In 1.9, const_defined? and const_get by default will search ancestors. That
broke the ContentTag validation of valid asset tag content types.

Change-Id: I8566eff2bfc74fd9ff73e6c324e9919a2bb6f961
Reviewed-on: https://gerrit.instructure.com/10711
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
1.9 - fix diff between how exceptions are raised

Change-Id: I15efa3e5b083db48a95878dcd5ea7745f5c525ab
Reviewed-on: https://gerrit.instructure.com/10712
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
1.9 - fix time formatting difference in quiz spec

Change-Id: I772a2be5fb9b9912cd5e1a1ccaa41614f8173248
Reviewed-on: https://gerrit.instructure.com/10713
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
1.9 - fix csv import specs and attachment_fu bug

 * attachment_fu monkey-patches Tempfile, breaking the ability to specify
   an array as the basename (but only in 1.9). When using an array the hack
   attachment_fu is making is unecessary, so we use the original method.
 * There was a race condition with the Tempfile object being finalized earlier
   than it ever was on 1.8.
 * There is no more String#each method in 1.9.

Change-Id: Ib637c3494775a922785feecb8584027157dcfc94
Reviewed-on: https://gerrit.instructure.com/10727
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
add extra tool information on LTI launch

These fields are required for LTI compliance

Test Plan:
 * Launch a tool, it should work and send the 'tool_consumer_info_product_family_code' and 'tool_consumer_info_version' parameters

Change-Id: I2e4bb546bfc63a4f1fdd8b1be2792f72aeac05ca
Reviewed-on: https://gerrit.instructure.com/10799
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
do not allow quizzes to submit after "lock after" time, fixes #7696

test plan:
- set lock time and due time on quiz, with lock time after due time
- start quiz after due time
- at lock time the quiz should submit

Change-Id: I81b2bafeb3c5e274bd7df476a7ac9cd7747dc38a
Reviewed-on: https://gerrit.instructure.com/10690
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
fix javascript errors on assignment submission button

fixes #8585

test plan:
  1. USE_OPTIMIZED_JS=true
  2. rake js:build
  3. go to an assignment that needs to be submitted
  4. click Submit Assignment button

Change-Id: I80a68bc64bcd8c929fd20118c95193f3fca699ca
Reviewed-on: https://gerrit.instructure.com/10785
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
fix conversations masquerading issue, closes #8619

fixes an issue where a masquerader would get a page error on the
conversations page (but only if he's not a site admin)

test plan:
1. confirm that the inbox loads correctly
2. as a site-admin, masquerade as a user and confirm that the inbox
   loads correctly
3. as a non-site-admin, masquerade as a user and confirm that the inbox
   loads correctly

Change-Id: I024abc8d2d9079fb62f4a208d3c290c9e5287ef6
Reviewed-on: https://gerrit.instructure.com/10752
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
move questions all at once

test plan:
 * go to a question bank and move multiple questions;
   it should work
 * go to a question bank and copy a question;
   it should work

Change-Id: Ie71519e94972f03e990599fa567556f9d2c9098e
Reviewed-on: https://gerrit.instructure.com/8033
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
add email_only option for LTI tools

This is required for LTI conformance

Test Plan:
 * Configure a tool as email only
 * Launch a tool and verify name info isn't sent

Change-Id: I8d67fa6a8bef7e3ead0a01bd45834976b02e487f
Reviewed-on: https://gerrit.instructure.com/10801
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
make mathquill pass jslint

Change-Id: I30fc725fcc02d29c1edf05120358edc9eb178e96
Reviewed-on: https://gerrit.instructure.com/10620
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
clean up rake canvas:check_syntax code

* get rid of "\033[1;31m" stuff used for coloring
  output so hudson output is cleaner
* don't need the files_not_to_lint variable because
  they all have been moved to /vendor
* don't lint compiled coffeescript

Change-Id: I491aeb8fb96e09f78c5d7cde327d1a233a9f6b9c
Reviewed-on: https://gerrit.instructure.com/10619
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
spec: admin_avatars

tested:
       * submitted avatar
       * reported avatar
       * approved avatar
       * lock avatar
       * unlock avatar
       * delete avatar

Change-Id: I15014d52a6fb021acc71c64f101b939e611ccb8b
Reviewed-on: https://gerrit.instructure.com/10770
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
copy new_tab setting for external tool links during course copy.

fixes #8648

test plan:
  * create a course with an external tool link in a module
    that is set to open in a new tab;
  * create a second course, and copy the first course's content
    into it;
  * verify that the link is copied and that it is properly set
    to open in a new tab.

Change-Id: Ib12cf67405393dfbeea416cbe056152daec805de
Reviewed-on: https://gerrit.instructure.com/10778
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
paginate the activity stream apis

These were hard coded to always return 21 items, same as the dashboard
screens in the web UI. They're now fully pagniated, though the per_page
default in this case is 21, to match the old behavior.

test plan: make an api call to users/self/activity_stream and
courses/X/activity_stream, and verify the pagniation. this touches the
code for the activity stream in the ui in a refactor, but shouldn't have
any visible changes.

Change-Id: I8da63eb4e03bb616d66d0af27efa30ef786dd3dd
Reviewed-on: https://gerrit.instructure.com/10678
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
remove invalid quotes from speedgrader url link; fixes #8575

in gradebook1, we were using a json string to generate the speedgrader url to
a specific student, but using the json string inserted an extra set of double
quotes around the value that the url wasn't expecting and didn't handle well.
so we switching to just hardcode the format that we need.

also, this removes one block of dead code from speedgrader.js

test plan:
- go to gradebook1
- click on a cell for a submitted online text entry assignment
- make sure the "submission details" and the "view submission" links both load
  the speed grader with the correct student

Change-Id: I3023a1398ed1059ee00e6daa2655ce91226bc8e8
Reviewed-on: https://gerrit.instructure.com/10706
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>