Commit Graph

593 Commits

Author SHA1 Message Date
Tyler Pickett 29e1ddec0f Optionally configure live events via Consul
Fixes: CNVS-35832
Refs: CNVS-32864

This was super simple because of the change to using a hash for
configuring LiveEvents instead of a PluginSetting object

Change-Id: Ia34cb905e22a21c822f48b581e3e3cd4f7a738d3
Reviewed-on: https://gerrit.instructure.com/110193
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2017-05-10 16:07:41 +00:00
Tyler Pickett 7b45e0fd24 Add environment prefix to consul keys.
Since some environments share a consul datacenter we need to be able to
differentiate configurations.

Fixes: CNVS-34341

Test Plan:
- Nothing uses this yet but we need to make sure we haven't broken JWT
  secrets, the RCE, and Address Book.

Change-Id: I496a8f7d2cafd02c3177a28b348679e552965c0d
Reviewed-on: https://gerrit.instructure.com/99650
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2017-05-05 19:39:16 +00:00
Landon Wilkins f1359d33e2 da licença part 27
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I331826e3e3be8b7d73bbf4f6afe3a79ec1340f54
Reviewed-on: https://gerrit.instructure.com/110051
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:53:31 +00:00
Tyler Pickett 5a67acc83a Track permission generation for redis loggging
We weren't tracking this so we couldn't get an idea of how much our
caching was saving us.

Change-Id: I41cc595a34e6cf709a945420a5e75efdcdcbb57d
Reviewed-on: https://gerrit.instructure.com/109494
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2017-04-25 20:24:56 +00:00
Simon Williams e4e9289853 add some options for turning down redis logging
Setting.set('redis_log_style', 'json') - verbose logging as JSON
Setting.set('redis_log_style', 'compact') - similar to rails SQL logs
Setting.set('redis_log_style', 'off') - no redis logging

'compact' is the default

closes CNVS-36152

test plan: set the setting to all three levels, and verify the logs look
right

Change-Id: I8f56cbb61250243f0f1976809cf28e11fd4921eb
Reviewed-on: https://gerrit.instructure.com/107706
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
2017-04-24 17:58:18 +00:00
Cody Cutrer 327e0d7900 move object caching into ConfigFile itself
refs CNVS-36051

we often want to cache an object built from the config we got, so
move that up so we don't keep repeating ourselves

Change-Id: I9c58993b6142cec41f4514dcb1a74dd5d5582234
Reviewed-on: https://gerrit.instructure.com/107166
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-04-07 19:43:54 +00:00
Tyler Pickett f0214f0923 Switch to Imperium gem and update Consul container.
Also, make Consul container accessible from the host.

Fixes: CNVS-35831
Refs: CNVS-34341, CNVS-32864

Test Plan:
- Smoke test RCS and Canvas running together to make sure they still
  play nice.

Change-Id: I418d54a176677b1df8ec42a009752807908a847c
Reviewed-on: https://gerrit.instructure.com/99443
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2017-04-07 16:59:01 +00:00
Jayce Higgins 04d1801679 Fixup content_export_complete LiveEvent metadata/body
Fixes: QUIZ-1478

Move the context_type/id to the attributes
Tack on amended_context to the payload

Test-Plan:
  o With live events set up for local testing
    - Assert that the quiz_export_complete event looks right
      - It should contain uuid/root_account_id/and everything else
        in the attributes
      - It should not contain context_type/id in the body

Change-Id: I15387ce81f6d0ed8a7c72831d08b34c1bc40221e
Reviewed-on: https://gerrit.instructure.com/106811
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Jayce Higgins <jhiggins@instructure.com>
2017-04-06 16:40:30 +00:00
wdransfield 905c65551d Add 'lti_assignment_id' to submission and assignment live events
Closes PLAT-2438

Test Plan:
For each of the following live event types, verify that a field
named 'lti_assignment_id' is included and set to the 'lti_context_id'
of the assignment associated with the event:
   * submission_created
   * submission_updated
   * plagiarsim_resubmit
   * assignment_created
   * assignment_updated

Change-Id: I7fa46e414da3a2fab8e4a5ac2c7d213a0dd3ec3c
Reviewed-on: https://gerrit.instructure.com/107104
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-04-03 13:27:31 +00:00
Jayce Higgins 4420c72cfb Add root_account_uuid to canvas LiveEvents
Fixes: PLAT-2369

