Merge branch 'dev/timezunami' into master

test-plan:
 - regression on assignment due dates in:
   - matching profile/browser timezone
   - non-matching-but-dst-consistent profile/browser timezone
   - dst-inconsistent profile/browser timezone (e.g. Mountain vs.
     Arizona) with due date on far side of DST boundary

Change-Id: I3aa6b5f0e70c140394937db5f4a1afb1a25cacc1
fix the reply link on the site-admin /messages page

explicitly specify the charset on the content-type header so the
mail gem doesn't do something stupid like assigning an Encoding
object to the charset String.

fixes CNVS-11566

test plan:
 - send a conversation message from user A to user B.
 - open /messages for user B.
 - reply to the notification email via the reply link.
 - the conversation should be updated with the new message.

Change-Id: I7ac3d2f9cb5cd1a14fbccc2b4905a6d36e75df42
Reviewed-on: https://gerrit.instructure.com/32321
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
Merge branch 'dev/timezunami' into master

test-plan:
  full regression of dates and times

Change-Id: Ic89b0d06f6675a194e5305f70dfa70df82b3f1b9
fix Multipart::Post Content-type header

This reverts commit e3148346df900ac4e38a9ad643266dde26fe7515
This reverts commit 16f518a1305fac6c031f3bc8ca2b2d012d952e61
This partially reverts 9d34baed66b7856205230992e72d05db58e9e186

fixes CNVS-12021

test plan (e3148346df900ac4e38a9ad643266dde26fe7515)
 - rails 3 specs should pass
test plan (9d34baed66b7856205230992e72d05db58e9e186)
 - import content including a video file into a course
      (such as the QTI file attached to CNVS-11602)
 - the import should complete
test plan (16f518a1305fac6c031f3bc8ca2b2d012d952e61)
 - submit a document to turnitin
 - it should successfully receive a score

Change-Id: I0622d9eceee4b94e488f103db68290f1b641b555
Reviewed-on: https://gerrit.instructure.com/32333
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
limit question group points to a scale of 2

fixes CNVS-11641
Quiz questions are limited to a scale of 2 in the UI (numbers after the
decimal). Question groups allowed more scale, they have now been limited
to 2 as well.

- As a teacher, create a quiz
- Create a question group, and attempt to add a point total of 2.12345
- It should round to 2.12
- Create a question group, and attempt to add a point total of 2.34999
- It should round to 2.35

Change-Id: Ic3e54b3e62bd7b99f51002cb14bf4854d650023a
Reviewed-on: https://gerrit.instructure.com/32332
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
use the draft state sequence footer for files, tools, links

test plan:
 - create a course with each type of module item
   (assignment, quiz, file, page, discussion, external url,
    and external tool)
   (and put the file into the sequence in two places)
 - with draft state off, ensure the old module item sequence footer
   appears and works properly for each item
 - with draft state on, ensure the new module item sequence footer
   appears and works properly for each item
   - and the old footer does not temporarily appear first
   - and the file shows the correct sequence each place it's used

fixes CNVS-11809
fixes CNVS-11978
fixes CNVS-11977

Change-Id: I52f07a8026cb6697aac24bc4027f6bf696a87239
Reviewed-on: https://gerrit.instructure.com/32352
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
allow dragging undated assignments to calendar2

fixes CNVS-6174

test plan:
 - create an undated assignment.
 - go to calendar2 and drag undated assignments onto the month
   view of the calendar.
 - the assignment's due date should be set to 11:59pm on
   that day.
 - also test this with undated assignment overrides.
 - you should also be able to drag undated assignments to the
   mini-calendar.
 - you should *not* be able to drag dated or undated assignments
   to the all day section of week view (we could make this
   work, but the behavior is confusing).

Change-Id: Ie3f82ea4d03b33879c5deeed2d977e25a790fe32
Reviewed-on: https://gerrit.instructure.com/32310
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
disable auto-submissions of quizzes in background until we can do more
regression testing with due dates and lock dates

fixes CNVS-12048

test plan:
  - Create a quiz with a time-limit (1 minute will do)
  - As a student, start taking the quiz
  - only answer a few questions and then close the window
  - the quiz should not be auto-submitted in the background anymore

Change-Id: Ib91286466dc83aa2ad66d7206449a0956d8c0fe8
Reviewed-on: https://gerrit.instructure.com/32430
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
add a kaltura plugin option to hide RTE record icon

As an intermediate step to making the canvas video integration
more extensible, this allows the video button to be hidden
in the RTE but not in the other areas that you can record
video in: conversations, SpeedGrader, Media Recordings homework
submissions.

Test Plan:
 * Enable the kaltura plugin option to "Hide the video icon in the RTE"
 * The video icon should not show up in any RTE
 * Video recording should still work in conversations, SpeedGrader,
   and as homework submissions. (but not in "text" homework submissions)

closes CNVS-12040

Change-Id: Ib2599e2248d9931df006da8ec1deec85eb050751
Reviewed-on: https://gerrit.instructure.com/32010
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
add an alternate video recording widget for testing

We fixed some problems in the video recording widget that
we want to test in a real production environment. So the
updated widget is behind a flag in the plugin settings

Test Plan:
 * Enable the "Use alternative flash recording widget"
   checkbox under kaltura plugin settings
 * You can tell it's the new widget if when it loads, and
   you have 2 cameras, it'll present with an option to choose

