api: don't call empty on possible nils

Fixes a bug where sending nil assignment overrides through the api would
throw an error because nil doesn't respond to the method "empty?". The
code before was checking for the presence of an empty string, and blank?
works for both empty strings and nil via active_support's core object
extensions.

test plan:
  - specs should pass
  - Create an override through the api that has the key "due_at" but a
    null value. You should not get server errors.
  - Request the same override through the api. You should not get server
    errors.

Change-Id: I5792d96e307a9c563d751fbe21cef6178cb350e0
Reviewed-on: https://gerrit.instructure.com/17348
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Erik Lyngved <erik@12spokes.com>
QA-Review: Myller de Araujo <myller@instructure.com>
create messages from DelayedMessage.summarize on the user's shard

fixes CNVS-1714

test plan:
 * do an action that goes through DelayedMessage.summarize
   (I think just means setting some notifications to every 5 minutes
    or something)
 * wait the five minutes
 * the message(s) should show up in /users/x/messages

Change-Id: Ibcc646f9ec869543b8ba84c1d7c7f8171ce55d78
Reviewed-on: https://gerrit.instructure.com/17166
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
1.9: fix our multipart form building to work with StringIO objects again

In 1.8 StringIO#path returns nil, but in 1.9 the method doesn't exist,
so building multipart forms was failing.

lib/multipart.rb could use some larger refactoring but I'm limiting the
scope of this change since it's getting race tracked.

fixes CNVS-3562

test plan: With an environment running ruby 1.9, do a course copy with a
course that includes at least 1 video. The copy should succeed and the
video should work in the new course, as expected.

Change-Id: Ib8a9f1559c639831977f0118874735891b98d02f
Reviewed-on: https://gerrit.instructure.com/17407
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
this migration is non-transactional in dev

Change-Id: I1698e157f1dbcfdc44c5d66bbff6489e6b7c4476
Reviewed-on: https://gerrit.instructure.com/17419
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
change sections' root_account_id when the course changes

test plan:
 * move a course to a different root account
 * check the database - the section's root_account_id should have
   changed as well

Change-Id: I75647cc2c920af1b3f5e28ca8df30d32afa704a1
Reviewed-on: https://gerrit.instructure.com/17406
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
fix the remove multiple root folders data fixup

fixes a problem with the data fixup with creating a
new root folder, and with the spec where the spec
wasn't actually checking what it was meant to check

Change-Id: Iafd12f669c0cbfd12eebf6a2d9dc399e60c368eb
Reviewed-on: https://gerrit.instructure.com/17409
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
only set association in one direction

refs CNVS-2651

makes it so 1. we don't need to clear the errors and 2. it doesn't get
auto-saved along with the context if has been accessed (e.g. in g/17020,
we check Context#profile in an after_save, which makes it want to save it
if we try to save the course a second time)

test plan:
* https://gerrit.instructure.com/17020

Change-Id: I182da6c39d50bde03bbbbab9fef57826a919f462
Reviewed-on: https://gerrit.instructure.com/17426
Reviewed-by: Joe Tanner <joe@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
fix merge_candidates to search the correct shard

refs CNVS-3559

test plan:
 * create a user on the default shard (and confirm the e-mail address)
 * on another shard, invite that same e-mail address to a course
 * it should *not* show the user from the default shard

Change-Id: I897c55f8eaac832cbf655e0348189db4dc7a0a5e
Reviewed-on: https://gerrit.instructure.com/17414
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
spec: file specs refactor

Change-Id: I6bd5b1f695c115efba4c39f5ff4868d7ab000ad1
Reviewed-on: https://gerrit.instructure.com/17367
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
fix for a ruby 1.9 warning message

Backported from ruby 2.0 (and possibly later 1.9 patchlevels) because it
was filling our logs with many millions of warnings. The code was
backported directly, the test was backported with conversion from
minitest -> rspec.

test plan: Delayed jobs that use ruby's net libraries should still work,
such as sending messages, taking web snapshots, etc. You shouldn't see
any further lines like this in the log:

net/protocol.rb:313: warning: regexp match /.../n against to UTF-8 string

Change-Id: Ic29daa4ee9f0587fb2a1ac2968cd08a2f68365a1
Reviewed-on: https://gerrit.instructure.com/17431
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
upgrade rails to 2.3.16

The html_escape changes were backported from rails 3 in 2.3.16, so I've
removed our modified version.

Change-Id: I0067b9d84e49459dd7d46ba53a1d597d2e0efb67
Reviewed-on: https://gerrit.instructure.com/17379
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
reconnect to redis in the job worker after forking

If the parent pool process uses redis, then the child after forking will
end up sharing the connection, so a reconnect is necessary.

Change-Id: I29f3fd3adafca504cf0805548bca9ba6b30d5318
Reviewed-on: https://gerrit.instructure.com/17456
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
don't error on course export if the course name is too long

test plan:
* make a course with a name as long as you can
(255 characters)
* confirm that you can export it successfully

fixes #CNVS-3549

Change-Id: I34dc93ba4578bf67b7155138beee231adeb5d4ef
Reviewed-on: https://gerrit.instructure.com/17376
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
more explicit select for sis exporter users.csv

refs CNVS-3607

test plan
- report should still work

Change-Id: Ic0ff43b551aeb6937da7d3fab8576017ba3e4a7b
Reviewed-on: https://gerrit.instructure.com/17451
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tyler Belnap <tyler@instructure.com>
don't load root folder files into the collaborations

fixes a problem where having a collaboration causes root
folder files to load themselves into the collaborations
folder on the files page

test plan:
* upload a file into the root folder for a course
* create a collaboration
* visit the files page
* file should show up in the root folder,
 not the collaborations folder

fixes #CNVS-3584

Change-Id: Ib94e18b8149a223e9644ce4546eeb67b3418dad4
Reviewed-on: https://gerrit.instructure.com/17425
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
make sure there is a space between the last update and the WHERE

test plan:
1. run migrations in mysql
2. they should not asplode

Change-Id: I34f564141c99f174311bb4c974630b7594e2096e
Reviewed-on: https://gerrit.instructure.com/17465
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Don't mark MediaTracksController as an API

Further API infrastructure needs to be done to support API methods that
don't require a logged-in user or auth token, so these aren't actual
APIs yet.

Change-Id: I6080a1c37e3554ac1285b431e275812ebf4f96eb
Reviewed-on: https://gerrit.instructure.com/17479
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
added @optionProperty to View.coffee

also, quit pulling backbone off window

test plan:
- existing `template` spec covers this

Change-Id: I42916bed9791ca3deae9259eff62afd8fcd1949c
Reviewed-on: https://gerrit.instructure.com/17475
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
added CollectionView

test plan:
- see specs

Change-Id: Id31eb15c0a9215ec00c8b805afd35cf74128cfe5
Reviewed-on: https://gerrit.instructure.com/17476
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
fix subtitle menu typos

Oh the shame.

Test Plan:
 * Read the CC dialog. It should not say silly things.

refs #CNVS-324

Change-Id: If990410a43f5d3cd91244602e46c998fc4c0a1ee
Reviewed-on: https://gerrit.instructure.com/17488
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Matt Goodwin <mattg@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>