Test-Plan:
  - spinup local live-event testing services
  - test out live-event spawning processes
    -- check live event docs for triggers of events
  - assert that the kinesis stream contains events with attributes
    containing `root_account_uuid`

Change-Id: I3ad3d64621c7726d30de9a8a8824e8b0e5d5aab2
Reviewed-on: https://gerrit.instructure.com/105621
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Jayce Higgins <jhiggins@instructure.com>
2017-03-31 20:54:25 +00:00
Matthew Wheeler c068fcb16e Truncate fields in wiki page updated live event
Fixes PLAT-2363

Test Plan:
Cause a live event for a wiki page update to occur
  with a body and title each > 8192 characters
Check that both the body and title were truncated

Change-Id: Iea44150bdb6b178d8a825c71dba3c01301f832f6
Reviewed-on: https://gerrit.instructure.com/106812
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
2017-03-31 17:28:28 +00:00
Jacob Fugal 54da1d33f6 additional live events instrumentation
refs CNVS-32764

for address book

- add group_updated and group_membership_updated events
- add associated_user_id to enrollment_created and enrollment_updated
  events for observer enrollments
- add workflow_state to group_memberhsip_created events
- add context_type, context_id, account_id, and workflow_state to
  group_created events

test-plan:
- configure local canvas to write live events to a local kinesis stream

[group fields, group_updated events]
- create a course group; the group_created event in the stream should
  have a context_type of 'Course', a context_id of the group's course,
  an account_id of the group's account, and a workflow_state of created
- create an account group; the group_created event in the stream should
  have a context_type of 'Account', a context_id of the group's account,
  an account_id of the same, and a workflow_state of 'created'
- delete a group; a group_updated event should be emitted in the stream,
  with all the same fields and a workflow_state of 'deleted'

[group_membership fields, group_membership_updated events]
- add a user to a group; the group_membership_created event in the
  stream should have a workflow_state of 'accepted'
- remove the user from the same group; a group_membership_updated event
  should be emitted in the stream, with all the same fields and a
  workflow_state of 'deleted'

[enrollment associated_user_id field]
- create a non-observer enrollment (e.g. teacher); the
  enrollment_created event should not include an associated_user_id
- create an observer enrollment without an assigned observee; the
  enrollment_created event should include a null associated_user_id
- attach the observer enrollment to an observee; the enrollment_updated
  event should include the updated associated_user_id

Change-Id: I15066b7c6cc85f914be433530d542c6f13643e6a
Reviewed-on: https://gerrit.instructure.com/106335
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2017-03-28 21:12:54 +00:00
wdransfield d6f4a9dec1 Plagiarism resubmit event type
Closes PLAT-2404, PLAT-1910

Test Plan:
- Create an assignment associated with a similarity
  detection tool.
- Verify that a subscription with the
  'submission_created' and 'plagiarism_resubmit'
  event types is created in Dynamo.
- Create an assignment of type online upload
- As a student submit a document for the assignment
  submission.
- Create an originality report for the submission with
  the workflow state set to 'error'
- Navigate to the submission in speed grader and
  click the resubmit to TII button.
- Verify canvas emits a 'plagiarism_resubmit'
  event
- Verify you can create/manage subscriptions of this new
  type via the subscriptions api (See https://docs.google.com/
  document/d/12x6Peif-I-0zvl2uMv2JVbQdZumGGqMtspWKYTqlL9o/edit)

Change-Id: Ia9eff1c61bf0b5662e0b6bc1d088026afd03e8af
Reviewed-on: https://gerrit.instructure.com/106187
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-28 19:13:55 +00:00
Brent Burgoyne 7511243ef7 add endpoint to refresh jwt with with workflows
now that services jwts have a concept of workflows and extra data
encoded in the token based on workflow requirements, the existing jwts
endpoint is insufficient for refreshing expired jwts. to some extent
it was already broken since it lost the context when refreshed with
that endpoint

a new refresh endpoint has been addded that takes an exisintg jwt as
a param. this makes it possible to get a new token with the same
workflows, state, and context as an existing expired token as long as
the token matches your user and is requested with a valid session or
oauth token.