closes CNVS-12037

Change-Id: Iaf360874c5c3078ae421dfce1977579fedf1f19c
Reviewed-on: https://gerrit.instructure.com/32417
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Improved context for the unread and total replies numbers on discussions page

Fixes CNVS-11989

Test Plan:
* Visit the page that shows the list of discussion topics.
* Validate that the unread reply and total reply counts are read with context
  when using a screen reader.

Change-Id: Ib3ea7abc79a1a63c2f1d1d7e0c09049b20f6df6c
Reviewed-on: https://gerrit.instructure.com/32244
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Aaron Cannon <acannon@instructure.com>
partition Gemfile

this is a proof-of-concept to see if partitioning
our Gemfile helps more than it hurts. It's modeled
after the way the Squash team handles its dependencies

this doesn't implement any of the particularly nice
things that can be found in the Squash set up, such
as conditionally loading gems based on the contents
of our configuration files (we can already sort of
do this with groups in bundler), but it's a start.

In particular, it allows us to add non-OSS gems to
Gemfile.d without necessarily having to release it
as part of our open-source packaging

Change-Id: If7ff1fe97409de4cd09867ad5be1c4134c5d0117
Reviewed-on: https://gerrit.instructure.com/32442
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
help: prompt for email address when user is not logged in

fixes CNVS-12002

test plan:
  * enable /plugins/error_reporting
  * open the login page
  * click "Help"
  * click "Report a Problem"
  * verify that there is a field for email address
  * log in
  * click "Help"
  * click "Report a Problem"
  * verify that there is no field for email address

Change-Id: I8ef05bd7e927de25716a3b5b9bc8f8844ed4d74f
Reviewed-on: https://gerrit.instructure.com/32375
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
disable auto-submissions of quizzes in background until we can do more
regression testing with due dates and lock dates

fixes CNVS-12048

test plan:
  - Create a quiz with a time-limit (1 minute will do)
  - As a student, start taking the quiz
  - only answer a few questions and then close the window
  - the quiz should not be auto-submitted in the background anymore

Change-Id: Ib91286466dc83aa2ad66d7206449a0956d8c0fe8
Reviewed-on: https://gerrit.instructure.com/32430
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
Merge "Merge branch 'dev/timezunami' into master"
Merge "Merge branch 'dev/timezunami' into master"
Update API docs to include namespaced Quizzes

Closes CNVS-12019

Test plan:

  - generate the API docs using `bundle exec rake doc:api`
  - verify that all the quiz APIs are included in the docs
  - verify that the appendices are functional (in the QuizSubmissions
    API for example)

Change-Id: I80c6a10c13777d0b88fe96a8114f25b9a2a6f007
Reviewed-on: https://gerrit.instructure.com/32490
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
simplify time_ago_date processing

there was a one-off unfudge calculation. meticulous manipulation of the
code gives almost the exact same implementation as
unfudgeDateForProfileTimezone, and whose only deviations appear to be
bugs.

however, doing that unfudge (whether adhoc or using
unfudgeDateForProfileTimezone) was only necessary and appropriate when
the date to parse didn't have TZ info embedded (which it sometimes, but
only sometimes, did).

to simplify, just embed a known ISO formatted timestamp in all
time_ago_date elements. then we can parse that and use if for
calculations without any unfudging.

but don't forget to fudge that date before formatting for display (title
attribute and displayed string when > 1 day old).

test-plan:
 - have a student in a course that's posted on a discussion in that
   course
 - as a teacher in that course whose profile timezone does not match the
   system timezone, view the student's course roster page
   (/course/x/users/y)
 - under "Recent Messages", confirm that the friendly timestamps on the
   right for the discussion entry is displayed according to the correct
   (profile) timezone
 - confirm the title attribute (hover) of the friendly timestamp is
   formatted in the profile timezone

Change-Id: Id3385d58a9da02e9ed991ebd59152ca3f5fbd280
Reviewed-on: https://gerrit.instructure.com/31591
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
don't include user_offset in timestamp

result.timestamp should be the true timestamp of the parsed date, not
adjusted in any way. only include user_offset (the profile timezone,
counter to tz_offset which is the browser timezone) in the calculation
of `time', which is a fudged value

this wasn't a bigger issue before, because the timestamp value was only
used for sorting. even being off by user_offset, all timestamps were off
by the same amount, so they still sorted consistently.

test-plan:
 - load a page while logged in, open the javascript console
 - set "d = new Date()"
 - compare "$.parseFromISO(d.toISOString()).timestamp * 1000) == d"
 - should be true (before this code, was off by the profile timezone's
   offset)
 - go to the assignments page for a course with 2 or more assignments
   with distinct due dates
 - add a third assignment with a due date between the others
 - the added assignment should sort into the others appropriately

Change-Id: I30c45ea57d64da5dd82c535987fa728f2f69d147
Reviewed-on: https://gerrit.instructure.com/31597
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
collapse date_timestamp and time_timestamp

into just timestamp. guess what -- the derivation of timestamp from iso
MAKES SENSE now. weird

(moar baby steps)

Change-Id: Ifec487e616b903afdd8ca1a8806c5eecca1f0c88
Reviewed-on: https://gerrit.instructure.com/31974
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>