uncheck all individual items by default on course copy

Test Plan:
 * Go to copy a course
 * Uncheck "Copy Everything from #{course_name}"
 * All the individual items should be unchecked

closes #8297

Change-Id: I12f6cfe5e4feca1eb60783a47dc2d07c2c06a683
Reviewed-on: https://gerrit.instructure.com/10386
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
fix duplicate key issue and general query cache/insert bug, fixes #7983

slightly modified unique_constraint_retry so that:

1. it runs the block without using the query cache
2. it doesn't capture the UniqueConstraintViolation on the second failure
   (should be impossible now, so we definitely want to know if it does)

also fixed a more general issue where inserts would not clear the query
cache if they raised a database error (e.g. violated a constraint)

test plan:

1. in two rails consoles, call Assignment.find_or_create_submission for
   the same user/assignment at the same time inside of a query-cached
   transaction, ensuring that they overlap, e.g.
   Assignment.cache {
     Assignment.transaction {
       s = Assignment.find_or_create_submission(1, 1)
       sleep 10
       s
     }
   }
2. confirm that both commands complete successfully and return the newly
   inserted submission
3. ensure that there is only one duplicate key error in your rails log

Change-Id: I128d331081229d640fb27c011b0216e25a59263c
Reviewed-on: https://gerrit.instructure.com/10400
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
don't fail the page view batch if one row fails

test plan: difficult to test manually. you could add two duplicate page
views to the queue and verify the second one doesn't kill the whole
transaction when it gets a dup key error.

Change-Id: Ic6f20f9a7ff7c844d1f3125323ce881d4f9293ad
Reviewed-on: https://gerrit.instructure.com/9257
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
fix some timezone handling in archaic date.js

 * don't ignore GMT offsets ('+00:00', '0000', 'Z', etc.) when parsing
 * don't ignore GMT offset (0) when calling set({timezoneOffset: 0})
 * handle partial-hour offsets ('+0320' => -200 minutes, etc.) correctly
   in setTimezoneOffset()
 * handle partial-hour offsets (-200 minutes => '+0320', etc.) correctly
   in getUTCOffset()

Change-Id: I40854ea6224ae58af20f3118ca591bd9fa0ff38e
Reviewed-on: https://gerrit.instructure.com/10405
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
upgrade required version of rack to 1.1.3

Change-Id: I844e69f5b9f8184e8bc9e9bf931a1b1140941527
Reviewed-on: https://gerrit.instructure.com/10410
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
don't let popovers escape the window

fixes #8290

test plan:
  * make a calendar event on a sunday
  * click on the event
  * the whole popover should fit

Change-Id: I8624566262248d8c0d2a6006ea1e94a8da98b7f3
Reviewed-on: https://gerrit.instructure.com/10409
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
spec: fix users/show.html.erb_spec

Change-Id: I58bfd13e82b3aac5d441ee282f6e541e74bbef61
Reviewed-on: https://gerrit.instructure.com/10421
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
update CouseDesignerEnrollment to DesignerEnrollment

fixes #7135

test plan:
  1. add userx to a course as a designer
  2. go to userx's account and notice it reads
    "You've been invited to join xxx, xxx as a designer

Change-Id: Icca5ed0b76a94a10c8dfead59587fad47ce312bd
Reviewed-on: https://gerrit.instructure.com/10417
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix incorrect conversation tags, fixes #8274

this is similar to #7231, though the root cause is a little different.
users with duplicate concluded enrollments (e.g. two sections in a course)
may have had improperly tagged private conversations. this was because we
weren't uniq'ing User#conversation_context_codes, so it naively assumed
that both users were in those concluded courses in Conversation#
current_context_strings