tokens may only be used for refresh up to six hours past expiration.

refs CNVS-35199

test plan:
- go to "Pages" in a couse with RCS enabled
- open the console, and get the jwt from ENV.JWT
- wait at least an hour
- make a POST to [same-domain]/api/v1/jwts/refresh with the token as
  the `jwt` param
- it should return a json response with a token property
- copy the token
- open up your rails console
- run Canvas::Security.ServicesJwt.new("[copied token]").original_token
- should return hash with the following proerties
  - should have :sub with your users global id
  - should have :domain that matches your canvas domain
  - should have :context_type of Course
  - should have :context_id of the course you generated the original
    token from
  - should have :workflows with rich_content and ui
- repeat process masquerading as another user
  - when making a the post to the refresh endpoint use your user and
    set a param `as_user_id` to the id of the user you are
    masquerading as
- the hash in the console should have
  - :sub with the global id of the user you are masquerading as
  - :masq_sub with your user id

Change-Id: I399569ed8f2d3d0646728f72910456b77b3ed46a
Reviewed-on: https://gerrit.instructure.com/102909
Reviewed-by: Tucker McKnight <tmcknight@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Tested-by: Jenkins
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2017-03-17 16:22:08 +00:00
Ryan Shaw 5b88629fe0 Remove RequireJS support
closes: CNVS-31785

test plan:
all builds should pass

Change-Id: I2925934692a3d2f115f1289d7b50cb72d8cb907f
Reviewed-on: https://gerrit.instructure.com/104492
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2017-03-13 22:10:23 +00:00
Cody Cutrer a99d2a3bdc spec: don't allow raise_error with no arguments
most of these are simple fixes, but there are a few where the spec has
actually been broken due to underlying API changes, that were masked
due to the generic raise_error matcher

fixes CNVS-35542

Change-Id: I982e7ab9af59101b79fdf6b2e0816b374a6a6d5b
Reviewed-on: https://gerrit.instructure.com/104750
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-03-10 21:34:37 +00:00
Cody Cutrer 007327c6df rails 5: a few more strong params tweaks
Change-Id: Ic47369323ac1c71f4af40f800c997413a9f5218b
Reviewed-on: https://gerrit.instructure.com/104464
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-09 04:06:05 +00:00
Ed Schiebel d1664390e2 Upgrade instructure-ui to 1.0
fixes CNVS-34969

test plan:
  - go /profile/settings and turn on high contrast
  - go to the course people page (/courses/#/users)
  - click on the +People button
  > expected result: the modal honors high contrast

  - enter some text in he text area
  > expected result: nothing bad happens, as the event
    handler for TextArea has changed.
  - there's a TextArea in MessageStudents also, but I don't
    know where to find it in the UI. You should probalby
    test it doesn't blow up either.

Change-Id: Ia8102dacfa2b01ee043002ee0f5c27943abe5743
Reviewed-on: https://gerrit.instructure.com/102133
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Dan Sasaki
Product-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2017-03-08 19:23:07 +00:00
Hannah Bottalla ea8a3c8409 Push quiz_export_complete live event from Canvas
closes: QUIZ-1235

test plan:
pre-reqs: quizzes2 feature enabled, course and quiz made,
kinesis stream setup (doc/live_events.md)

1. hit the content export endpoint with your quiz id
2. verify the content export has a completed status
3. verify you see output in the kinesis stream
4. verify you see the assignment payload in the settings hash
5. verify the payload includes:
 a. resource link id
 b. title
 c. context title
 d. context_type
 e. context_id

Change-Id: I967a5c9260830ff99afc36e4a098435b81431f83
Reviewed-on: https://gerrit.instructure.com/103755
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Tested-by: Jenkins
Product-Review: Hannah Bottalla <hannah@instructure.com>
2017-03-08 17:00:27 +00:00
Cody Cutrer c477cb0b02 rails 5: fixes for spec/lib/c**_spec.rb
refs CNVS-34863

the services jwt thing is just autoloading confusion. by not nesting
the modules, it forces Canvas::Security to load even if you load
Canvas::Security::ServicesJwt first (via an explicit require_dependency
that the spec uses)

Change-Id: Ie08e34ab41502cf8e5c76126d7c6853af9c5947a
Reviewed-on: https://gerrit.instructure.com/103797
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-02 20:38:41 +00:00
Spencer Olson ef811cfc51 remove dependent destroy of scores
remove dependent: :destroy for scores on the grading_period and
enrollment models. when there were a lot of scores, the dependent
destroy was taking a very long time. now, we do a single update_all to
set the workflow state of scores to 'deleted'.

closes CNVS-35207

test plan:
 1) Enable Multiple Grading Periods in a course and create a grading
    period.
 2) Grade at least 3 students in the grading period.
 3) In a rails console, verify there is more than one score associated
    with the grading period:

    period = GradingPeriod.find(the_grading_period_id)
    period.scores.count > 0 # this should return true

