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>
add content passback extension to lti assignment launches

This creates an LTI extension to pass text or urls along
with the score when doing an LTI 1.1 outcome request.

Test Plan:
 * use a tool that supports this extension on an assignment
 * After doing the tool activity the submission should have the expected value

refs #mebipenny

Change-Id: I296df1e7c7d99af61724a904511f9bf63d5d2613
Reviewed-on: https://gerrit.instructure.com/12878
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
keep track of active users even if pageviews are disabled

Change-Id: I0fd436b2e671c3d9bbe32e1b39c575f61399e7a7
Reviewed-on: https://gerrit.instructure.com/13143
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
handle qti questions with a leading, empty <div />.

fixes #10060

when importing a qti answer with a leading <div /> that's empty,
ignore it and look instead for a direct child with a "text" class.

test plan:
  * run specs

Change-Id: I10467eb1bdf0ad8508a4d11c59239d6e751b1958
Reviewed-on: https://gerrit.instructure.com/13112
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
only show "use for grading" options to teachers

fixes: #10080

a student can create a discussion topic but cannot
create an assignment. the backend worked and would
not let you, but the fronted was just showing the
checkbox when it should not have.

test plan:
create a discussion topic
edit an existing discussion topic that is used
for grading

as a teacher: make sure you can edit assignment
settings on both

as a student: make sure you dont see the option
to use for grading on either

Change-Id: I937e0f4a14964ccdd633988e2d3f5db753ed5b77
Reviewed-on: https://gerrit.instructure.com/13071
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
display right breadcrumb and active tab for announcements/discussions

fixes: #10083

test plan:
go to discussions index, edit, show, and new pages,
make sure highlighted tab is discussions and breadcrumb
says "Discussions"

do the same for announcements but make sure crumb is
"Announcements" and active tab is announcements

Change-Id: I9cf981ad8e7ffe8c7d17ec66bdbad81c93cf1947
Reviewed-on: https://gerrit.instructure.com/13072
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
use time zone when putting grade times in day buckets

fixes #6561

test plan:
 - in mountain daylight time (UTC - 6):
  - set the clock to a time after 6:00 pm
  - grade something
  - make sure the grading history doesn't say "tomorrow"

Change-Id: I8bac8f18ac769cdc6e50b521623adf98fcb06c9b
Reviewed-on: https://gerrit.instructure.com/13021
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Support new js tooltip on Notifications page. Closes #10027

Use the new jQuery 1.9 tooltip code on the /profile/communication
(i.e. Notifications) page.

Testing Plan:
==========
* Open the /profile/communication page
* Mouse over the buttons for ASAP, Daily, Weekly, Never
  and verify that the descriptive text shows up in a
  javascript tooltip above the button.

Change-Id: Ib14fd3c544088cc44e80c3b1b33131d636827957
Reviewed-on: https://gerrit.instructure.com/13009
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
make sure avatars returned from the api are absolute urls

refs #9679

test plan: canvas now stores an absolute url, so this can't be
reproduced by changing your current avatar in the UI. you can find a
user whose avatar_image_url column is relative, or manually set it to a
path without protocol/host. verify that the avatar url returned from
/api/v1/users/self/profile includes the protocol and hostname.

Change-Id: I8a77a3ec2f5203da4c7e5fd9490a515af79f96d3
Reviewed-on: https://gerrit.instructure.com/13117
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Update styles on quiz pages. fixes #9802

On quiz pages:
  * change background to light blue;
  * replace right/wrong indicators with new arrows;
  * change 'flag' question icon;
  * update layout of questions;
  * standardize question comment styles;
  * display radio and checkbox buttons on results
  * changed last-chance save to not be async to fix FF issue

Test plan:
  * view all quiz pages (new/edit, take, review, history)
    and verify that they work as expected.

Change-Id: I523f13324a34622a7fe5e50bae7b2239eaba8acc
Reviewed-on: https://gerrit.instructure.com/12906
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
api: some optimizations to users api

closes #10051

eliminate some n+1 queries in the users api by being consistent about
preloading necessary associations.  also refactor the user api docs so that
they follow the new @object/@returns model

test plan:
- make sure user api docs look good (and user parts of course api docs)
- there should be no noticiable changes to api behavior
- in dev, tail the logs, make some queries with lots of users, and make sure
  they are reasonable.

Change-Id: I4a3b0b94bbce4c62cdbfc83941b79b25773ba904
Reviewed-on: https://gerrit.instructure.com/13022
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
spec: fix intermittent gradebook2 failures

Change-Id: Ifbf633ce9efc57277daba029da45b00dacf89516
Reviewed-on: https://gerrit.instructure.com/13116
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
right side button wording from View Student Groups to View User Groups

fixes #9542

test plan:
  1. Go into Canvas at the root account level then go into Users
  2. Notice that the button is marked 'View User Groups' now

Change-Id: Ic8679131e1f072787967695e6157dbdb76bacfea
Reviewed-on: https://gerrit.instructure.com/13114
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
spec: add coverage to teacher overall grades page

also cleaned up and refactored the file

Change-Id: I4713b3f4885fa2f752cf217509d4f322bc50d86c
tested:
  * validate course display
Reviewed-on: https://gerrit.instructure.com/12892
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
put the normal user_display_json in the js_env rather than a custom hash

This fixes the discussion topic page using the wrong user avatar url for
the current user when adding a reply.

refs #9679

test plan: add a reply to a discussion, inspect the avatar image, and
verify that it uses the direct avatar link rather than the
/images/users/XX redirect link.

Change-Id: I1f4fcacfff3b98e2dc5ad1de11f20a939e119e32
Reviewed-on: https://gerrit.instructure.com/13081
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
catch all URI::Errors; fixes #10098

URI.parse can raise other errors beside InvalidURIError; catch
these too, so other types of bad URIs don't cause a 500 error
when converting links for API calls.

refs #10075 (that one was resolved by fixing the link in the DB)

test plan:
 - reply to a discussion topic
 - click the link button
 - enter "mailto:something@example,com"
 - save the comment; there shouldn't be an error
 - reload the discussion page; the reply should appear

Change-Id: Ia7fd35387625a1fb885bf705cfd17c680924c219
Reviewed-on: https://gerrit.instructure.com/13126
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
allow variables to have the value 0

fixes #8155

Test plan:
  * create a formula quiz question
  * make the variable definition x with a min/max of 0
  * make a formula definition that uses x (ex: 5 + x).  You should see a
    computed value, not an error message

Change-Id: Ida604c4b0c10b2567ab6061e8205c823366c9aea
Reviewed-on: https://gerrit.instructure.com/13127
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
spec: refactor specs

test:
  1. refactored specs to user f aliases
  2. refactored some :link usages to classes or ids

Change-Id: I8527c752b594fb58eaa2b54af2bdb2a922d10888
Reviewed-on: https://gerrit.instructure.com/13134
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>