don't try to call a private method from a job

fixes #CNVS-2952

test plan:
- in a production environment, change an assignment date
- it should work

Change-Id: Ief63c9f69bd33ca8f998bac4ecc487f82e105e7b
Reviewed-on: https://gerrit.instructure.com/16806
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
limit query of CrocodocDocument for status checking

looks like crocodoc has some limits on how many document statuses you can check
in one api call.  so we need to limit how many records are pulled out of the db
at a time, and then how many we send to crocodoc at a time.

fixes #CNVS-2924

test plan:
- make sure crocodoc documents are still working

Change-Id: I6dea005be4d2268986f88040574cc586e8cc6084
Reviewed-on: https://gerrit.instructure.com/16771
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
parallelized gem update for plugins and 1.9.3

Change-Id: If0da7773cf15f825db2b1ba49d945ec1cd27953a
Reviewed-on: https://gerrit.instructure.com/16825
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
add parameter checker to account_report

this is just a convenience method to not require 
a parameter to run a report

Change-Id: I316af8cc755b39d273d69f378eb9ce7ffff2625b
Reviewed-on: https://gerrit.instructure.com/16782
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
don't promise features that aren't planned in the (near) future

Change-Id: I3e6da197ee2ae2f1fd5d95a31a29cf0b6f0f478e
Reviewed-on: https://gerrit.instructure.com/16846
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
change how we build this error string

It's possible for an exception to have a nil message, in which case this
job worker process would die trying to do nil + "\n".

Change-Id: I7d6b4cb58fb47711e77ffc877b17f9248c401238
Reviewed-on: https://gerrit.instructure.com/16830
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
QA-Review: Brian Palmer <brianp@instructure.com>
return null in $.toJSON for empty datepicker elements

Changes the behavior of $.toJSON to return null for datepicker elements
that have a blank 'date' data field (e.g. empty input boxes).
Previously, $.toJSON did not include the form element key/value because
$.extend does not include undefined properties. If someone were to
change a datepicker field's data 'date', the change would not be
reflected when someone called $.toJSON on the form element because
calling $(formElement).data( 'date' ) would return undefined, so the
consumer of $.toJSON would have to do some manual checking for the
missing input field's key.

Convenience!

test plan:
  - specs pass

Change-Id: I92c78e537bc08f216899c02817f66afabfb8583a
Reviewed-on: https://gerrit.instructure.com/16854
QA-Review: Stanley Stuart <stanley+gerrit@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
show sub accounts tab in site admin

they can be useful for organizing admins

test plan:
 * go to site admin
 * there should be a sub accounts tab

Change-Id: I89921e1d8973d3fcc4e5bb01d6115b99d92b6340
Reviewed-on: https://gerrit.instructure.com/16818
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
don't let users message the whole course if they can't send_messages

fixes #CNVS-2611

also fix broken account user permission check (an account user could view
all users in a course, regardless of permissions). simplify logic in
enrollment_visibility_level_for

test plan:
1. as a student, confirm you can message the whole course
2. under account permissions, revoke "Send messages to course members"
   from students
3. as a student, confirm you can only message admins in the course

Change-Id: I29d73c68b8d93c54616a515c699818025b4bb839
Reviewed-on: https://gerrit.instructure.com/16581
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
use @migrations_path when finding files for migrations

this fix is helpful for running specs outside of the current directory
(that's how my emacs plugin works and why I found the bug)

Change-Id: I9eaebcb279da236b4ec549f67bd322031cf9e4fd
Reviewed-on: https://gerrit.instructure.com/16530
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Joe Tanner <joe@instructure.com>
mute assignments through the api

test plan:

 * create an assignment using the muted flag = true. It should be muted
 * update this assignment using the muted flag = false. It should not be muted
 * update this assignment without using the muted flag. It should not be muted

 * create an assignment using the muted flag = false. It should not be muted
 * update this assignment using the muted flag = true. It should be muted.
 * update this assignment without using the muted flag. It should be muted.

Change-Id: I07d1a83dc3cbbcb203ba4454f5d888b453898d7f
Reviewed-on: https://gerrit.instructure.com/16790
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
vdd: fix override behavior for guests

Fixes #CNVS-2017

Notes:
* Previously, code assumed a user would always be present,
  but this is not so for public courses with anonymous users
* Handles nil user cases in DatesOverridable and
  AssignmentOverrideApplicator

Test plan:
1. Create a public course.
2. Create an assignment with a default due date
   and one or more overrides.
3. View the assignment as a guest. The default due
   date should be displayed.

Change-Id: I5e4907dd52636816c6dccabc3acdbb138c638f27
Reviewed-on: https://gerrit.instructure.com/16817
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
authorize users to view files on remote shards

fixes #CNVS-2733

files_Controller was using "new" instead of "build"
on the attachments association for the user
to check rights.  Switching to build allowed
it to know which shard to look at.

TEST PLAN:
1) Login as a user (not a site admin, regular user)
 on a cluster remote from that
