strip bad UTF8 byte seqs from versioned quiz submissions

Test Plan:
  - with an existing quiz submission with bad UTF8 byte sequences,
    update the quiz submission
  - no errors should be raised and the version of the quiz submission
    should be updated

fixes CNVS-4421

Change-Id: I5288021a3b400a0bd59c4d70437ef737058bec18
Reviewed-on: https://gerrit.instructure.com/18346
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
remove deprecated rails constant usage

basically convert RAILS_ROOT -> Rails.root , RAILS_ENV -> Rails.env ,
RAILS_DEFAULT_LOGGER -> Rails.logger

This is necessary for rails 3

Change-Id: I138e1aa217fa8fb186d23ac09b04031c1e2b665e
Reviewed-on: https://gerrit.instructure.com/18412
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
handle assignments where user applied due_at is nil

Fixes an issue where if an assignment had an applied due date of `nil`,
User#upcoming_events would throw an exception when trying to sort a list
of events/assignments, because comparing nil against Time/TimeWithZone
objects made the sorting invalid ("Comparison of Array with Array
failed").

test plan:
  - Make a course with a student. the student shouldn't be in the
    default section for the course.
  - As a teacher, create two assignments.
  - For the first assignment, have a a section that does not have a due date
    (blank due date when editing the assignment form). Make sure the
    student is in this section that has no due date.
  - For the second assignment, create as many overrides as you like,
    ensuring that each override has a real due date.
  - View the dashboard. The right side bar should load without you
    getting any errors.
  - View the course home page (/courses/:course_id). It should load
    without any errors as well.

Change-Id: I0547ce16354ec1f735b5b16c1937853e245f790b
Reviewed-on: https://gerrit.instructure.com/18482
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
retrieve info about 'deleted' MediaObjects

fixes CNVS-4085

test plan:
 - upload a video to a course on the files page
 - put the video in a wiki page via the wiki sidebar
 - copy the course (course copy, not export/import)
 - in the original course, delete the video file
 - in the copied course, make sure the video still
   plays in the wiki page

note:
 - the video will still play in the copied course's
   files page; the new course made new submissions to
   kaltura.  We probably want to either fix the html
   links to point to the new media object, or make
   the new course's Attachments reuse the originals'
   media_ids (and make Attachments not destroy their
   associated MediaObjects when they're deleted).
   However, this feels like it might be an expedited
   fix, so I'll hold that for a later commit.

Change-Id: I5d7977e16fa6424ef8cf8e36d9f76afbfddfe50b
Reviewed-on: https://gerrit.instructure.com/18158
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
preserve html line breaks in discussion entry emails.

fixes CNVS-4514

test plan:
  * set up a student or teacher with asap notifications
    on discussion entries;
  * as a student or teacher that shares a class with the
    first user, reply to an existing discussion topic and
    include some line breaks in your response;
  * verify that the first user's discussion entry
    notification and verify that line breaks are preserved.

Change-Id: Iabfbc8db55e883d01621434400ce234a9b3a0e33
Reviewed-on: https://gerrit.instructure.com/18467
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
allow a plugin to override the signup form, refs #CNVS-4198

test plan:
- go to /register_from_website
- the forms should behave normally

Change-Id: I317f4a8404cbf00f2de112a88421c724834e6181
Reviewed-on: https://gerrit.instructure.com/18470
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
allow deleted courses on the courses api show endpoint

and add a route for course show in an account

Test Plan:
 * test api calls to /api/v1/accounts/:account_id/courses/:id
 * delete a course and then make sure you can get that course
   when adding ?include[]=all_courses to the request

refs CNVS-3692

Change-Id: I96fb541a829d7c117bfe1afa7a765d35c98cfe5c
Reviewed-on: https://gerrit.instructure.com/18325
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
change attachment backends dynamically for specs

removes the need to fork/exec (and reboot rails) for specs;
also simplifies forcing a specific backend for specs

note that path_prefix in file_store.yml is now respected for
S3 as well (so that parallel spec runs that use the same bucket
don't conflict with each other), with the caveat that 'tmp/files'
is special cased to be backwards compatible for S3, and change
to 'attachments'

test plan:
 * specs pass (especially selenium specs involving files)

Change-Id: I9673d454291062c958c2989788d36339ce60dfc4
Reviewed-on: https://gerrit.instructure.com/18292
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
upgrade attachment_fu to use aws-sdk gem instead of aws-s3

closes CNVS-4248

this gains us EU region support, and no longer using a forked aws-s3 gem

in the process, setting bucket_name via a plugin is no longer supported

test plan:
 * should be able to upload new files via various methods
 * should be able to download old and new files still

Change-Id: If32fa5f381f5a4ac493948fa32230175a695f51e
Reviewed-on: https://gerrit.instructure.com/18282
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
spec: be tolerant of flickr returning bad images

Change-Id: I9e57751a3cc32997c477a0281e2ea90c80e19bd9
Reviewed-on: https://gerrit.instructure.com/18515
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
resolved floating divs from stacking by removing unnecessary floats

fixes CNVS-4473

test steps
- create a new course
- create a discussion in the course with a bunch of replies from the
  teacher and the student
- log in as either a teacher or student and go to the conversations page
- click on the dropdown that changes your view from the inbox folder to
  the sent and click on the Discussion Replies link
- ensure that the page looks correct

Change-Id: I87e8eb3c93e1ec3009ee54f9d4e6be7b88412fe2
Reviewed-on: https://gerrit.instructure.com/18434
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
resolved issue with discussion cog pulldown menu inconsistencies

fixes CNVS-4494

test steps:
- create a new discussion with at least 6 replies
- go to a reply that is below the parent and click the cog button
- ensure that the dropdown menu items are consistent with the parent

Change-Id: Iab692671d8742a54d7ce2003b7f90887e0fcdd8f
Reviewed-on: https://gerrit.instructure.com/18438
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
added enrollmentName helper

Change-Id: Ibcbf490e6933c7f803f8bd3863488f853c802236
Reviewed-on: https://gerrit.instructure.com/18443
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
add optionProperty to collections

Change-Id: I67fe5c655fad367ed817584155b8f47c15b7c63b
Reviewed-on: https://gerrit.instructure.com/18442
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
added ValidatedMixin, updated SearchView to use it

Change-Id: I58323fb162af96d4c8490b6bcb0a5fda2a71a87e
Reviewed-on: https://gerrit.instructure.com/18446
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
handle bad conversation_id in load_messageable_users

fixes CNVS-4557

test-plan:
 - have two users X and Y such that X cannot normally message Y
 - as user X, attempt to get the following via API:
   /api/v1/search/recipients?user_id=Y&from_conversation_id=bad_value
 - should return an empty result list, rather than an internal server
   error

Change-Id: Iecd1d3869d8e4921efdf129355eddbc0c2dc462c
Reviewed-on: https://gerrit.instructure.com/18490
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
api call to delete a conversation for everybody

fixes CNVS-4437

test plan:
 - The api endpoint is:
   https://<canvas>/api/v1/conversations/:id/delete_for_all
   no other parameters (besides authorization header) are
   required.
 - Create a group conversation involving multiple users.
 - Get the group conversation's id
 - Try delete_for_all as one of conversation's users. Should
   receive 401.
 - Try to delete_for_all the conversation as an account admin
   user. Should receive 401 error.
 - Try to delete_for_all the conversation as a site admin
   without "become user" permission. Should receive 401 error.
 - Try to delete the conversation as a site admin with "become
   user" permission. Call should succeed.
 - The conversation should be gone from all involved users'
   inboxes.

Change-Id: Idf5d1f8d66aaa2c5bb26cec451dffcac1aaafcaa
Reviewed-on: https://gerrit.instructure.com/18393
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
don't fire onInput if the value hasn't changed

Change-Id: Ic64ac6bd7637cdfba3d734139a869632b3d0da6e
Reviewed-on: https://gerrit.instructure.com/18444
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
fixes bug in PaginatedCollectionView

properly detaches scrollEvent

Change-Id: I0fc4e79360bffaa9fede1f0fc9de482cb1937000
Reviewed-on: https://gerrit.instructure.com/18445
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
fix import for unbalanced pluralizations

fixes CNVS-4533

current i18n gem doesn't like pluralization sets
where you specify "other" but not "one".  This
pulls the i18n import into it's own class and
specifically specs out the copying over of the
"other" key into the "one" key in a pluralization
set unless a "one" key already exists.  Importing
any translation set will now solve the pluralization
view errors.

TEST PLAN:
1) confirm that the errors specified in CNVS-4533
are still occurring for the japanese language
set with the current translations.

2) run the i18n import process for the japanese
translations

3) confirm that the view errors are no longer
cropping up under the japanese translation set.

Change-Id: Idb856bd72f4d8e526a645f70a8fcc5556c4a4f98
Reviewed-on: https://gerrit.instructure.com/18526
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
QA-Review: Clare Hetherington <clare@instructure.com>