spec: fix attachments not being found when duplicated

the dynamic attachment_fu backend changing overwrote Attachment#attachment_path_id
with a custom method to dynamically delegate to the backend. detect such methods,
and leave them alone

test plan:
 * `spec spec/apis/v1/course_api_spec.rb spec/apis/v1/sis_imports_api_spec.rb`
   should pass

Change-Id: I6cad3c9bbc4edfca7ab64bb4ffe239d50dde8cdf
Reviewed-on: https://gerrit.instructure.com/18685
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
create migration issues and start content migration api

this will allow migrations to have flexible todo items
and allow us to make a super awesome UI for helping
teachers fix any migration problems

Test Plan:
 * Run a migration that has issues. :)
 * exercise the issue api

closes CNVS-4230

Change-Id: I4577f811dd3b16aa200d381f039632b7cc2cd184
Reviewed-on: https://gerrit.instructure.com/18639
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
add File.expand_path for ruby version compatibility

code fix, no test plan

Change-Id: Iff01e6523fb7d77a84d8e9829c5efbb2a5306a51
Reviewed-on: https://gerrit.instructure.com/18622
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
update rake

it's functionally the same as 9, it just removes a bunch of
deprecated stuff we're not using

Change-Id: Iee9b6f0ae57607bbf481f6c90fd0007a3b3d9133
Reviewed-on: https://gerrit.instructure.com/18679
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
remove redundant someone-else-edited warning

there are two different warning messages when viewing a page
that has changed since your page load - one (with a prompt to
reload) when you are just viewing the page, and another
(with a scary icon) when you are editing a page and about
to overwrite someone else's changes.

we were actually displaying _both_ messages in the latter
case, resulting in a bit of a mess.  just display the one.

fixes CNVS-4652

Change-Id: I479510319c8fa8244191477ee36758095507cf60
Reviewed-on: https://gerrit.instructure.com/18654
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Bootstrap: fix settings display issues

fixes CNVS-2495

test plan:
 - create a custom course role
 - view course settings users tab
 -> count for custom roles should be spaced properly
    "Custom (0)" instead of "Custom(0)"

 - go to account settings
 -> "Question Banks", "Sub-Accounts", and "Terms" tabs should
    highlight when they are selected

 - go to user profile page
   e.g. https://canvas.instructure.com/profile/settings
 - click the "Edit Settings" button
 -> the checkboxes for "Let fellow course/group members..."
    and "Change Password" should be aligned with the text
 -> you should be able to toggle the checkboxes by clicking
    on the text

Change-Id: I2be09430d4d87d5101af81ba82dc8a3f11543ff6
Reviewed-on: https://gerrit.instructure.com/18690
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
update Japanese translation to prevent error pages

Some of the countable translation keys were not (and still are not)
correct in the translation file. This update will prevent Canvas
from giving page errors when the translation keys are missing.
(meanwhile, looking in to the incorrect countables in translation)

Test Plan:
  - Canvas pages with countable translations (e.g. "1 student" vs
    "3 students") should not be a page error.

fixes CNVS-4533

Change-Id: I6c076805c590f13b1381b8d870a943f80077e835
Reviewed-on: https://gerrit.instructure.com/18563
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
fix attachment.open with a block

This broke with the conversion to aws-sdk

test plan: do a course import that has text or html files in the package
(i discovered this while doing an Angel import). creating the
attachments in the course should not fail. (before this commit it was
failing in infer_encoding)

Change-Id: Ia492f5e42436e2db2b6c66852264af8b1731499c
Reviewed-on: https://gerrit.instructure.com/18652
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
fix display issues on /courses/X/users/Y

test plan:
 - have a course in an account with user profiles turned off
 - as a student, respond to some discussions in a course
 - view the student's course user profile page
   /courses/X/students/Y
 -> the table headers in the "Name and Email" box should be
    left-aligned
 -> the bodies of the "recent messages" should appear below
    the "from" line, not kind-of-diagonally-to-the-right

fixes CNVS-4618

Change-Id: I469dfb63c45f6003c512a68101dd2a7fb35eb11c
Reviewed-on: https://gerrit.instructure.com/18668
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
fix external tool settings layout

test plan:
 * go to account settings
 * configure a few external tools with names of varying length
 * make sure they show up underneath the names, not to the right

fixes CNVS-4687

Change-Id: I45a4a29675922edfc57679c4ef4d104007f0568e
Reviewed-on: https://gerrit.instructure.com/18670
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
remove files rss feed

fixes #CNVS-4569

