use correct setting key for common core outcomes

fixes #11906

test plan:
- make sure common core shows up in account outcomes for several different
  shards

Change-Id: Ife61ef56be73a43e37c6518607d337236ec61e2a
Reviewed-on: https://gerrit.instructure.com/15568
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
allow course admins access to course before start date on course

When calculating enrollment dates for admins the course
start date will be ignored. It can only be restricted by
the term dates

Test Plan:
 * Create a course and set a start date in the future
 * Check the box to restrict access to the dates
 * Save the settings.
 * Your teacher should still have access to the course

Change-Id: I25bad8d14b8eaeb3c7a823f61189078c533d3c6b
closes: #11954
Reviewed-on: https://gerrit.instructure.com/15572
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
pin mail gem for 1.8; fixes #11952

this commit in the 2.5+ versions of the mail gem breaks things in 1.8

Change-Id: I146550ecd2d1c45aedf17e55a41fc5bfd473c773
Reviewed-on: https://gerrit.instructure.com/15581
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
show past appointments in the scheduler

fixes #11105

Change-Id: I0ecd4447a250fe84cad8ff6ff672e415e59642d0
Reviewed-on: https://gerrit.instructure.com/15490
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
overflow long event titles and descriptions in calendar2.

when an event title or description had a word longer than
48 characters, it was overflowing its details pop-up. now
it clips the width of the title and adds a scroll bar.

test plan:
  * in calendar2, create an event with a title and a
    descriptionthat containing at least one word longer
    than 48 characters (e.g. a URL);
  * click on the event to open its details pop-up and verify
    that it now has a scroll bar instead of overflowing its
    parent container.
  * check an event with a smaller title and description to
    verify that it still displays w/o a scroll bar.

Change-Id: I0226d2938da59261cd9f858eb6ab2263c5e2bcb6
Reviewed-on: https://gerrit.instructure.com/15574
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
data structures for course roles engine

closes #11739

test plan: run specs (this is just infrastructure, no
functionality yet)

Change-Id: Icbe5a8db49665cede4371e023c6e37c32a1ad978
Reviewed-on: https://gerrit.instructure.com/15511
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
remove circular dependency in ajaxJSON/instructure_forms

circular requirement dependencies break qunit for some reason now
(recently started). they appear to be fine in production, but we lose
test coverage. this circular dependency was one of the worst offenders.

each defined methods that made more sense in the other, and depended on
things from the other. since only one of the methods moved actually
depended on anything from the current host, this resolves the
dependency.

most of the files that needed one or more of these three methods already
included both, so it was just a comment change in which file is
providing which method. a handful added a new require. one file dropped
a dependency (yay).

jquery.ajaxJSON no longer pulls in jquery.instructure_forms, so if
something was depending on instructure_forms implicitly through
ajaxJSON, that may be broken (and should be fixed by making the
requirement explicit).

meanwhile, take advantage of touching the zip_file_import_form partial
to extract its js into a bundle.

