fix variable hoisting issue and brittle spec

gravatar now proxies fallback urls, meaning they don't work for private
hosts/ips (e.g. dev or test). the profile pic ui tries to remove broken
images, so depending on gravatar's behavior the number of images in the
dom could vary. so we remove that check, since we don't really need it.

also fix a related issue where if one of the images is missing, the last
one in the list will get removed (variable hoisting). incidentally this
fixes a sporadic failure

test plan:
1. run specs, they should pass
2. run canvas locally
3. upload a profile pic and click "Select Image"
4. reload the page and go to edit profile pics again
5. the uploaded pic should not get removed (the broken gravatar one should)

Change-Id: I31c82a983ba6451d7abc4465e7ca345ddaa5697f
Reviewed-on: https://gerrit.instructure.com/13975
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
spec: people_spec intermittent failure

Change-Id: I5b48b5abb9156377f90612cad7237623ac06f05f
Reviewed-on: https://gerrit.instructure.com/13943
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
spec: intermittent announcement_spec failure

Change-Id: I8b1829adb9fc7baf6b70789ba03508a495fda071
Reviewed-on: https://gerrit.instructure.com/13984
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
add data validation to assignment group name, fixes #10900

test plan:
  1.Create a new course
  2.Create a new Assignment Group
  3.Try to enter a name for the group that is more than 250 characters long
  4.Click on the Update button
  5.Group gets saved with no DB error

Change-Id: I99074a0d8e2ed816640be9cf881d65638928d79d
Reviewed-on: https://gerrit.instructure.com/13978
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
render correct page after joining self-signup group

fixes #10880

when joining a self-signup group, permissions were being incorrectly cached
causing a 'membership pending' page to be shown.

test plan:
- as a teacher, create a set of course groups, and allow self-signup
- as a student, join one of these groups
- it should not say 'membership pending'
- it should say 'you joined the group'

Change-Id: Ic11cdeead8db23293e64faa0dc3c803310e426cc
Reviewed-on: https://gerrit.instructure.com/13959
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
add data validation to assignment title, fixes #10898

test plan:
  1. Create a new course
  2. Create a new assignment
  3. Try to add a title to the assignment that is longer than 255 characters long
  4. Notice the input box stops at 255 characters
  5. Click 'Update', notice the assignment is saved with no DB error

Change-Id: I7e5d2374d699c25c15d13cebef2403bea3121e73
Reviewed-on: https://gerrit.instructure.com/13966
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
spread weekly notifications over saturdays

notifications were happening on monday because
TimeWithZone.advance(:days => x) does nothing. move them to saturday for
real and also spread them over the Eastern-time day instead of lumping
them all at 8pm (admittedly by timezone, but that's only 4 hours for the
continental US, which is the current majority of users).

add an indicator to the notification preference page to show a rough
time block in which they can expect their weekly messages to be sent.

fixes #8296

test-plan:
  setup:
  - create two accounts the same id but on different shards (shard ids
    should not differ by a multiple of four)
  - in each a account, create a user with a communication channel; call
    them Alice and Bob.
  - create a third account on the same shard as Bob's account but with a
    different id (account ids should not differ by a multiple of four)
  - in this account create two users with a communication channel each;
    call them Charles and David.
  - for each of the four users, assign a notification to deliver to the
    user's communication channel weekly
  - on Friday, trigger the associated notifications for each user
  - on Sunday, trigger David's notification again

  expectations:
  - each user should receive the messages on saturday (Eastern-time),
    not monday
  - Alice's and Bob's emails should arrive in different "quarter days"
  - Bob's and Charle's emails should arrive in different "quarter days"
  - Charles' email and David's first email should arrive in the same
    "quarter day" but in different hours
  - David's emails should come a week apart, but in the same hour both
    times

  UI:
  - go to the notifications preference page
  - should see note at bottom indicating two hour block during which
    their weekly notifications will be sent
  - actual send time of weekly notifications should fall within that
    block

Change-Id: I97bb75762ef8c03fae99ad5499b441f7c026d2c8
Reviewed-on: https://gerrit.instructure.com/13963
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
updated parallelized gem

Change-Id: I0567e6bdd70bd1c71cba54cbe16aa47e3dd2955c
Reviewed-on: https://gerrit.instructure.com/14015
Tested-by: Jake Sorce <jake@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
gem parallelized_spec version update

Change-Id: If5a1a5b5505a2ccd3edbaa9ffb46c94c2cd80970
Reviewed-on: https://gerrit.instructure.com/14018
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
add data validation to calendar2 popup for adding an assignment