Change-Id: I3785eaa00517e9cd552dec760119907ff0b6f6d4
Reviewed-on: https://gerrit.instructure.com/18541
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
fix a missed RAILS_ENV call

refs CNVS-4709

Change-Id: Icc2f133ba6bf6817119a38e5f227353ebba2dc56
Reviewed-on: https://gerrit.instructure.com/18699
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix style problem on conversation filter tag

Fixes CNVS-3993

This fixes IE, Chrome, and Firefox display issues.
This actually just brings it to match current
production.

Testing Notes:
===========
* Verify the correct tag appearance
   in all supported browsers for
   filtering inbox messages.
* Verify correct appearance for compose
  message use when sent to single person
  and also when sent to multiple
  people in a group like "all students"
  in a course. Shows text like "7 people"
  to the right of the course name.

Change-Id: Iabdfffd89af40c9ff6f2d1e2c3dcecedbf1a58ce
Reviewed-on: https://gerrit.instructure.com/18460
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fix minor typo on discussion page

Change-Id: I82de7a2cf1ef7bf7b750a55408f9adaaa6f82cad
Reviewed-on: https://gerrit.instructure.com/18706
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
do not allow oauth code reuse

this fixes an issue that allows 3rd parties to request multiple oauth
tokens with the same code until the code exiles on its own in redis

test plan:
 * follow the oauth token flow
  - request canvas access
  - exchange the code for the final access token
 * you should get an access token
  - repeat the previous request to exchange the code for the access token
 * you should get an 'invalid code' message

Change-Id: I7724988c16ac307be7dd4b762a07e936c3ad38bd
Reviewed-on: https://gerrit.instructure.com/18592
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
allow 3rd parties to use oauth for authentication

adds scopes to access token and a new scope, 'userinfo'. when this scope is
used, a user may choose to remember authorization for a 3rd party. when this
option is selected, subsequent requests for an access token scoped to userinfo
will skip the the step where the user authorizes the app and will return userinfo
but no access token.

test plan:
* follow the oauth token flow adding a param for scopes=%2Fauth%2Fuserinfo to the initial request
- check the box for to remember authorization
- click login
* repeat the above request
* you should not see the request access page

* delete the tokens that were generated above
* run the test above, this time not remembering access
* you should see the request access page on the second request

Change-Id: I303a55d3c71de517ce6aa5fd8acd74d89aa4c974
Reviewed-on: https://gerrit.instructure.com/17604
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
paginate TokenSelector lists

as part of finishing cross-shard conversations, the rank_results option
to search_messageable_users will no longer be supported (because we
can't calculate ranks in the DB cross-shard, and we're not going to load
the entire collection to sort by rank). this means that we can't rely on
the most useful results being in the first five returned results, so we
actually have to fetch the second page, third page, etc.

to enable this, this commit refactors the TokenSelector to handle
pagination by using PaginatedCollections wrapped in PaginatedViews.

refs CNVS-1170

test-plan:
 - full regression on conversation recipient handling, inbox filter
   handling, section searching in the user's tab of course settings,
   etc. basically anywhere the recipient finder style input is used

 - in all those places, functionality should be equivalent with the
   existing code. may look slightly different, but handle the same and
   without looking bad

 - in addition, when searching for just users (I think this may only
   apply in the quick start bar finders), should handle multiple pages
   with automatic on-demand pagination (i.e. as you scroll down, more
   results load).

Change-Id: Ic0125b8f8452ecdb821802b0c415b4c6318e7c75
Reviewed-on: https://gerrit.instructure.com/18247
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
decrease periodic quiz submissions

We currently submit quiz submission values every 30 seconds as a
precautionary measure to prevent accidental data loss. However, when
hundreds or thousands of students take a quiz at the same time it is
unnecessary and problematic to send so much redundant data.

This patch checks the submitted data (on the client side) to see if
the data is identical to the most recent submission. If identical,
it just doesn't submit it.

fixes CNVS-2153

Change-Id: If10d48acefc29e2ebadb3ea4d1031f5ecb209a5d
Reviewed-on: https://gerrit.instructure.com/18662
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
spec: avoid before(:all) where possible

they're prone to leaving junk around, don't allow parallel specs
on the same database, and are typically slower anyway if you do
the "right" thing and truncate_all_tables in an after all

Change-Id: I2455e5c0de98c75e3748ce7fc2caf6d04a150a44
Reviewed-on: https://gerrit.instructure.com/18684
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
spec: fixed 1.8.7 specific duplicate path error

Change-Id: I0beb914579bf03edc3fdd331246bd44d273191f3
Reviewed-on: https://gerrit.instructure.com/18703
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>