write reports to file

fixes PS-120

test plan

*reports should all still generate

Change-Id: I0a0dc8fdf298a6bd803bb52a4562a548ef727c6b
Reviewed-on: https://gerrit.instructure.com/17242
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tyler Belnap <tyler@instructure.com>
updated canvas_connect gem version to 0.0.8

latest version of gem (0.0.8) fixes the issue with the
Canvas::Plugins::AdobeConnect superclass mismatch

test steps:
- perform a bundle install
- disable all cacheing (development-local.rb)
- navigate around the app and ensure that there are no errors containing
  Canvas::Plugins::AdobeConnect in the logs.

Change-Id: I2a4d13b1ad927a4bd73db5c7ee66ac052edb5225
Reviewed-on: https://gerrit.instructure.com/17824
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
use the account time zone when copying a course

because the time zone being used in delayed jobs is UTC, no
adjustments were being made for daylight saving time

test plan:
  * find a course with assignments before daylight saving time
  * copy the course
    * make sure adjust dates is checked
    * adjust the dates to after daylight saving time starts
  * ensure that the copied assignments have the same time of
    day as the original assignments (specifically the hour)

  * extra credit: copy from during daylight saving time to
    after daylight saving time ends

fixes #CNVS-1418

Change-Id: I753decc646fe63abf9e7af029f04b7494a18394a
Reviewed-on: https://gerrit.instructure.com/17910
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
show bad UTF-8 strings on translation files

translation files (such as our recent fr.yml) can have \xNN character
strings in them. If they are invalid UTF-8 byte sequences, the
translation import (rake i18n:import) will fail without any hints
as to what the problematic string is. This fixes it.

Test Plan:
  - run rake i18n:import on a translation file that has \x81 in it
    and you should get a message with the causal string

Change-Id: I412efd1511f80d0e7e5519766a49a25dfa1639b0
Reviewed-on: https://gerrit.instructure.com/17909
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
add aria-label for screen readers on external links

test plan:
* in a screen reader, when navigating to an external
link, it should read something indicating that the
link "links to an external site".

fixes #CNVS-1885

Change-Id: I499c9179749d3ce7b2e76b5e11f465a89b53d431
Reviewed-on: https://gerrit.instructure.com/17908
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
wrap add temp_table in transaction

test plan
-using a temp table should not fail

Change-Id: Ia6d23f9f88aaa18d3676f29f558ac3e2c5d84176
Reviewed-on: https://gerrit.instructure.com/18082
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
redirect to login on submission show page

fixes CNVS-3982

test plan
- log in as someone who can view a submission
- ensure that you can view the submission
- log out
- navigate to the submission's url
- ensure that you are directed to the login page and that
  no page error occurs

Change-Id: If52a572b0323f1adc5ec3e15338df437d3f28fb4
Reviewed-on: https://gerrit.instructure.com/18048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
do not allow GB1 when course enrollments are > 250

closes #CNVS-4173

test plan:
- in rails console run:
  Setting.set('gb1_max', '0')