the data migration is just like the one we ran in #7231, but a little more
broad (in this case, the Conversation#tags are correct, but the
ConversationParticipant#tags are not). refactored migration code and specs
accordingly, and made it a little nicer on the db.

test plan:

1. enroll user A in two sections of course A (may only be possible via SIS
   or console)
2. conclude course A
3. enroll user A and user B in course B
4. start a private conversation between the users (doesn't matter who
   starts it), but be sure to find the recipient by searching, NOT by
   browsing the course
5. ensure that both users only see course B as the tag on the conversation

Change-Id: I3065b827433b33dbb7ff6a4d0d2affa73cc06e37
Reviewed-on: https://gerrit.instructure.com/10340
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
properley handle query string params on translate links

If there were existing query string parameters when
translating link on an Assessment Question the resultant
string would have two '?' instead of separating them with '&'

Test Plan:
 * Create an assessment question and have the description point to an image in the course by selecting one in the wiki sidebar
 * Before you save the question, add something like "?wrap=1" to the end of the img src
 * Save the question
 * Looking at the source of the question text after save should show that the wrap has a '&' before instead of a '?'

refs #8365

Change-Id: I5e5bb6499013b43a4fd3b2144dc9d8f9536ad174
Reviewed-on: https://gerrit.instructure.com/10411
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
don't fail content import with nil wiki page

Test Plan:
 * Run a WebCT migration, it shouldn't fail when importing

closes #8382

Change-Id: I47f2ad343d06568c4bac115e78434ba77607595c
Reviewed-on: https://gerrit.instructure.com/10413
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
multiple contexts per appointment group

closes #7561

Test plan:
  - create some appointment groups:
    - make one with multiple courses
    - make one with a course, and then add more courses after saving
    - make one restricted to some (not all) sections in a course [1]
    - make one that has students sign up in groups [1]
  - make sure that only students that match the above criteria are able
    to see/reserve those appointment groups

  [1] you can only choose the group-signup option or restrict
      appointment groups to certain sections on creation (these options
      won't be availabe when editing later)

Change-Id: I1cff5fb4ed233882c2061f8fd8a7ba6f2d4959b0
Reviewed-on: https://gerrit.instructure.com/9407
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
don't display un-dated assignments first fixes #7859

also added sorting by assignment title after sorting
by due_at

test plan:

  1. create an assignment with a due date
  2. create an assignment don't give it a due date
  3. as a student go to /courses/[course.id]/assignments
  4. notice the undated assignments don't sort first
  5. notice assignments sort by first due

Change-Id: I57401c0a4c6c3faf60460ce6fd079c192da2e49b
Reviewed-on: https://gerrit.instructure.com/10387
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
improve quiz grading while new version in progress

fixes #8314
fixes #8315

fix the interplay between submission and quiz_submission when manually grading
a quiz_submission's questions or fudge points while another version of the
quiz_submission is currently in progress. we overcorrected slightly in the last
fix.

test plan:
- on a quiz that allows multiple submissions (try with both keep-highest and
  keep-latest settings)
- as a student, complete this quiz, then start taking it again and leave the
  page
- as a teacher, try grading it from the quiz history page or the speedgrader.
  change question points and fudge points. changes should save across reload
  and the score should be in the gradebook.
- also try changing the grade directly in gradebook. and check that the change
  is mirrored in the quiz history page
- as the student, finish the second attempt and start a third.
- repeat the above checks as the teacher, ensuring that the appropriate score
  (highest or latest) comes through in the gradebook.

Change-Id: Id5c0b60c9d0c5f56aae625c3192bd50f93d671b8
Reviewed-on: https://gerrit.instructure.com/10373
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
allow saml configurations to use the eppn

Schools want to be able to specify a saml attribute used for the user's login
instead of NameId. Usually that will be the EPPN (or the portion before the
@). This adds a Login Attribute settings to the SAML settings page, with
options for NameID (the default and historic behavior), the
eduPersonPrincipalName, and the eduPersonPrincipalName with the domain part
stripped.

test plan:
 * Set up Shibboleth... just kidding. Better to just look at the spec.
   Standing up your own shib instance is a ton of work.

Change-Id: I04e32022b940da4cb82ea5f9a59012eb48de2ab6
Reviewed-on: https://gerrit.instructure.com/10120
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
use display name for files in downloaded zips fixes #6731

test plan:
 * upload a file
 * rename it via the ui
 * download the folder as a zip
 * the file should be named what it is in the UI

Change-Id: I61c29d18d5384d24303e6ce57423fb055884e5ec
Reviewed-on: https://gerrit.instructure.com/10418
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
update ruby-saml-mod and libxml gems

Change-Id: I2d0e4f457c684641edeb8beba945b1a67ca91b38
Reviewed-on: https://gerrit.instructure.com/10438
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
pull submit_homework javascript out of view; refs #8145

test-plan:
- make sure assignment submissions still work

Change-Id: I13789f059ce2aae36d1b7f2b0ad81e290c707e95
Reviewed-on: https://gerrit.instructure.com/10035
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
spec: add qUnit spec for fixDialogButtons

Change-Id: I48c22080ec8148dac1e706367244b5ba26647208
Reviewed-on: https://gerrit.instructure.com/10346
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
markup only hide/show toggling of element/dialog

Change-Id: I5434111e98c0186971fb38089db0fa232c9557b6
Reviewed-on: https://gerrit.instructure.com/9499
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>