timeout cutycapt processes that take too long; closes #7568

Also includes some cleanup around cutycapt configuration and specs.

test plan:
 This is a little tricky to test since a real test relies on getting a
 cutycapt process to hang. However, you can fake it by configuring
 cuty so that timeout < delay. Then it will always time out.
 * Make sure you have cuty capt installed and configured (cutycapt.yml)
 * In the yml, set delay = 3000 and timeout = 2000
 * Start delayed jobs
 * Create an assignment that allows a URL submission
 * Submit that assignment as a student with a URL
 * Verify that the job that gets created starts up cutycapt but fails with
   a timeout (see your logs)

Change-Id: I5cae17fd64d1318ea0f4a9c92bb0a281ddd898e5
Reviewed-on: https://gerrit.instructure.com/9248
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
update observers when merging users fixes #7678

test plan:
 * enable open registration
 * create a user account with login != e-mail address
 * add that user as a student to a course, using the e-mail address,
   but don't confirm it yet
 * add observer to a course; link to the student
 * confirm the student, using their existing account
 * log in as the observer; you should be able to view the grades page

Change-Id: I71f5470e6600ffa0cfcdada83c75ecce96e3511f
Reviewed-on: https://gerrit.instructure.com/9326
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
model and api work for threaded discussions, refs #7567

Adds support for threaded discussions. The existing API has been updated
to allow posting replies to replies, and returns the whole thread of
sub-replies rather than just first-level side comments. For backwards
compatbility, the sub-replies are returned in a flattened newest-first,
consumers can look at the parent id of each entry to re-build the
nested, threaded structure.

Another commit will add a new API endpoint for retriving the threaded
structure of the conversation in a more efficient and natural format.

test plan: there's no UI for threaded discussions yet, but you can use
the API to post replies to replies, and retrieve threads and verify the
parent_id information.

Change-Id: I7d541d093fbbdb6fc8a18d079b4337515c02a8a4
Reviewed-on: https://gerrit.instructure.com/9121
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
wait until direct-to-s3 upload is complete before sending to kaltura

fixes #7485

test plan:
 * upload a media file without s3 enabled; it should process through
   kaltura
 * upload a media with s3 enabled; it should also process through
   kaltura

Change-Id: I8897e9558204dc6f3b53cb7c6765289595b84ff7
Reviewed-on: https://gerrit.instructure.com/9306
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
test student notifications when teacher deletes time slot

refs #7056

Test plan:
- this bug didn't actually exist, but there were no tests for this case
  so this adds one

Change-Id: I0f0e6756fc17f8de4a5c5efce9d94f2e254e4f23
Reviewed-on: https://gerrit.instructure.com/9337
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
add option for completed courses on course import. fixes #2184

affects: /courses/:course_id/imports/copy

now provide an "include completed courses?" checkbox that allows
user to also list concluded courses that he/she has permissions
to.

load course dropdown via ajax call, and cache both results for the
select box and the course search autocomplete.

test plan:
  * create two courses;
  * create a user and enroll them as a teacher in both courses (user
    should not be an admin);
  * conclude one of the courses;
  * go to the course copy page of the unconcluded course;
  * verify that the concluded course is not in the dropdown and cannot
    be searched for;
  * check the 'include completed courses?' checkbox;
  * verify that the concluded course now appears in the dropdown and
    can be searched for.

  * create a course in a different term and set the same user as
    teacher;
  * set enrollment start dates for each term;
  * view the copy course page and verify that the terms are ordered
    by start date DESC.

  * create a course in a different account in a term that shares the
    same name as the term in the original account;
  * view the copy course page and verify that the account name is
    appended to the term name in the dropdown menu.

Change-Id: I0af2907e130ae1e0ce6048cac4743234fd0e1fd6
Reviewed-on: https://gerrit.instructure.com/8943
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
discussion topics materialized view api, refs #7567

This is a specialized, optimized view of the entire discussion,
including a nested view on all the entries and participants, and the
current user's unread entry list.

An upcoming commit will cache these views to the database, and generate
them asynchronously, rather than in-request.

test plan: No UI yet. GET /api/v1/courses/X/discussion_topics/Y/view ,
and verify the formatting of the response, including the nesting of
arbitrarily nested discussion entires (also only creatable via the api,
right now). verify that deleted entries are returned, but without a
user_id or summary and with a deleted flag.

Change-Id: Ib7332743f92cca40cc2a861973bf492b1f294a02
fix timezone/dst specs

test plan:
run specs

Change-Id: I6a9d15be2856ebd622fc9580b2097435fa331200
Reviewed-on: https://gerrit.instructure.com/9351
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jon Jensen <jon@instructure.com>
discussions wip

Change-Id: Ibcf0489e94786c708b6c83e4e7cd8196e60614d8
discussion entry_list api, refs #7567

allows retrieving a set of discussion entries with their full bodies.
deleted entries are returned with only skeleton information.

test plan: no UI. make a request to the endpoint, verify you can request
multiple entries, and that they are paginated.

Change-Id: Ifc677da538825d6eacca922cbecf5267881063b7
update/delete discussion entry apis, refs #7567

test plan: no UI yet. update an entry, verify it gets the new message
(and updated at time). delete an entry, verify it's deleted. attempt
both as a user without permission on that entry, verify you get a 401
and the content doesn't change. also update/delete a student's entry as
a teacher.

Change-Id: I8433aa78e70b3c0597e76de1b8e1634c9f0dd27b