Change-Id: I3b85ab267748a7492662e4e3281820d749d3fe08
test-plan:
 - primarily a refactor. no new behavior, just check for regressions,
   particularly around zip_file_import_form
 - rake js:test should include most if not all javascript specs now (a
   large percentage didn't run before)
Reviewed-on: https://gerrit.instructure.com/15411
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
fix submitted assignments randomly showing as overdue

fixes #11953

This fixes a typo in sorts_assignments which got the wrong key out of
the passed hash in SortsAssignments.by_varied_due_date.

The spec has been updated as well to take a list of submissions. It
now also checks that #by_varied_due_date will raise an error if any
fields it requires are missing.

test plan:
  create an assignment with an overdue due date ( due_at < Time.now )
  create an assignment with a non-overdue due date ( due_at > Time.now )
  as a student in the course, visit the Course Asssignment page
  make sure that the overdue assignment appears under "Overdue
  Assignments"
  make sure that the non-overdue assignment is not in the "Overdue
  Assignments" section on the page.

Change-Id: I74bc99521e4675b5f4f92bfdfa7c175daa99b3aa
Reviewed-on: https://gerrit.instructure.com/15586
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
show enrollments from all shards on user details page

test plan:
 * merge together users from different shards that each have
   enrollments
 * go to the user detail page for the resulting user
 * it should show all enrollments, not just enrollments from
   the shard the user ended up on

Change-Id: I05860e5d3b729dc0fd4cf1405c55424503a04dbb
Reviewed-on: https://gerrit.instructure.com/15579
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
don't send notifications for outcome account migrations

because they're not needed

Test Plan: n/a

refs bracken's inbox

Change-Id: I0c8001c0efbabc03f531d7fa752d08624fc0fa00
Reviewed-on: https://gerrit.instructure.com/15599
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
add due_between_with_overrides scope to assignments.

refs #11753

given a start and end date, this scope returns all
assignments whose due dates (original or overridden)
fall between those dates.

test plan:
  * create an assignment with a due date and an override
    for another date;
  * in the console, run
    Assignment.due_between_with_overrides(start, stop)
    where start and stop are a range that includes the
    override's due_at but not the assignment's.
  * verify that the assignment is included in the list
    of returned assignments.

Change-Id: I10364520924e452548793d32ff2b5b3b21386506
Reviewed-on: https://gerrit.instructure.com/15313
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
include assignment override information in calendar api.

fixes #11752, #11753, #11758

this commit creates calendar events for every assignment
due date visible to the current user. this means that
students now see the due date that applies to them.

this commit also paves the way for proper override display
for teachers/admins/tas/observers.

test plan:
  * create an assignment with an overridden due date that
    applies to a student;
  * as the student, navigate to calendar and verify that
    the assignment is only displayed w/ its override date;
  * as the student's teacher, navigate to your calendar,
    view the API response, and verify that the overridden
    assignment displays once for each due date. also verify
    that the overridden assignment response has an
    "assignment_override" key.

Change-Id: I9d9ebd036425c155cb4ad7bf24f11f788b4f59f0
Reviewed-on: https://gerrit.instructure.com/15314
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
files will always count a minimum amount against quota

refs #11857

Previously a 0 byte file didn't count against quota at all, and small
files only counted their exact file size. This sets a minimum threshold
(default 512 bytes) that every file will count as when calculating quota
usage.

test plan: create a zero byte file and a < 512 byte file in a new
course. the course should show as using 1024 bytes of quota. files
larger than 512 bytes should still count their full size against quota.

Change-Id: I7b2a154bac3cecf29e737959493d387eacfab42f
Reviewed-on: https://gerrit.instructure.com/15513
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Clare Hetherington <clare@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
fix displaying job handler/last_error details for failed jobs

The change to load these details on demand didn't know how to properly
handle failed jobs.

test plan: go to /jobs as a site admin, filter by failed jobs, select
one, you should be able to view the handler and last error details.

Change-Id: Ibb7cdd768726a4952d29d3185f8e4524eae3f064
Reviewed-on: https://gerrit.instructure.com/15595
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
set max width for assignment column to 400

set the default max width to be 200

Change-Id: I8cfe3b2e9a7bd678307d32a336c96802df910e38
Reviewed-on: https://gerrit.instructure.com/15417
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
show deleted entry placeholders closes #11974

Change-Id: I767a25947ee00f26b6b967e7680ba16136342bea
Reviewed-on: https://gerrit.instructure.com/15625
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
page works for phones w/o 3d transform support

also fixed an issue where android phones would
submit the form when you clicked the "forgot
password" button

Change-Id: Ic738faf6fed003363f547b179f3d859a76e607df
Reviewed-on: https://gerrit.instructure.com/15584
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
move 'all models' code from spec_helper to ar initializer

refs #11982

test plan:
- no visible changes
- specs should still work (tables should still be truncated)

Change-Id: I426bd81cbfd1147f156600bd09e94066710cd876
Reviewed-on: https://gerrit.instructure.com/15627
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
check for name conflicts when validating Roles

refs #11739

Change-Id: I4cdca3926af368aef9ad00fd026af17f4daec525
Reviewed-on: https://gerrit.instructure.com/15634
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
update role override api for managing/creating course roles

test plan:
* specs (for now)
* (once able to check with the UI) test the api actions:
 'activate', 'add_role', 'index', 'remove_role' and 'update'
 for course roles (by setting the base_role_type argument)

closes #11743 #11744

Change-Id: I1b8d54c37cf7dc32b6898349a1b6452349dac7c0
Reviewed-on: https://gerrit.instructure.com/15590
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>