spec: fix i18n spec side effects

don't mess up I18n.locale for subsequent specs. also make the spec pass
next year ;)

test plan: run specs

Change-Id: Id89dce43713ea2eaf04730d537747188d0e87d38
Reviewed-on: https://gerrit.instructure.com/13645
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
don't display "select correct answer" arrows for fill in multiple blanks. Fixes #10325

Hide the "select correct answer" arrows that display next to
answers but only for "Fill in multiple blanks" question types.
All answers listed are considered correct and it doesn't make
sense to allow selecting a "correct" one. Doing so would
cause the other answers to appear as incorrect (red) but
it would still not treat the answers as incorrect. This change
makes it more consistent with current "fill in the blank" question
types.

Testing Notes:
==========
* Create/edit a quiz
* Create/edit a "Fill in multiple blanks" question
* Verify that the arrows for selecting a correct
   answer no longer appear.
* Verify that the arrows appear for other questions
   that need ability to select correct answers.

Change-Id: Ieadd5667d5a349e9693771f43c01aac36f9327f6
Reviewed-on: https://gerrit.instructure.com/13541
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
api: fix course users pagination with multiple enrollments

there was an issue when trying to jump to the specific page a user is on the in
course users endpoint, where the count to compute the correct page wasn't
taking unique users into account correctly.

test plan:
- in a course, enroll 5 student each in 2 sections
- use the /courses/<id>/users endpoint with a small per_page. try querying for
  pages for specific users.
- it should work correctly

Change-Id: I23acf1cc3f4e0e39bd4993e3a5a896b2e3c69409
Reviewed-on: https://gerrit.instructure.com/13643
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
check cache and redis (if enabled) in heartbeat action

test plan: hit /heartbeat with redis not responding, you should get an
error not a "canvas ok" message.

Change-Id: If58282264a80d239e7e938ea5794f09ce74fbbeb
Reviewed-on: https://gerrit.instructure.com/13612
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
add Course#asset_user_accesses association

Change-Id: Ibfc70c3f56f632b684d642907d481bd9c5294134
Reviewed-on: https://gerrit.instructure.com/13584
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
fixup "skip to content" link in webkit.

in ab97213e we added js to handle focusing #content
but we also added tab index="-1" to #content. this
made it so if you click anywhere on the top half of
the screen on the login screen it would focus the whole
top half as if it was a link.

Change-Id: Iea925e02da80a07633fcf1c3f809e1c0aaa49023
Reviewed-on: https://gerrit.instructure.com/13634
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
spec: do not execute security_spec in parallel

test-plan: n/a
Change-Id: I235c0c704e4d5186d3cebbfdb6e91e72741b944b
Reviewed-on: https://gerrit.instructure.com/13642
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
handle child events in calendar ICS/ATOM feed

currently this only works for the user's calendar feed, not the
individual course calendar feed, since that feed doesn't include any
information on which user is requesting the data. that's a further TODO.

fixes #9647

test plan:
 * create a course event in calendar2 which has different times for
   different sections in the course.
 * go to /calendar and load the Calendar Feed as a teacher, verify that
   two separate individual events are shown one for each section, just
   like in the web ui.
 * go to /calendar and load the Calendar Feed as a student, verify that
   just the one event for that section is shown
 * in both cases, there shouldn't be a separate copy of the event that
   spans both time periods, like there is on prod right now

Change-Id: I3244121ef3ff911eac043a5f69bb5944556a828a
Reviewed-on: https://gerrit.instructure.com/13394
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
reset i18n initializer in get_context

fixes #9870

we want to reset it so that translation calls in before_filters don't cache the
locale without the context set, breaking further i18n translation calls.

test plan:
- in a test environment, change a course language
- it should succeed

Change-Id: I8248f1be1c8b69bca95a14ceb0217e4634f14b84
Reviewed-on: https://gerrit.instructure.com/13441
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
handle child events in calendar ICS/ATOM feed

currently this only works for the user's calendar feed, not the
individual course calendar feed, since that feed doesn't include any
information on which user is requesting the data. that's a further TODO.

fixes #9647

test plan:
 * create a course event in calendar2 which has different times for
   different sections in the course.
 * go to /calendar and load the Calendar Feed as a teacher, verify that
   two separate individual events are shown one for each section, just
   like in the web ui.
 * go to /calendar and load the Calendar Feed as a student, verify that
   just the one event for that section is shown
 * in both cases, there shouldn't be a separate copy of the event that
   spans both time periods, like there is on prod right now