user's home cluster.

2) Click on the "settings" menu, top right corner.

3) Try to view your files tab.

4) you should not be prevented from viewing
your files due to an authorization error.

Change-Id: I8498084feb23e8de4b1301a0c8faf5d39f059295
Reviewed-on: https://gerrit.instructure.com/16841
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
spec: fix a reload issue with plugins

Change-Id: Ic2cd13d34489ba22ee9e52909b3bdf1eeabfb95e
Reviewed-on: https://gerrit.instructure.com/16871
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
QA-Review: Cody Cutrer <cody@instructure.com>
pass the worker to unlock_orphaned_jobs as well

This can be useful for code hooks

test plan: no behavior change. jobs should still run as before.

Change-Id: I5016a8111ab2382811adb273148f2c72e9f50b24
Reviewed-on: https://gerrit.instructure.com/16884
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
added api to change a couple course settings

- allow_student_discussion_topics
- allow_student_forum_attachments

test plan:
- get /api/v1/courses/:course_id/settings, should
  get a json response with the two settings
- put /api/v1/courses/:course_id/settings with
  key:bool in the params and it should save

Change-Id: I36697fc9d071d17131fbfaa04a77082fa52a83cd
Reviewed-on: https://gerrit.instructure.com/16843
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
keep columns regular on course settings users tab

test plan:

* add lots of users to a particular category,
 enough to trigger pagination
* then on the course settings users tab,
 scroll all the way down (to get the
 "loading more results" message)
* the column should not expand and
 push the other column

Change-Id: Ib67341c54a92f1f0dd063ec68bfc85f53c884cb3
Reviewed-on: https://gerrit.instructure.com/16285
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
gracefully handle invalid files on course copy

add a warning to the content migration instead of error out
when encountering a problem copying a file in the course
copy process.

test plan:
* try to copy a course that has an invalid file
(note: this might be difficult if not impossible to
set up through the UI... the easiest way
seems to be to run the following in the console:
  Attachment.update_all({:filename => nil},
  {:id => (-INSERT ATTACHMENT ID HERE-)})

fixes #CNVS-2169

Change-Id: Ie3cd11998f4a81ce8d79a756a8a65a31ec19bad3
Reviewed-on: https://gerrit.instructure.com/16705
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
link quizzes to assignments using assignment_migration_id

fixes a problem with certain D2L imports, where quizzes
had an attribute "assignment_migration_id" that wasn't being
used to actually find the assignment

test plan:
* import the example D2L import file
* the assignments in the group "Quizzes" should now
 be linked to the quizzes

closes #CNVS-1212

Change-Id: I7b5981ee5c88cee8a95ecc850e56cd9df7d6334e
Reviewed-on: https://gerrit.instructure.com/16600
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
don't show hidden/locked files/folders to students in wiki sidebar

checks for locked/hidden status for the files and images tabs
on the wiki sidebar and doesn't show them to students

test plan:
* create a folder
 * lock it
 * or hide it
 * or disable the files navigation tab
* should not see the folder on sidebar as a student

* create a text file
 * lock it
 * or hide it
* should not see the file on sidebar as a student

* create an image file
 * lock it
 * or hide it
 * or disable the files navigation tab
* should not see the file in the images tab as a student

fixes #CNVS-2

Change-Id: I8d17a3c9b19d275a242c74a593736b17905e5ba9
Reviewed-on: https://gerrit.instructure.com/16511
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>