fix bulk private message attachment regression, fixes #11277

ensure that the attachment associations get created for each bulk private
message. previously we would explicitly create each message, and thus tell
it which attachments it should have. now we create a single message (the
root one) and do the other ones in a delayed job. since we were just
cloning the root message, the associations were not being copied

fortunately, we have all the data, so we can restore any associations that
should have gotten created

test plan:
1. send a bulk private message to a bunch of people, specifying one or
   more attachments
2. ensure that the attachment appears in each created/updated conversation
   (for both sender and recipient)

Change-Id: I1a72b3ef0a047a413b84e780811b84b298c6ec57
Reviewed-on: https://gerrit.instructure.com/14474
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
move infer_defaults to before_validation so validation passes

this will allow an existing invalid assessment question name to
be updated instead of continually failing validation

fixes #11230

test plan:
 - create a question bank with a question that has a name longer than 255 characters (see #11230)
 - edit the question and modify its name so it is shorter than 255 characters
 - save the question; it should save successfully now

Change-Id: I9342d5aeb0541947196e132481d77c83b0ba750c
Reviewed-on: https://gerrit.instructure.com/14419
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Fix url for "Publish Grades to SIS" in GB2 to be correct. Fixes #11163

The URL it links to is "/courses/[id]]/details?fragment=tab-grade-publishing".
This doesn't activate the desired "Grade Publishing" tab that URL
"/courses/[id]/details#tab-grade-publishing" does.

Changed menu URL to be consistent with gradebooks.js and fix the link
to use an anchor like "details#tab-grade-publishing".

Testing Steps:
==========
* Using an SIS enabled course, go to Gradebook2 as a teacher
  * Requires plugin "grade_export" otherwise, hack the show page logic
    like "<% if true || @context..." to enable the display of link.
* On the gear menu, select the "Publish Grades to SIS" option.
* The link should display the Course settings page and activate the
   "Grade Publishing" tab. (NOTE: Tab not shown if plugin missing)

Change-Id: Id2004273cf85809e8640b86ebe9b80685db731eb
Reviewed-on: https://gerrit.instructure.com/14311
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
add calendar js to remove from custom report view

test plan
 * custom reports from plugins that use a calendar
   should still work

Change-Id: Ic82d26484c4d192a8ca9c0d84d53f55b44e05880
Reviewed-on: https://gerrit.instructure.com/14249
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
make more options link text toggle correctly, fixes #11236

test plan:
  1. login as a teacher
  2. create a course
  3. go to course settings
  4. click 'Edit Course Details'
  5. click 'more options' at the bottom
  6. the extra options should display
  7. the 'more options' link text should change
     to 'less options'
  8. click the 'less options' link
  9. the extra options should hide and the text
     should change to 'more options' again

Change-Id: I0a3e35ce7e439b4927cd8cc1f2e4e369780cc78b
Reviewed-on: https://gerrit.instructure.com/14364
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
be tolerant of slightly different format of PG error messages

test plan:
 * run active_record_base_spec.rb on different postgres installs

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