4) Destroy the grading period and verify all the associated scores have
   their workflow states updated in a _single_ query:

   period.destroy

   # you should see a query that looks like:
   # UPDATE "scores" SET "workflow_state" = 'deleted'
   #   WHERE "scores"."grading_period_id" = 8 AND
   #   "scores"."workflow_state" = 'active'

Change-Id: I03f5097289d8e781114940c8371f5a0baa2f920f
Reviewed-on: https://gerrit.instructure.com/103106
Tested-by: Jenkins
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-24 21:11:27 +00:00
Simon Williams bf414be236 log user_id in error report creation
error_report.email gets generated and cached on creation, so if user
isn't set, it gets cached to a bad value.

fixes CNVS-34410

test plan:
- set up the external ticketing adapter
- report an error
- your email address should come through

Change-Id: Iadf721628475e33379668c54e705fe519cbb8e5b
Reviewed-on: https://gerrit.instructure.com/100253
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-02-15 18:29:34 +00:00
Ryan Shaw 84dc36d3e1 handle timezone data loading out-of-band from webpack
fixes:  CNVS-34796

emitting assets for each of these timezones adds a
non-trivial amount of time to the webpack build.
by making it so webpack doesn’t have to do anything
about them, it goes a lot faster since there is just
a lot less work to do.

this commit also uses npm to get `timezone` instead
of a git checkout

test plan:
in requireJS & webpack,
* load a few pages, make sure your timezone data loads
* automated specs should pass

Change-Id: Ice3b7b6d4c7ac53315d5cb238d4213afb9faddc5
Reviewed-on: https://gerrit.instructure.com/101116
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
2017-02-10 23:42:48 +00:00
Cody Cutrer 0a9755948b ruby 2.4: fix OpenSSL::Cipher::Cipher deprecation warning
Change-Id: I6e7ffefc974e51e14e2230b5fc09aeb803d408c3
Reviewed-on: https://gerrit.instructure.com/101399
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-02-08 17:58:22 +00:00
Cody Cutrer 39ff23d8cf ruby 2.4: truncate generated encryption key to proper length
Change-Id: I6dc882a0afd010e919be6a5993e80aa581de1ba7
Reviewed-on: https://gerrit.instructure.com/100981
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-02-02 21:50:10 +00:00
Nathan Mills 85673f081f create jwt access_tokens for LTI2 services
fixes: PLAT-2127

test plan:
- Hit the LTI2 Auth Token endpoint to get an AccessToken
- The access token should be a canvas signed JWT

Change-Id: If09dfc658ecc40fc525b9c49d49110539573e657
Reviewed-on: https://gerrit.instructure.com/99946
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2017-01-27 20:20:00 +00:00
Keith Garner 080d4e2e26 switch to redis server side script for failure percent counter
This movies from using multiple redis calls in ruby to redis server
side lua scripts for the rolling counter and the math contained in
FailurePercentCounter. This provides atomic operation over all the set
of redis calls and should provides efficiency over multiple separate
call for the data.

closes CNVS-34236
ref CNVS-34031

test plan:
 - Ensure canvas is configured to use redis
 - In the rails console do the following:
    Setting.set('service_qatesting_timeout', 1)
    Setting.set('service_qatesting_timeout_protection_method',
                'percentage')
    Setting.set('service_qatesting_min_samples', 10)
 - The following must be completed in the rails console in under a
   minute:
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { sleep 2 }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { sleep 2 }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.redis.ttl("service:timeouts:qatesting:percent_counter:protection_activated")
 - Note that after each 'sleep' above that an error report of type
   'service_timeout' was generated
 - Note that after 10 samples, we went into timeout protection by
   the log message of "Skipping service call due to error count: qatesting 0.2"
 - Note that the Canvas.redis call returns a number between 0 and 60

