additional partner data on kaltura upload

--test plan
upload or record file via tinyMCE media widget
additional partner_data should be available on kaltura
should include sis_course_id, sis_user_id where applicable
and also a context_source including where media uploaded from
fixes PS-321

Change-Id: Id32a0c72ef93e41991e8ee8b6234d36d5c02893a
Reviewed-on: https://gerrit.instructure.com/22607
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Brandon Broschinsky <brandonbr@instructure.com>
conversations: course filter

fixes CNVS-6402

test plan:
  * open conversations beta page
  * choose options from course and scope dropdowns
  * verify that the messages are constrained by their intersection
  * verify that changing your filters updates your URL
  * verify that refreshing/bookmarking/sharing URLS keeps state
  * verify that the course filter includes non-favorite courses
  * verify that you can filter the message list by a non-favorite course
  * verify that the "More Courses" list excludes favorite courses
  * verify that the current course filter display at the top of the
    messages list is updated with the current course name and code
  * verify that the current course filter display is present but empty
    if "All Courses" is selected
  * verify that the styling matches the spec, aside from
      different optgroup formatting

Change-Id: Ie3215096ac2410b77be81e2f9dad44ea1ac0d98e
Reviewed-on: https://gerrit.instructure.com/22675
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
fix pages api to not return the body of a locked page

test plan:
 - as a student
 * query the pages api for a page that is currently locked
 * ensure the response payload does not include the page body

fixes CNVS-7211

Change-Id: I2a073e9d8a3703b63ff3492cddcef893043c1380
Reviewed-on: https://gerrit.instructure.com/22737
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
add root account setting for custom terms/privacy

fixes CNVS-6888

testing steps:
* from a console, set a custom privacy and terms url
  Setting.set('privacy_policy_url', 'http://custom.example.com/privacy')
  Setting.set('terms_of_use_url', 'http://custom.example.com/terms')
* verify the following location all display the new links:
  * <canvas>/enroll/<join_code> - with self_enrollments enabled for
    the course and currently logged out
    * when self registration is disabled at the root account,
      will be prompted to authenticate, "View Privacy Policy"
    * when self registration is enabled at the root account,
      will be prompted to authenticate or register, "View Privacy Policy"
    * when logged in as a teacher, prompted to confirm enrollment
      "View Privacy Policy"
  * <canvas>/register_from_website  - when logged out
    * page footer links for "Terms of Use" and "Privacy Policy"
    * "I'm a teacher", both links at bottom of dialog
    * "I'm a student", both links at bottom of dialog
    * "Parents sign up here", both links at bottom of dialog
  * <canvas>/accounts/<id>/users - click "Add a New User" from
    the right sidebar. "View Privacy Policy" in modal dialog.

Change-Id: Ic80c369dcea8483c93fb8adfcd9a80c1d6d3ad6a
Reviewed-on: https://gerrit.instructure.com/22712
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
apply group conditions after sharding applied

fixes CNVS-7183

test steps ensure CNVS-6975 works correctly

testing notes:
- create a user that is a member of an account level group and a
  course level group
- using the api (api/v1/users/self/groups), ensure that all groups
  are returned
- ensure that only the account level group is returned when the
  context_type parameter is set to 'Account'
- ensure that only the course level group is returned when the
  context_type parameter is set to 'Course'
- ensure that the user's group index page works as it did before

Change-Id: I782e90eb629e272ed2ed5c868e18713735857bb4
Reviewed-on: https://gerrit.instructure.com/22799
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
switch to rails lts for continuing rails 2.3 support

closes CNVS-7093

the changelog from rails 2.3.18 is at https://github.com/makandra/rails/commits/2-3-lts
so far it's mostly packaging changes, with explict config options to opt
out of some stuff like enable_xml_parsing

