canvas side support for embedded chat

test plan
- test the embedded chat commit

Change-Id: I8fc75efdeb35415749623770a49640708f5eaa4b
Reviewed-on: https://gerrit.instructure.com/24277
QA-Review: Cam Theriault <cam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
chat: use iframe for including minichat

fixes CNVS-8154

test plan:
  * set up a chat server with https://gerrit.instructure.com/24593
  * add the chat LTI tool as an app
  * navigate to a course page other than chat
  * verify that minichat still works

Change-Id: I547d34f012d0a846163fc906bc4d3328dbc03f36
Reviewed-on: https://gerrit.instructure.com/24592
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
only show the embedded chat when the chat tab is visible frd

fixes CNVS-8369

test plan
- make a public course with chat and embedded chat enabled
- view the course home page while not logged in
- ensure that the embedded chat does not show
- view the course while logged in but not enrolled
- ensure that the embedded chat does not show

Change-Id: Ic013c15c85dc19c8716cbb0bd6e53a20910c33c5
Reviewed-on: https://gerrit.instructure.com/24808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
fix quiz importing, re-importing, and overwriting

test plan:

1)
* create a course with a quiz assignment and
 a quiz module item
* copy into a new course

* in the original course, edit the quiz title
* copy the original into the new course again

* note that a new quiz, assignment, or module item
 has *not* been created, but rather their titles
have been updated

* confirm that the same happens when a course is
exported and re-imported

2)
* create a qti export from the original course
* import it as a QTI file into a new course

* edit the title of the quiz in the new course

* re-import the file, checking the "overwrite assessment
content" checkbox
* should revert the title to the original

* re=import the file, without checking the box
* should create a new quiz

fixes #CNVS-8097 #CNVS-8308 #CNVS-8443

Change-Id: I8b03ca9c9f5f1f3dada4d19369002f20b925d77e
Reviewed-on: https://gerrit.instructure.com/24710
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
add mini chat quicklaunching

fixes CNVS-8614

test plan
- while watching the network requests, log in as a user and open mini-chat
- ensure that a request is made to lti/launch
- navigate to a different page that also has the mini-chat
- ensure that a request is not made to lti/launch
- log out and log in as a different user in the same course
- navigate to a page that has the mini-chat
- ensure that a request is made to lti/launch
- send a chat message
- ensure that the message shows as being from the current user and not
 the first user

Change-Id: I43098476875f1b1e4d6514f5d79a4c6210bd72da
Reviewed-on: https://gerrit.instructure.com/25178
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
avoid infinte recursion when self-enrolling in another shard

fixes CNVS-8780

test plan:
1. create a user in one shard
2. try to self enroll in a course in another shard
3. it should work, and you should not get a page error

Change-Id: Id856686546499f90c4a77cd64d008b621cdc4158
Reviewed-on: https://gerrit.instructure.com/25257
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
add setting for event stream cql read consistency

This way we can mark a specific event stream (or all streams) as
consistency LOCAL_QUORUM. We don't want to make this the default, since
depending on your cassandra configuration using LOCAL_QUORUM could throw
an unsupported error.

fixes CNVS-8809

test plan:
* use casasndra page views
* with this commit applied, you should still be able to view people's
  page views at /users/X
* Setting.set('event_stream.read_consistency', 'ALL') and restart
* you should still be able to view page views, and if you look at the
  canvas logs, the CQL queries should be logged with a USING CONSISTENCY ALL
  clause

Change-Id: I623fe66af7454fdb5423a656166f4449b542ba8b
Reviewed-on: https://gerrit.instructure.com/25267
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
make rubric points translations more i18n friendly, refs CNVS-6456

this reverts commit ddda9353877e69d55ee2a2b829f78fcc0bb95349 and adds
aria labels in a slightly different way. also change translation key to
avoid page errors due to placeholder mismatch