Change-Id: Ic04eaab4edb49518e47538feda06dd32a32b49ec
Reviewed-on: https://gerrit.instructure.com/99764
Tested-by: Jenkins
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-19 23:41:39 +00:00
Michael Brewer-Davis a78cc8b2a5 ensure cyoe only references fully graded, non-muted assignments
- add muted and grading_complete fields to live events

refs: OUT-577

Test alongside g/97097

Test plan:
- Partially graded items
    1.  Create a quiz with some automated and some manually graded
        content.  Apply mastery paths rules to trigger other assignments.
    2.  As student, take the quiz, such that your score on the
        automatically graded content would trigger a mastery path rule
    3.  Verify that no content is released
    4.  As teacher, grade the remaining questions of the quiz such that
        master paths content should be released.
    5.  Verify that the appropriate content is released to the student.

- Muted items
    1.  Create an assignment with mastery paths rules
    2.  As student, submit the assignment
    3.  As teacher, mute the assignment
    4.  Grade the submissions such that master paths content should be
        released
    5.  As student, verify that no content has been released
    6.  As teacher, unmute the assignment
    7.  As student, verify that the appopriate content has been released.

Change-Id: I312aba018ca262a907c6a23a938af739842e28ae
Reviewed-on: https://gerrit.instructure.com/97098
Reviewed-by: Matt Berns <mberns@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Cemal Aktas <caktas@instructure.com>
Tested-by: Jenkins
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2017-01-11 20:21:40 +00:00
Edward Schiebel ce821321c9 Replace avatar image cropper with keyboard accessible one
Fixes: CNVS-28306

Test Plan:
- ensure Admin > <your account> > Settings > Enable Profiles
  and User Avatars are checked