test plan:
* without RAILS_LTS file, specs should pass, general regression testing
* ditto with RAILS_LTS file pointing at the private gem repo (ask for
  creds, we aren't allowed to share them publicly)

Change-Id: I3526c57ce5769dd73c84ffe8055fa084874b2bd5
Reviewed-on: https://gerrit.instructure.com/21654
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
statsd: escape "." to avoid creating graphite folders

The redis_name is usually a fqdn, which was creating very annoying
folder structures

Change-Id: If8aecd3a523673321406fedc8769a92eee6d1a78
Reviewed-on: https://gerrit.instructure.com/22744
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
fix day_substitutions setting for content migration forms

test plan:
* run a content migration, checking the box to
 "adjust events and due dates" and adding day
 substitutions
* confirm that the day substitutions work

fixes #CNVS-7230

Change-Id: If07cc577f0619de7e277550592b275ec96ea96d9
Reviewed-on: https://gerrit.instructure.com/22817
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
enable a borderless LTI launch without canvas navigation

Test Plan
  * create a tool
  * launch it using '/courses/:course_id/external_tools/retrieve?url=:launch_url&borderless=1
  * The tool should launch without any canvas navigation

Change-Id: I69c48d35876594f72f5b7f96f5013c72b13fe551
Reviewed-on: https://gerrit.instructure.com/22736
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
ensure @domain_root_account is set on error pages

refs CNVS-6888

testing notes:
* on a 404 or 500 page, the terms/privacy links
  should still show in the footer

Change-Id: Ia47ccccc4f7b8d7f7912c278a26a34f3b79eedc0
Reviewed-on: https://gerrit.instructure.com/22844
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Mark Ericksen <marke@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Mark Ericksen <marke@instructure.com>
quick sinon-patch tweak to fix cascading request processing

fixes failing specs in RandomlyAssignUsersViewSpec

also comments out some failing specs in TopicSpec
  and admin settings spec

also fixes the 404 spec error

Change-Id: I3de289c9731bced52c227c92c28ae61ba4981085
Reviewed-on: https://gerrit.instructure.com/22839
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
pre-populate start/end dates in new migration UI if possible

If the new or old course has start/end dates, they will be
pre-populated in the date shift form

Test Plan:
 * with a course that has start/end dates and with one that doesn't:
   * go to migration page
   * view date shift forms for any type; there should dates or no dates as expected for the course, and no error
   * for a course copy type, choose courses with/without start/end dates
   * the date shift fields should populate/clear as appropriate

closes CNVS-7241

Change-Id: I0f427da5962c945314fd5efd19f543adec8cbb3a
Reviewed-on: https://gerrit.instructure.com/22815
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
return associated item details in module items api

test plan:
* refer to the Module and Module Item API documentation
* confirm that adding the include[]=content_details argument
 to any index or show request that returns module items,
 will add a "course_details" section to each of the returned
 module items, which includes additional details (if available)
 for their associated objects
(i.e. an Assignment module item can return the
'points_possible', 'due_at', 'lock_at', and 'unlock_at'
information for the assignment, after appropriate overrides
are applied)

closes #CNVS-7023

Change-Id: I3879d1ea4078f6da6aae41f941362da35558a650
Reviewed-on: https://gerrit.instructure.com/22705
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
separate announcements from discussion topics in import/export

test plan:
* create a course with announcements
* for both:
 - exporting and re-importing, and
 - course copying

 with the "select content" box checked, confirm that:

 - the selective content form lists the announcements to
 import under "Announcements" and not "Discussion Topics"
 - the selected announcements are actually imported as
 expected

fixes #CNVS-7242

Change-Id: I647544232dd1d88305db2bc558e20df0716d3c30
Reviewed-on: https://gerrit.instructure.com/22823
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
add note in api documentation about 64 bit ids

closes CNVS-7220

test plan
- should have "All ids in canvas are 64 bit integers"

Change-Id: I45ed55f85233c48aee38194695fc04c6e73ab623
Reviewed-on: https://gerrit.instructure.com/22803
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix question count for unpublished quizzes on quizzes#index page

fixes CNVS-7250

Test plan
- create an unpublished quiz with some questions
- the unpublished quiz should show the correct question count on the index page

Change-Id: Ia4d3760d3d2d0bca186591f2245da2be20f31f0a
Reviewed-on: https://gerrit.instructure.com/22834
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
fix uniqueness validation of login ids

fixes CNVS-7266

test plan:
 * create an SIS user with a login id, then delete them
 * create a non-SIS user with the same login id
 * use an SIS import to resurrect the original user
 * the SIS import should succeed, but warn that it skipped the user
   cause someone else had his login information

Change-Id: I2102107fefb1d20fae6046ebe3a7e0c03416dcc9
Reviewed-on: https://gerrit.instructure.com/22867
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: fix participating_user_id sort in conversations_api_spec

Change-Id: I3ab1e733b75bd5055dd7d0914a0e7f967a4fecda
Reviewed-on: https://gerrit.instructure.com/22870
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
QA-Review: Joel Hough <joel@instructure.com>
change default terms and privacy policy urls

test plan: n/a

Change-Id: I5d4b0afa0cf9e316d516774ec9bf88f467538286
Reviewed-on: https://gerrit.instructure.com/22830
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
require reacceptance of terms when they change

fixes CNVS-6889

test plan:
1.  log in to canvas
2.  you should not have to agree to the terms
3.  in a rails console, do
    Setting.set 'terms_required', true
    a = Account.default
    a.settings[:terms_changed_at] = Time.now.utc
    a.save!
4.  reload the page
5.  you should still not have to agree to the terms
6.  log out and back in
7.  you should be prompted to accept the terms
8.  try to go to another url, e.g. /conversations
9.  you should still be prompted to accept the terms
10. go ahead and agree to the terms
11. you should be able to use canvas as usual
12. log out and back in
13. you should still be able to use canvas as usual

Change-Id: Id9f0995f6da3aa3b73b226d0e0a2e339994502df
Reviewed-on: https://gerrit.instructure.com/22727
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>