i18n wrapper wasn't a great fit here since it was combining two loosely
related strings into one, rather than keeping a coherent phrase/sentence
together. e.g. a translator quite understandably might see "*Points* pts",
think it's a typo and just do something like "*Puntos*"

test plan (same as ddda935):
 - go to assignment creation page
 - add a rubric
 - verify that "Points" is read via VoiceOver when the criterion points
   field is focused
 - verify that there is no text following the points input field

 - go to SpeedGrader™ with an assignment that has a rubric
 - verify that "Points" is read via VoiceOver for the criterion points
   field
 - verify that there is a label like "/5pts" following the input field

Change-Id: I152ce523307b5bcd40820694ac800429bbd81b7a
Reviewed-on: https://gerrit.instructure.com/25308
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fixes delayed announcements for content migrations

test plan:
* enroll a student in course B
* create a delayed announcement for 10 min in the future
**  on some course A
* perform a course migration from course A to course B
* wait 10 min
* verify that the student in course B receieved a notification
**  for that announcement

Change-Id: Id93c12601cdcfdd62f120127e271267f6e93ad6c
Reviewed-on: https://gerrit.instructure.com/25334
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
run the RequestContextGenerator middleware before others

fixes CNVS-8894

This way any logging that other middlewares do with have the correct
session and request ids.

test plan:
* set log_context to true in logging.yml
* make some web requests
* the first "request throttling increment" debug log line in each
  request should have the same session/request ids as the request that
  follows, not as the previous request

Change-Id: I42aa105d19eaf6629054d5a43d3b4a535119c177
Reviewed-on: https://gerrit.instructure.com/25368
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
request throttle logging/whitelist/blacklist improvement

refs CNVS-8894

First, don't log the actual access token, use the hashed token as the
client_identifier instead.

Second, prefix the identifiers for easier identification.
So to whitelist/blacklist we'd now use one of the following:

"user:#{user.global_id}"
"token:#{AccessToken.hashed_token(token_string)}"
"session:#{sessionid}"
"ip:#{remote_ip}"

Also, send statsd event on "we would throttle" even when throttling is disabled.

test plan:
* after making web requests and api requests, grep for "throttling" in
  the rails log and verify that the identifiers are prefixed by "user"
  and "token", and the token id is displayed rather than the actual
  acess_token string
* add your ip to the blacklist with Setting.set("ip:127.0.0.1")
  (assuming you are hitting localhost), then restart or reload settings and
  verify that your requests now get blocked

Change-Id: I7b5b68a1df73623270d80eccc5f82655c0b51b86
Reviewed-on: https://gerrit.instructure.com/25369
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>

Conflicts:
	lib/canvas/request_throttle.rb
don't show access codes to students in quizzes api

test plan:
  - As a teacher, create a quiz with an access code.
  - Call the api as the teacher, you should get the access code back
    in the response.
  - As a student, call the api. You should not see the access code in
    the response.

fixes CNVS-7640

Change-Id: Id9699f96400a542a8fbc0e5517d4b3c33b4af615
Reviewed-on: https://gerrit.instructure.com/25386
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
cal2: make midnight assignment only display on due date

In week view, an assignment due at midnight was displaying both
at the bottom of the due date (11:30pm) and at the top of the
next day (12:00am), which was confusing. This change makes these
assignments only display at 11:30pm on the day they are due.

fixes CNVS-8013, CNVS-8827

test plan:
 - create an assignment due at midnight (don't specify a time)
 - view the assignment event in the calendar 2 week view and see
   that it is displayed only at the bottom of the specified day.
 - test the same thing with variable due dates.
 - make sure assignments that are due at different times display
   at the proper time.
 - make sure you can still change the assignment's due date and
   time via drag-and-drop.

Change-Id: Ia148c6c2e1766facbef70061ca633d93262395fa
Reviewed-on: https://gerrit.instructure.com/25358
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
Merge tag 'release/2013-10-05.26' into 2013-10-05

canvas release release/2013-10-05.26