- navigate to Account > Profile
- using keyboard:
  - TAB (displays "skip to main content")
  - ENTER (focuses on the main content of the profile page
  - TAB (focuses avatar image)
  - ENTER (displayes Select Profile Picture dialog)
  - TAB 4 times (focuses "choose a picture")
  - ENTER (displays system file open dialog)
  - Select a photo
  - The selected photo and crop-box are displayed and
    have focus
  - Use arrow keys to move the crop box around
  - Use shift-arrow keys to size the crop box
  - TAB twice to focus Save button
  - ENTER closes dialog
  - cropped image should be displayed on the profile page

change history
  - added js spec for the cropper
  - fix require_js config for react-crop

2016-12-13
  - changes needed after react-crop distribution changed
  - break CanvasCropper and CanvasCropperMaker into 2 files
    in response to code review
2016-12-16
  - update the react-crop version
  - set a min size on the cropper (so it can't go negative)
  - update css so image won't overflow its box
  - address eslint warnings
2016-12-21
  - fix merge conflict

note: the .rb file change supports the build. there is no need
      for a corresponding spec

Change-Id: I2b6dc165ed5dc2865f282c35018686dd820fea30
Reviewed-on: https://gerrit.instructure.com/97197
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2017-01-10 18:47:01 +00:00
Keith Garner ac2382661a add runtime set failure percentage based mode to canvas_timeout
Using rolling counters in redis, build up data to go into timeout
protection when the percent of failures reaches a certain level.
Also, the existing timeout protection is tweaked to use redis keys
that won't overlap with the rolling counters redis keys.

The default values for failure rate cutoff is 20%, the default minimum
samples is 100, the default rolling counter time is 60 seconds. The
default protection time is the error_ttl time.

closes CNVS-34031

test plan:
 - Ensure canvas is configured to use redis
 - In the rails console do the following:
    Setting.set('service_qatesting_timeout', 1)
    Setting.set('service_qatesting_timeout_protection_method',
                'percentage')
    Setting.set('service_qatesting_min_samples', 10)
 - The following must be completed in the rails console in under a
   minute:
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { sleep 2 }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { sleep 2 }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.timeout_protection('qatesting') { }
    Canvas.redis.ttl("service:timeouts:qatesting:percent_counter:protection_activated")
 - Note that after each 'sleep' above that an error report of type
   'service_timeout' was generated
 - Note that after 10 samples, we went into timeout protection by
   the log message of "Skipping service call due to error count: qatesting 0.2"
 - Note that the Canvas.redis call returns a number between 0 and 60

Change-Id: Id14f2c86c11ded7bb8c18ecfcf51eed2faf4df33
Reviewed-on: https://gerrit.instructure.com/97247
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-10 17:36:31 +00:00
Clay Diffrient 0ca6f62cb2 Add enzyme testing to Canvas
closes CNVS-33623

Test Plan:
  - Automated tests pass

Change-Id: I0e76082e8dfc2f695717c94819de3999dd23000a
Reviewed-on: https://gerrit.instructure.com/96510
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
2017-01-04 20:21:36 +00:00
Ryan Shaw e116bb0d90 Webpack: better handling of chunks and cdn stuff
fixes: CNVS-31779 [webpack] bundle file size
test plan:
* using webpack, look at the network panel in
  the chrome developer console.
* the total ammount of javascript loaded for any
  given page should be much less than before this commit
  and about on par with what requireJS loads for the same page.
* use chrome network panel to throttle to "Regular 3G"
* from both a clean cache and a primed cache:
* make sure that the total time to render the page
  is about on par with requireJS

first change: load webpack chunks from CDN

fixes: CNVS-32261

test plan:
* run `npm run webpack-production`
* check your page, it should load js files and chunks
  from the same hostname the page is served from.
* now set a host: in config/canvas_cdn.yml
  (for testing locally, I just set it to http://127.0.0.1:3000,
* restart rails and reload the page, now the scripts and
  chucks should come from that new hostname

second change:include fingerprints in webpack bundle and chunk filenames

closes: CNVS-28628

with this change we don't need to run `gulp rev`
after running webpack and we can load both the bundle
and chunk files safely from the cdn, since they will
have content-based fingerprints so we can tell
browsers to cache them forever. (we set those
http caching headers in lib/canvas/cdn/s3_uploader.rb:53)

test plan:
* for both dev and production
* run `npm run webpack` (or `npm run wepack-production`)
* with a cdn configured in canvas_cdn.yml, run:
  RAILS_ENV=<dev or prod> bundle exec rake canvas:cdn:upload_to_s3
* check to make sure that the page loads the webpack js,
  that there are no errors, and it all came from the cdn

third change: properly handle moment locale & timezone in webpack

test plan:
 (see application_helper_spec.rb)
 * set a non-default user timezone, context timezone
   and locale
* dates should show up in your timezone and and
  the date helper strings should be in your language

better handling of moment custom locales

closes: CNVS-33811

since we now have hatian and maori, we need to do this in
a way that is not just a one-off for maori

test plan:
* set your locale to maori
* in webpack & requireJS make sure dates show up right

Change-Id: I34dbff7d46a1047f9b459d5e1c0d141f435d42fb
Reviewed-on: https://gerrit.instructure.com/95737
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2017-01-03 22:50:31 +00:00
Neil Gupta 04fc3e586c Populate scores table migration
Fixes CNVS-33783

Test plan:

* BEFORE YOU CHECK THIS PS OUT: grade a student submission so you have
at least one score saved in the new format
* Check out this patch set.
* run rake db:migrate locally and it passes
* from rails console or in database, your Scores table is populated
  with all past grades
* Make sure none of your grades changed.

Change-Id: I1d9a1178a02c24c1b2062ab1c58dbd750fc677f7
Reviewed-on: https://gerrit.instructure.com/98222
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2016-12-29 16:59:03 +00:00
Cody Cutrer 260943e4b0 convert CDN uploader to AWS SDK v2
closes CNVS-33616

test plan:
 * configure canvas_cdn.yml
 * run rake canvas:cdn:upload_to_s3
 * it should not fail
 * ensure that assets load (especially fonts; and new assets
   that hadn't previously been in your bucket -- you might
   want to delete things)

Change-Id: I5469276d3e7c235dbfa3a8cbfb59f6f24daae192
Reviewed-on: https://gerrit.instructure.com/93007
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-12-19 23:43:06 +00:00
Brent Burgoyne c64dded173 add js helper to parse number string for locale
also includes a helper to validate number strings for current locale

closes CNVS-33191

test plan:
- NA (a future commit demonstrating the use of the helper with be
  qa-able)

Change-Id: I1722aad263e611d127317b2f1a3832537742c3fb
Reviewed-on: https://gerrit.instructure.com/96677
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2016-12-13 22:42:18 +00:00
Jacob Fugal 5582a4bf06 always use global ids in live events
test-plan:
 - have live events enabled (see doc/live_events.md)
 - tail the live events stream (see same doc)
 - create a course; emitted course_created event should have global IDs
 - enroll a new user in the course; emitted user_created,
   user_account_association_created, enrollment_created, and
   enrollment_state_created events should all have global IDs
 - create an account notification; emitted account_notification_created
   event should have a global ID

Change-Id: Ib127a3bd2c88d607efdf0063857a9873e78e9483
Reviewed-on: https://gerrit.instructure.com/97358
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2016-12-12 22:26:20 +00:00
Simon Williams f5b4d32c73 fix AWS::S3 namespacing issue
we added a Canvas::AWS module, so if that gets loaded first, this
instance got confused

fixes CNVS-33806

test plan:
- Load the new module: `Canvas::AWS.validate_v2_config`
- Load the cdn uploader: `Canvas::Cdn::S3Uploader.new`
- it should work

Change-Id: I71bb61c0ca2f1c9784a8bf5c458455ab60dddd20
Reviewed-on: https://gerrit.instructure.com/97322
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2016-12-11 22:54:17 +00:00
Cody Cutrer 8e73a20892 rip out old, unused error report send to email
instead, use the newer TicketingSystem email and HTTP POST connectors

Change-Id: Id1fd2e76754acc31e81042888000fe983d49975e
Reviewed-on: https://gerrit.instructure.com/96964
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-12-08 01:25:10 +00:00
James Williams 85ce1a971d master courses - use new shard-aware migration ids
maybe this is totally overkill but whatever
it'll put my mind at ease about conflicts in the future

also we can hack this later if we want to make
content exports for future courses shard-aware too

Change-Id: I1568e47ec1037d6e7554e7ccb0ea80965842db49
Reviewed-on: https://gerrit.instructure.com/96482
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-12-05 16:15:54 +00:00
Cody Cutrer 95e2683ed9 Revert "lower minimum password length back to 6"
This reverts commit 8ffc3e6b10.

Fixes CNVS-33569

Change-Id: Ifc8af3e95fe09237210dc96944c2d8d6bc9e1d7a
Reviewed-on: https://gerrit.instructure.com/96274
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-12-02 16:20:44 +00:00
Tyler Pickett 1dcab9d724 Add LTI external content import functionality
Change-Id: Ib5a52bba96ef9a322e68ba9575ac33fb78965d21
Refs: PLAT-1759 PLAT-1760
Reviewed-on: https://gerrit.instructure.com/94943
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2016-12-01 21:32:58 +00:00
Colleen Palmer e84bd4dd80 Revert and bring InstIcons into Canvas
closes: CNVS-32953

This commit re-introduces Instructure Icons into Canvas.
Due to the range in aesthetic impact of including both line
and solid icons, the change is expansive and will be refined
in subsequent commits. The purpose of this commit is to:

- Make InstIcons available in Canvas allowing the use of the
  react components

- Replace the current icon font with the new InstIcons font

- Allow for use of both 'Line' and 'Solid' icon variants

- Update the styleguide to reference the InstIcons github
  documentation for examples

- Remove font custom from Canvas

Icons changed to line versions in Canvas:
- icon-compose (view on Dashboard card)
- icon-info (view on global notification)

- Updated icons to be larger for better visibility
  (our old font was using a small font size)

- Updated font-size is now relative vs fixed, so better a11y

Test Plan:

- On compiling, icons in Canvas should now be changed to the
  corresponding Instructure Icons as can be seen here
  http://instructure.github.io/instructure-icons/

- The icon default displaying in Canvas should be solid icons.
  If the variant "icon-Line" is added to an icon's css class,
  it should display as line. For example, in the case of
  <i class="icon-edit"></i>, adding
  <i class="icon-edit icon-Line"></i> would result in a line
  version of the edit icon displaying

- As a developer, you should be able to use InstUI react icons

- The rake task `bundle exec rake icons:compile` should no
  longer exist

- The styleguide should no longer display example icons, but
  should now include a link to the Instructure Icons github
  documentation

Change-Id: I9780332de9fdf937b35caabadc2b2ee615892a43
Reviewed-on: https://gerrit.instructure.com/94175
Reviewed-by: Pam Hiett <phiett@instructure.com>
QA-Review: Dan Sasaki
Tested-by: Jenkins
Product-Review: Kyle Follett <kfollett@instructure.com>
2016-11-29 20:52:54 +00:00
Jonathan Featherstone 2cb8db1983 Add course_created and course_updated live events
Test Plan:
  * Set up Kinesis locally (see doc/live_events.md for details)
  * Create a new course, verify that 'course_created' event is sent to
    kinesis stream
  * Modify existing course, verify that 'course_modified' is sent to
    kinesis stream

refs CNVS-30242

Change-Id: I8b0b27110cc3fd03ee21d27a56aad14b52071a3c
Reviewed-on: https://gerrit.instructure.com/95709
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2016-11-28 20:56:02 +00:00
Jonathan Featherstone 818ae22138 Add user_created and user_updated live events
Test Plan:
* Set up Kinesis locally (see doc/live_events.md for details)
* Create a new user, verify that 'user_created' event is sent to kinesis
  stream
* Modify existing user, verify that 'user_modified' is sent to kinesis
  stream

refs CNVS-30242

Change-Id: I827f63b5106abec17810f4dc9a700277d7550254
Reviewed-on: https://gerrit.instructure.com/95204
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2016-11-28 20:55:53 +00:00
James Williams 7e6ca5ce5c master courses: 1-to-many migration proof of concept
implements framework for master course migrations
adapts course exports to go straight to the intermediate json
and allows multiple imports to derive from it

only does full exports at the moment

closes #MC-11

Change-Id: I135e55a4d0ec159edc3055daee6c15a69db75f84
Reviewed-on: https://gerrit.instructure.com/95849
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-11-22 20:46:19 +00:00
Cody Cutrer abed5fc15c a few minor Rails 5 fixes
Change-Id: I6236c2bc4ce31fbcf501dcf16ad537e56a2a555a
Reviewed-on: https://gerrit.instructure.com/95674
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-11-21 17:23:15 +00:00
Clay Diffrient 188b711641 spec: Clean up unnecessary ajax requests in tests
This commit also cleans things up a bit to make things more inline
with our current JS style preferences.

Test Plan:
  - Specs pass

Change-Id: Idf1af11b4283844017552df62963a7740bb7f609
Reviewed-on: https://gerrit.instructure.com/95637
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
2016-11-21 15:30:15 +00:00
Clay Diffrient 56019ec813 Make dashcards reorder on drag and drop
NOTE: This commit does not make it so that the data
            persists after refreshes.

closes CNVS-32548

Test Plan:
  - Enable dashboard card reordering feature flag
  - Go to a dashboard with multiple dashcards
  - You should be able to move them around via drag
    and drop.

Change-Id: I66b91b30fd619516558841a6867ef857a33b890a
Reviewed-on: https://gerrit.instructure.com/92616
Reviewed-by: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2016-11-18 01:07:15 +00:00
James Williams 2463a92ec5 try to not break redis when loading before rails
Change-Id: Ifa332ef31d52959ee7e2dcbf2aa82e4a8b9cb2ea
Reviewed-on: https://gerrit.instructure.com/95046
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-11-15 19:46:29 +00:00
Jeremy Neander d0aa529dc6 purge performance gradebook
This removes the ill-fated React Gradebook.

This commit is effectively a revert of
b9534edd64

closes CNVS-32394

test plan:
* ensure 'Gradebook Performance' is no longer available
* ensure other Gradebooks are still functional
    * Default Gradebook basic happy path
    * Individual Gradebook (SRGB) basic happy path

Change-Id: Ie71ab4dfb17f494c2a7c17a27cd551a84e7efb96
Reviewed-on: https://gerrit.instructure.com/94005
Tested-by: Jenkins
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-11-09 20:05:17 +00:00