- start your rails server
- go to the gradebook for any course
- it should redirect to courses/*/gradebook2
  and the button to go back to gb1 should not be present

Change-Id: I5e08490f173898927f80496239d176ca0c92168b
Reviewed-on: https://gerrit.instructure.com/18068
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
add undelete option to course batch update api

fixes CNVS-4056

test plan:
 - delete some courses via the UI or API
 - use the course batch update API with event=undelete to bring
   them back

note: while you can undelete a course via its sis id, this only
works if the course was _deleted_ via sis.  if you delete a course
via the UI or API, its sis ID is cleared.  this is by design:
https://gerrit.instructure.com/#/c/3520/

Change-Id: I402dd1e0bdfc6ae639e1781f16ae5e629ca9f87a
Reviewed-on: https://gerrit.instructure.com/18062
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
update boot.rb for the newest brightbox 1.9 packages and ruby 2.0

This doesn't add full ruby 2.0 compatibility, just fixes one bootup
issue. Brightbox backported a similar gem/require change to their latest
1.9 package, this fixes the same error with that package as well.

Change-Id: If2905f1f9fa0eb145efa1caefcf005b5f991f785
Reviewed-on: https://gerrit.instructure.com/18085
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Stanley Stuart <stanley@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix having modules as course home page

Test Plan:
 * Set the course home page to be the modules page
 * It should load

closes CNVS-4201

Change-Id: Iead1fd3102cebd81d020fd3021c8059c0f68da1a
Reviewed-on: https://gerrit.instructure.com/18104
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
allow Setting.from_config files to be ERBs for test only

refs CNVS-2932

Change-Id: Ic6b025c8f78bdecdc9f1e2c31477fbe642afe278
Reviewed-on: https://gerrit.instructure.com/18101
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
strip invalid utf-8 from AR yaml columns serialized as binary by ruby 1.8

fixes CNVS-4174

Ruby 1.8 somtimes inserted invalid utf-8 into these columns using a
!binary tag, which 1.9 syck deserializes as ASCII-8BIT encoded. But then
it later blows up trying to append to a UTF-8 erb view or json output.

This adds a whitelisted set of columns for which we want to not only
strip invalid utf-8, but convert ascii encoded strings to utf-8 strings
and strip those too. These columns don't contain any binary data, so
that's an OK conversion to make.

Once Canvas only supports ruby 1.9, we shouldn't get any invalid utf-8
inserted even into serialized columns (YAML in 1.9 raises an exception
on serialization), so we won't need to keep this list up to date with
newly added columns, and we'll avoid accidentally converting a
serialized column that does contain binary data to utf-8.

test plan: rather than switching to ruby 1.8 and inserting bad data,
it'll be easier to just munge the database directly. create a
quiz_questions row with question_data that contains something like:

   question_name: !binary |
     oHRleHSg

then load the quiz in the UI using ruby 1.9. verify that you see a
question name "test" rather than a page error.

Change-Id: I8054026a06f28b1b61e05ba187bca8403a07fbb5
Reviewed-on: https://gerrit.instructure.com/18059
Reviewed-by: Paul Hinze <paulh@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix bad sql in refactored named scope

Change-Id: I6860fcb44c55e63cb84283061dd6c66582b72c8a
Reviewed-on: https://gerrit.instructure.com/18115
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
use mysql2 gem for mysql

closes CNVS-4199

Change-Id: I81a14efca365a61ff9e5d29892ec95ace64aabb3
Reviewed-on: https://gerrit.instructure.com/18089
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix migrations so they can run transactionally

refs CNVS-3902

even if the preference is that they don't

test plan:
 * bring up a fresh database
 * it should not fail

Change-Id: I5e7b2cf8479de4b3f1564ee65cd1cb456ae4674e
Reviewed-on: https://gerrit.instructure.com/17873
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
paginate and process includes for user_search api

closes CNVS-4115

test plan:
 * set up a course with lots of users that can be searched via this
   API
 * ensure limit param for user search API still works (set it really
   low), even though it's no longer documented
 * test normal pagination (per_page, multiple pages)
 * use an include[] from the list users api; ensure you get the
   expected data in the response

Change-Id: I0d2a44ce96bef5d61cdf666b3bd59c9422952f33
Reviewed-on: https://gerrit.instructure.com/18061
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
fix deliver_via_email for ruby 1.8.

fixes CNVS-4196

Timeout::Error doesn't inherit from StandardError in
< 1.9, causing some exceptions to not be properly handled
in deliver_via_email.

test plan:
  * run spec/lib/message_dispatcher_spec.rb with ruby 1.8
    and verify that specs pass.

Change-Id: I233c62a5960e27804ef37f529512bb39b8746239
Reviewed-on: https://gerrit.instructure.com/18079
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Eric Berry <ericb@instructure.com>
specs: always reset the i18n locale to :en

fixes a race condition issue where some tests were being set to the
wrong locale.

test plan:
  - specs pass
  - make a spec that changes the global locale (there are several
    already that exist it seems). Run that spec, then run another spec
    asserting that the locale is "en" again, rather than the locale you
    set.

Change-Id: I3f925f1b59e7d8c975398429824432ab9c94ef86
Reviewed-on: https://gerrit.instructure.com/18153
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
specs: fix student submission selenium specs

Fixes an issue where selenium wasn't waiting long enough for the flash
object to load, which was not letting the jquery modal dialog close for
unknown reasons.

Tried closing the dialog using jquery clicks, but failures were just as
sporadic with the old 0.5 timeout.

test plan:
  - specs pass
  - celebrate!

Change-Id: Ic0caee02c9ef68bc96b676215eb5ebe8e7440ae3
Reviewed-on: https://gerrit.instructure.com/18152
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Shawn Meredith <shawn@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>