fixes #10969

test plan:
  1.Create a new course
  2.Navigate to Calendar2
  3.Double click one of the dates on the month calendar
  4.Try to add  some text that is greater than 255 characters
  5.Notice the text stops at 255 characters, click 'Submit'
  6.Notice that the assignment is created without a DB error

Change-Id: I4566e2b1756bd1984554eb35fda7094fa00ea2f4
Reviewed-on: https://gerrit.instructure.com/14014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
fix jt bug, fixes #10929

fix inline js translation helper (jt) so that it works with absolute keys

test plan:
1. change the locale for the root account
2. log out
3. follow the "forgot password" link
4. put in your email and submit
5. the green "email sent" notification that pops down should be translated

Change-Id: I3f8cf0cb3ac87823c44482bba1f4dcf1cc601c0c
Reviewed-on: https://gerrit.instructure.com/13960
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
use crocodoc for eligible files in full_files.js

closes #10956

Test plan:
  * make a crocodocable homework submission
  * preview the file in the user file's page and make sure it opens in
    crocodoc (not google docs)

Change-Id: Ifa9557dbfba2f1253fa02b99ece20de7a7f9cd21
Reviewed-on: https://gerrit.instructure.com/14006
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
add aria-label to dropped assignments. fixes #9253

on the student grade summary page, notify users using
screen readers of assignments that will be dropped.

test plan:
  * as a student using a screen reader, navigate to a
    course grade summary page that has dropped assignments;
  * navigate to the points column of a dropped assignment and
    verify that a notice that the assignment will not be
    considered in the final calculation is read.

Change-Id: Iad2bb9ef60bf14cfc39dbab0867592fd34a6761a
Reviewed-on: https://gerrit.instructure.com/14017
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
fix conversation recipient list clipping, fixes #10961

fix regression caused by #8684 where recipient/course popovers (e.g.
"3 others" link) would get clipped. move popover up a bit in the dom and
change how it gets positioned (now we clone the hidden contents).

test plan:
1. in each supported browser, go to conversations
2. if you don't already have any, create conversations with many
   recipients and many courses (so you get those links)
3. ensure the popovers work in the left-hand pane
   1. they should not get clipped
   2. they should be positioned under the link
   3. they should scroll
4. ensure the popovers work in the right-hand pane (when the conversation
   is selected)
   1. they should not get clipped
   2. they should be positioned under the link

Change-Id: Icfb3ce3686e664b13edcf1d4f6e7ef261bf360de
Reviewed-on: https://gerrit.instructure.com/14020
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
respect section privs in Quiz#show and Quiz#moderate

refs #9548

test plan:
 * create a course with two sections and a quiz
 * enroll a student in each section
 * enroll a TA in one section, with privileges limited to
   that section
 * take the quiz as each student
 * log in as the TA
 * verify that the "Show Student Quiz Results" button
   does not let you see the results for the student
   outside your section
 * verify that the "Moderate This Quiz" button
   does not let you see the results for the student
   outside your section

Change-Id: I5f25f3b8272790366c9213ba4e1d58abbdfd6752
Reviewed-on: https://gerrit.instructure.com/13979
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
batch up delayed message sending jobs

test plan: set some notification preferences to daily/weekly for a few
different users. after the SummaryMessageConsolidator job runs, the
messages should still get sent, and DelayedMessage.summarize jobs should
be created in batches rather than individually.

Change-Id: I81c0404ad641ef0e89e585b104c7727b16cd800a
Reviewed-on: https://gerrit.instructure.com/13775
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
don't leak crocodoc api key in attachment json

Change-Id: I7dea60d27f6b07ce50f820c616129f0d89b97517
Reviewed-on: https://gerrit.instructure.com/13987
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
clean up code in ujsLinks

clean up update code style to not use $.proxy,
like we talked about in our meeting and a couple
other minor fixes

Change-Id: I9537f7e40bc63fe17b14fac20e80111fbd48af24
Reviewed-on: https://gerrit.instructure.com/14021
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
fix crocodoc edit permissions

fixes #11004

Test plan:
  * open a crocodoc submission in speed grader, and/or the submission
    details page
    - you should be able to see/make annotations
  * open the same submission in the user's files area
    - you shouldn't be able to see or make annotations

Change-Id: I2755079dedd057a1db326cf4cc865ac5a36debd0
Reviewed-on: https://gerrit.instructure.com/14029
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
spec: context modules intermittent failure

Change-Id: Ie374793a559488b80d06dbdd484d6113de7d3eb5
Reviewed-on: https://gerrit.instructure.com/13988
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>