optimize query for root attachment to filter db-side

test plan: no visible change in behavior, attachments should still get
root attachments assigned when appropriate.

Change-Id: I866a81b6da81a744483fcadb2bff5b74d229619b
Reviewed-on: https://gerrit.instructure.com/13041
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
query the slave for some expensive queries

Change-Id: Ic2716b75551a85fc028fa7ac0673bf5cb01f14d1
Reviewed-on: https://gerrit.instructure.com/13042
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
allow more flexible widths/heights in user content

old UserContent.css_size was really weird about what it would accept and
when it would return a String vs. a Float. the times it returned a
Float, it would make api_user_content explode. fix that and add some
specs. the vulnerable code was exercised, among other places, in the
assignment json, which impacts gradebooks and other UI features.

fixes #9881

test-plan:
  - create an assignment in a course
  - in the assignment description, include the html
    <object width='100%' />
  - try and view the gradebook for the course
  - it should not have an ajax request error

Change-Id: I02e824414013347730185fbf7f7fb94a951f3e77
Reviewed-on: https://gerrit.instructure.com/12895
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix grade-dropping in gradebooks

The main feature of this commit is that it introduces a grade-dropping
scheme that maximizes the students grade (rather than the simple yet
somewhat arbitrary and inconsistent scheme we had before)

Also fixes the following bugs:

fixes #8454
fixes #8330
refs #8177

Test plan:

  Create a few assignments in an assignment group with drop rules
  (you'll need at least 'drop lowest' and 'never drop') and make sure
  those rules are respected in the gradebooks (old and new).

  Don't forget to test with the 'treat ungraded as 0s' option

Change-Id: I7e4f11939a311e1360aedbeda4d4461f317cfee6
Reviewed-on: https://gerrit.instructure.com/12405
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
specs: more generalization of delayed jobs in specs

this gets rid of more of the ActiveRecord Delayed::Job calls in our
specs, so that the specs can be run against other Delayed::Job backends.

Change-Id: I0df99dbb0ab9f7719741cfe7c68e76a4ace8afcf
Reviewed-on: https://gerrit.instructure.com/12958
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
preserve ContentTag links when overwriting Attachments

fixes #6233

test plan:
 * add a file to a module
 * upload a new file with the same name, overwriting the old one
 * make sure the file still appears in the module
 * make sure the new content is downloaded

Change-Id: Ic861cfd89aa30436f2abcf5d52e00efbcfb935e9
Reviewed-on: https://gerrit.instructure.com/12851
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
add highlight color back to jquery ui autocomplete suggestions.

fixes #9863

test plan:
  * navigate to /accounts/:account_id;
  * begin typing in the 'Find a Course' text box until possible
    matches are displayed;
  * verify that when you mouseover results or navigate through
    them with your arrow keys the current option is highlighted.

Change-Id: I9a2b34009f943082e91f9dc640142bfdaeccbe7b
Reviewed-on: https://gerrit.instructure.com/13037
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
account settings ui for calendar 2 and profiles

fixes #10031

provide a checkbox on all account settings pages, only visible to site admin
users, that allows them to enable/disable the new calendar or new profiles in
that account. this will work similarly to how global includes currently works.

test plan:
- as a site admin user, go to account settings
- you should be able to change the settings above
- as a regular admin user, go to account settings
- you should not be able to see/change these settings

Change-Id: Ia36189f0b31b30f2e2aad58652a12f870b9876a6
Reviewed-on: https://gerrit.instructure.com/13016
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
directly return the avatar url in api responses

This will bypass a lot of extra rails requests on things like discusison
topic pages.

refs #9679

test plan: load a discussion topic with lots of user avatars of
different types, veryify they still display correctly.

Change-Id: I29829806da30410c6b938ff3bcf54329a58698c4
Reviewed-on: https://gerrit.instructure.com/13050
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
a few more things to skip for deleted root accounts refs #6891

Change-Id: Id56c0f9a157734483fad29ffd95b9ea146ff1002
Reviewed-on: https://gerrit.instructure.com/13060
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
api: allow only offer as a param to course update

fixes #10063

the coures update api required passing at least one course[*something*]
parameter, which meant if all you wanted to do was offer the course, you had to
pass a dummy parameter.

test plan:
- call the course update api an only pass {:offer => 1}
- it should work

Change-Id: I5b89f1f3f474c3b097083f17403e1da20be4ca56
Reviewed-on: https://gerrit.instructure.com/13057
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
avoid trying to change a user's locale while in a slave-query block

test plan: visit a canvas course as a new user who has their browser set
to a non-en locale. you shouldn't see a page error.

Change-Id: I5f0447faaec4971a08082de9819d9be79f19935f
Reviewed-on: https://gerrit.instructure.com/13062
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
directly refer to the user avatar url for views

refs #9679

Often we already have the user loaded. Sometimes we don't, like when
displaying a stream item where only the user id is serialized to the
data blob. In these cases, we load the user now. This can make the
request slightly slower, but that's still more optimal than making
another separate request that loads the user.

test plan: avatars should still display as expected throughout the app,
but the urls canvas puts in the html will change -- they will directly
point at the image url now, rather than going through /images/users/XX

Change-Id: I418b81ee59aecd0ffd0c55c8ac305b77115f464e
Reviewed-on: https://gerrit.instructure.com/13061
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
bigger profile pictures

refs #9889, refs #8592

This commit removes support for twitter and linkedin profile pictures,
as they are too small.

Test plan:
  * rake db:migrate
  * go view some profile pages
  * the profile pics should not be ghetto-scaled

Change-Id: Ibea84420351cabbb496b1a8e5860d6e5834bb8ac
Reviewed-on: https://gerrit.instructure.com/13030
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
spec: failing course copy spec when QTI is disabled

Change-Id: Ic2f02d0675e0d4bc577836d13e5e1f4946a5f4f4
Reviewed-on: https://gerrit.instructure.com/12855
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
refactored login_logout spec.

tested:
1. using alias for find_elements
2. reduced hard-coded variables using factory data

Change-Id: I7c11f1def1ffbe292d62bef59d457d7da0f4f92b
Reviewed-on: https://gerrit.instructure.com/13078
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Revert "add highlight color back to jquery ui autocomplete suggestions."

This reverts commit 09958db6b6f3d4ca0769e48b6c87ca2840e6d400

Change-Id: Iac84a8cacd575eeea07e986268fd541071ce6e57
Reviewed-on: https://gerrit.instructure.com/13069
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Zach Pendleton <zachp@instructure.com>
only return discussions in discussions index api

fixes: #10084

when I wrote this before I thought @course.discussion_topics.active
would only return discussion topics, but it also returns
announcements.

test plan:
go to /courses/x/discussion_topics and make
sure you don't see any announcements there.

Change-Id: Ie80f92bd961d9da65114ac742ada4488bdb9036a
Reviewed-on: https://gerrit.instructure.com/13073
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
spec: refactoring course_wizard

test:
  1. added id selector to "start a new course"
     button
  2. refactored file to use f aliases

 # Please enter the commit message for your changes. Lines starting

Change-Id: I5f885cfd3bdd902d5bfa923b020d3625c42a49b5
Reviewed-on: https://gerrit.instructure.com/13108
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix ContextController#roster when context is Group in Course

fixes #10092

Change-Id: Ib505d583b0a4b0862fd97626f0475adb0cddd235
Reviewed-on: https://gerrit.instructure.com/13107
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>