Change-Id: I3244121ef3ff911eac043a5f69bb5944556a828a
Reviewed-on: https://gerrit.instructure.com/13394
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
spec: discussions intermittent failure
      "should edit a side comment"

Change-Id: I491e32a15ad209fff8627f844ad932846abe2b1e
Reviewed-on: https://gerrit.instructure.com/13658
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
change link and notifications blue text color, fixes #10267

The blue link text and notification page text is currently difficult to
read for some users because of the low contrast with other colors.

test-plan:
* verify link text on the discussions and dashboard are readable.
* verify blue text on the notifications page is still readable

Change-Id: I1ff16ef23d0c8cb67fc89072948d1789f273a96c
Reviewed-on: https://gerrit.instructure.com/13399
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
spec: manage_groups_students_spec intermittent fail

Change-Id: Ia5c3b50674d674ac4966542302ff611feefab90d
Reviewed-on: https://gerrit.instructure.com/13601
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
make grade_summary page use GradeCalculator

fixes #8177, #9253

this commit also improves accessibility in the grades table
by adding an aria-label to dropped assignment cells that can
be read by screen readers.

Test plan:
  * Go to the gradebook2
    - compare grades and dropped assignments to those listed on the
      grade_summary page (you can get to the grade_summary page by
      clicking on a student's name in the gradebook).  Be sure to
      compare the grades with and without including ungraded assignments
  * as a student, go to the grades page
    - try changing some scores and make sure the final grade, assignment
      group totals, and dropped assignments change accordingly.

Change-Id: I938354781e6925018bc7c3669e71dc18e2b7ab1b
Reviewed-on: https://gerrit.instructure.com/12682
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
allow setting the log level in logging.yml for syslog

test plan: Set up your logging.yml to go to syslog, with a log_level
defined (see logging.yml.example). If you're on OS X you already have
syslog running, just open Console.app and view system.log. Note though
that syslog is probably set to filter < warn or error logs.

Change-Id: I828a09329fae612d46e43fe761849a6e1336a4d3
Reviewed-on: https://gerrit.instructure.com/13623
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
expect nil folder in Attachment#set_need_notify

set_need_notify is called in a before_save. don't let it fail and
prevent the update when the attachment doesn't have a folder.

fixed #10402

test-plan:
 - perform an action that creates an attachment with no folder
   (e.g. try to download the grades csv for an assignment)
 - attempt to modify and then save the attachment (via console, or e.g.
   the ContentZipper job triggered by downloading the grades csv for an
   assignment)
 - should not raise an error

Change-Id: I04f854c0fe9b7e554e62f4ecb35b537048b60a75
Reviewed-on: https://gerrit.instructure.com/13666
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
avoid divide by zero on zero point assignments; fixes #10472

Change-Id: If4f68dfec6bb1152f1c590d329912e1b56bd4676
Reviewed-on: https://gerrit.instructure.com/13621
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
correct constraints on observer permissions

only grant observer permissions if the user is tied to the student as an
observer, and in the same course. do not grant observer permissions if
the user is tied to the student via a StudentEnrollment (how does this
tie get created?) or if the user is tied to the student as an observer
in a different course.

fixes #10508

test-plan:
 - enroll students John and Jane in course A and course B
 - set Jane as the associated_user_id on John's StudentEnrollment
   - John should not be able to read Jane's grades
 - add Bob as an observer of Jane in course A and as an observer of John
   in course B.
   - Bob should not be able to read Jane's grades in course B nor John's
     grades in course A.

Change-Id: I292e518fe9fbebeaf9e36ee0c85d97279049ae55
Reviewed-on: https://gerrit.instructure.com/13659
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
show drag/edit/delete links to screen reader users.

fixes #9278

when navigating the modules and assignments pages with
a screen reader, display the on-hover links and actions to the user.

test plan:
* using a screen reader, navigate to a course modules page and the
course assignments page;
* navigate each page and verify that the move, edit, and
delete links are read as expected.

Change-Id: Ib8a4b3770fc155169675c147f982bd508a5d1d03
Reviewed-on: https://gerrit.instructure.com/13514
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
record grader when grading via API

test plan:
 * go to gradebook2 and change a grade
 * go to /gradebook/history for the course, and view the grade change
   you just made. it should say it was you that did it

Change-Id: Ie3f91b7ceadbe99b3cccff33a957595e5d8c2cf6
Reviewed-on: https://gerrit.instructure.com/13653
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>