Commit Graph

45 Commits

Author SHA1 Message Date
Cody Cutrer 06a2c9df42 spec: remove manual requires of spec_helper
[skip-stages=Flakey]

Change-Id: Id65c835b72e1c0a4bb825b58490ce0ff7c8d9873
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276829
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-26 20:38:27 +00:00
Cody Cutrer 6b0095610c RuboCop: Layout spec
[skip-stages=Flakey]

Change-Id: Id479617328562fd009f00db27f248c2ebafa4b7a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274151
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2021-09-22 22:40:24 +00:00
Angela Gomba a4f2b10532 Add OutcomeFriendlyDescription live events to Canvas
closes OUT-4695
flag=none

test plan:
- ensure live events are running locally (see live_events.md)
- verify that when making changes (including soft deleting) or
 creating an outcome friendly description that live events are emitted

Change-Id: I98ae5aeda1e16e1816f7d63a6a82f777a2766ae0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272071
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-08-30 15:48:59 +00:00
Jeremy Stanley e9271f8886 revert overridden_requirements_met in course completion live events
this was kind of a shot in the dark and it didn't fix the problem.
we have decided to take a different approach.

test plan:
 - smoke test course completion live events
   (course progress event should be sent when a module is
    completed, and course completion event should be sent
    when the last module is completed)

this reverts commits 0b113807a7
and 60c6abb547

flag=none
refs LS-1967

Change-Id: Icee1eff0ddb94b8e7cd9c1edfbfffea867e2d419
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260141
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-10 23:20:49 +00:00
Cody Cutrer f2a9c756f1 update to inst-jobs 1.0 via shims
Change-Id: Id39b1e8d3bebcc0f9b7ded920b450f275565f708
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250923
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 13:46:49 +00:00
Cody Cutrer 81d0bbc465 add # frozen_string_literal: true for specs
Change-Id: Id508bec1817937b1c24c29f1db7221e09cb9c2ab
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251157
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:48:35 +00:00
James Williams 0b113807a7 pass course completion overridden requirements to live event
closes #LS-1555

Change-Id: I24cf5f741f08194b78cf8ac3c674fd9793e03977
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250427
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-10-23 14:52:36 +00:00
Pat Renner 6d85448a45 add live_events for outcome_calculation_method
closes OUT-3999
flag=none

test-plan:
- ensure live events are running locally (see live_events.md)
- verify that when making changes (including soft deleting) or
 creating an outcome calculation method that live events are emitted

Change-Id: I715305dc3cd8dc1cab127033d1feb92acd28f948
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250457
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Manoel Quirino <manoel.quirino@instructure.com>
Product-Review: Jody Sailor
2020-10-21 22:19:53 +00:00
Cody Cutrer 934e10af14 rails 6: various fixes for controller specs
Change-Id: I93b6470bda86efc324d3fe0704d271813c49d6dc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250497
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-21 20:00:05 +00:00
Evan Battaglia 3dea2c1c3f make submission_created emit only on actual submissions
Normally submissions are created in raw SQL so the after_create hook is
not fired but there are some cases where this is not the case: in these
weird edge cases, submission_created is also fired when we create
Submission records with ActiveRecord so the after_create hooks fire.  We
don't understand exactly what they are but they are a very small
proportion (about 0.15% of total submission_created events) and no one
cares about them.

This also adds "workflow_state" to the event body, and DRYs up some
specs.

closes INTEROP-6224
flag=none

Test plan:
- Run canvas with the environment variable STUB_LIVE_EVENTS_KINESIS=1
  e.g.:
    dcr -e STUB_LIVE_EVENTS_KINESIS=1 -u 0 web \
    bundle exec rails server --binding='0.0.0.0' -p 80
- create assignments and make submissions for students in the following
  ways, making sure the submission_created event is emitted (it will
  be in the Canvas STDOUT, you might have to search for it) only when the
  student (or API call in some cases) submits or resubmits:
  - Student submits through UI.
  - Student re-submits through UI.
  - Done through API (?) Something like
    /api/v1/courses/123/assignments/12345/submissions/1234 ?
  - Grade passback (?)
  - AGS (?)
- Make sure a submission_created event has the "workflow_state" in it.
- In a console, create a Submission with Submission.create! in a
  unt push gerrit
  submitted state and make sure the event does not fire.
- In a console, create a Submission with Submission.create! in a
  submitted state and make sure the event does fire (you must provide
  workflow_state: submitted, and a submission_type such as
  online_text_entry)

Change-Id: I92b1c595282bf498557b7e52660547cc624795ac
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249769
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Product-Review: Oxana Jurosevic
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
2020-10-13 20:53:47 +00:00
Pat Renner 618899e064 add live events for outcome_proficiency
closes OUT-3867
flag=none

test-plan:
- ensure live events are running locally (see live_events.md)
- verify that when making changes (including soft deleting) or
 creating an outcome proficiency that live events are emitted
- verify that ratings information is included in the proficiency payload

(cherry picked from commit 0f0edc8cbe)

Change-Id: Iee0a98666354fc6e375757d63a1bbf22cdff973e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245081
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Michael Brewer-Davis <mbd@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2020-08-20 17:29:48 +00:00
Pat Renner 6f0326392e Revert "add live events for outcome_proficiency"
This reverts commit 0f0edc8cbe.

Reason for revert: merged prematurely, depends on code in g/244166

Change-Id: I49b623197354bf5c39cb3f6829b2dea72118e890
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244037
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-13 18:34:07 +00:00
Pat Renner 0f0edc8cbe add live events for outcome_proficiency
closes OUT-3867
flag=none

test-plan:
- ensure live events are running locally (see live_events.md)
- verify that when making changes (including soft deleting) or
 creating an outcome proficiency that live events are emitted
- verify that ratings information is included in the proficiency payload

Change-Id: I0e6603896b6a08b7a6ea1050c742e5ff3a9b3b2f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244793
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-13 17:31:34 +00:00
James Williams bba993c804 remove old conditional release service caching
and the after_saves that are clearing unused cache keys

closes #LS-1296

Change-Id: Ida24905e39a1e8a61c875ca10116e799e0718c85
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-08-10 13:26:32 +00:00
Michelle Truong b5f9082b5d Add conversation message created live event
refs PFS-15497
flag = none

Test plan:
1. create a new conversation on canvas with another user
2. create a new message in the conversation by replying
3. verify live event for conversation_message_created has been triggered

Change-Id: Idf929eb5398f6040d8a3e45c644481b207858042
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/232152
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Dan Dickson <ddickson@instructure.com>
QA-Review: Aiona Rae Hernandez <ahernandez@instructure.com>
Reviewed-by: Sean Mikkelsen <smikkelsen@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2020-04-07 19:30:23 +00:00
Michelle Truong 744edda428 Add conversation created live event.
refs PFS-15495
flag = none

test plan:
1. create a new conversation on canvas with another user
2. verify live event for conversation_created has been triggered

Change-Id: Ice2c239b90318588a2e5fe68ac0db289ff591a94
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/231746
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Dan Dickson <ddickson@instructure.com>
2020-04-03 16:36:41 +00:00
James Williams 60c6abb547 use more reliable requirements_met when firing live events
test plan:
* module completion live events should still work

Change-Id: I9bc30f31ad1f4351d708fff36d10e7afe2bb4f36
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/226578
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-02-19 21:04:17 +00:00
Ethan Knapp 9312726174 add live events for assignment overrides
refs PFS-12035, PFS-12662

Change-Id: Ic6dd9d58ecf456256b62212d4f8d7ec37312b449
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/199749
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Tanner <ctanner@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Ethan Knapp <eknapp@instructure.com>
2020-01-10 21:38:13 +00:00
Michael Brewer-Davis 4b9fbc79ec add live events for outcomes editing
refs OUT-3177

Test plan:
- set env var for jobs container/BASE in
  docker-compose.override.yml
    STUB_LIVE_EVENTS_KINESIS: "true"
    (see live_events.md)
- at canvas.docker/plugins/live_events
  - uncheck "Disable this plugin"
  - add anything to fields
  - Apply
- tail Canvas containers for stubbed events
  > docker-compose logs -f | grep stubbed_kinesis_stream
- verify that the following live events are seen and have
  reasonable data:
  learning_outcome_created
    - when outcome created manually or via csv
  learning_outcome_updated
    - when outcome edited or deleted (in original context)
       manually or via csv
  learning_outcome_group_created
    - when created manually, via import from account,
      or via import from csv
  learning_outcome_group_updated
    - when group edited or deleted manually or via csv
  learning_outcome_link_created
    - when outcome created manually or via csv
    - when outcome imported from account
  learning_outcome_link_updated
    - when outcome moved or deleted manually or via
      csv

Change-Id: I70a62617f745b884951d22f2cb29c0178f283c12
Reviewed-on: https://gerrit.instructure.com/211460
Tested-by: Jenkins
Reviewed-by: Frank Murphy III <fmurphy@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Oxana Jurosevic
2019-10-02 19:46:47 +00:00
Nick Pitrak 8817e8ad94 add course completion live event
closes CAT-2293

test plan:
- add `:docker-compose/kinesis.override.yml` to your .env file
- do docker-compose up
- in another terminal window, type `AWS_ACCESS_KEY_ID=key
		AWS_SECRET_ACCESS_KEY=secret aws --endpoint-url
		http://kinesis.canvaslms.docker/ kinesis create-stream
		--stream-name=live-events --shard-count=1 --region=us-east-1`
- go to canvas.docker/plugins
- find the Live Events plugin
- select All Accounts and click Create Config
- deselect the Disable this Plugin checkbox
- enter the following information and save:
		Kinesis Stream Name	live-events
		AWS Region	us-east-1
		AWS Endpoint	http://kinesis:4567
		AWS Access Key ID	key
		AWS Secret Access Key	secret
- close and reopen docker-compose up
- create a course with a single student enrolled
- create an assignment with web text entry worth 10 points in a module
- create a requirement for the module to earn 10/10 on the assignment
- masquerade as the student
- submit the assignment
- stop masquerading
- type `docker-compose run --rm web script/tail_kinesis
		http://kinesis:4567 live-events` in another terminal window
- grade the assignment as a 10/10 for the student
- ensure an event appears with its event_name as "course_completed"

Change-Id: Iffd5d6148fadcb66da3f8eca3a4caa9355485a90
Reviewed-on: https://gerrit.instructure.com/161106
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2018-08-28 22:09:46 +00:00
Han Yan f9676125bb Qti import from Canvas to Quizzes.Next
refs QUIZ-4415

test plan:
- cr
- Quiz.Next CC import is not ready for test with only this patch
- regression on `Import Content`, to make sure:
  1) `Qti .zip file` import works
  2) `Common Catridge 1.x Package` import works

Change-Id: Iba2818a2b864020b6c59ef55e02f122b996e4c40
Reviewed-on: https://gerrit.instructure.com/149978
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Han Yan <hyan@instructure.com>
2018-05-31 16:57:32 +00:00
Nate Collings 83a24b8a08 add Module and ModuleItem live events
Test plan:

- Merge and warmfix onto beta
- Configure our EventManager Kinesis stream
  to listen to the Module and ModuleItem
  live events
- Create a Module and a ModuleItem and
  validate that the events were sent
- Update a Module and a ModuleItem and
  validate that the events were sent

refs SKUNK-17, SKUNK-18

Change-Id: Ia047024b0f5d38e5c14a19194f75b131f9fc68cc
Reviewed-on: https://gerrit.instructure.com/146858
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
Product-Review: Nate Collings <ncollings@instructure.com>
QA-Review: Nate Collings <ncollings@instructure.com>
2018-04-23 15:12:55 +00:00
Jonathan Featherstone 89e7d3eda7 Add `sis_batch_id` to NOP fields for update
`sis_batch_id` is updated even when no other field is changed on a sis
batch import. Add `sis_batch_id` to the list of fields that will not
trigger a live-events stream update.

Test Plan:
  * Specs

closes RECNVS-239

Change-Id: I15f0b82dbbe1dc47885d3f2ce05932ba66f96c97
Reviewed-on: https://gerrit.instructure.com/137963
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2018-01-15 22:08:29 +00:00
Han Yan f1bb548d7c Quizzes Next Feature Flag support
closes QUIZ-203, closes QUIZ-3434

test plan:
  case 1: when a root account is not provisioned by uuid provisioiner
  - 'Quiz Next' feature flag is not visible in root account, sub
    accounts and courses

  case 2: when a root account is provisioned by uuid provisioiner
  - should see 'Quiz Next' feature flag in root account
  - when the FF in root account is turned to On, all courses have access
    to Quizzes.Next (Quiz Migration and Easy button)
  - when the FF is off, all courses don't have access to Quizzes.Next
  - when the FF is allowed, subaccounts and courses should have options
    to turn Quizzes.Next On or Off

Change-Id: Ib41ce2db9943151f47ad42a676d29b744c381799
Reviewed-on: https://gerrit.instructure.com/135805
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2018-01-11 22:39:42 +00:00
Jonathan Featherstone 6966bdbebd Add check for change before publishing live-event
This change adds a check to the `after_update` callback to make sure
that actual update has happened. This change is in response to a flood
of `user_updated` events being written to the live-events stream from a
SIS integration that was posting updated user records to the API even
though no actual change of user data had occurred.

Test Plan:
  * Follow instructions in `doc/live_events.md` to get live events setup
  * Create a user record in local canvas UI
  * Generate an API token for local canvas UI
  * Use simple script below to PUT user same user record data
  * Confirm that live event record was not written using `tail_kinesis`
    script:
`docker-compose run --rm web script/tail_kinesis http://kinesis:4567 live-events`

Sample

```
const axios = require("axios");

const canvasBaseUrl = "http://canvas.docker";
const canvasAccessToken = "<TOKEN>"

axios.defaults.baseURL = canvasBaseUrl;
axios.defaults.headers.common.Authorization = `Bearer ${canvasAccessToken}`;

// Change ID and data below to match test record
axios
  .put(`/api/v1/users/<ID>`, {
    user: {
      name: "Test User",
      short_name: "Test User",
      email: "test@example.com",
      time_zone: "Mountain Time (US & Canada)"
    }
  })
  .catch(err => console.log(err))
  .then(res => console.log(res.statusText));
```

refs RECNVS-75
closes CORE-73

Change-Id: I89326df5ef77e28fcdebf5b3085cc8bacddf0104
Reviewed-on: https://gerrit.instructure.com/133560
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2017-11-30 18:14:26 +00:00
Cody Cutrer 69b7bf7876 spec: mocha => rspec-mocks for observers
Change-Id: Icade3fa6ea8945578392b12b14baaea11f20324c
Reviewed-on: https://gerrit.instructure.com/120511
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-07-26 00:22:26 +00:00
Landon Wilkins 242581edd3 da licença part 48
add consistent license headers to all source files

Change-Id: Ib581cddb21430cf4971aeb14980727c2935e31e4
Reviewed-on: https://gerrit.instructure.com/110154
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-28 18:59:33 +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
Hannah Bottalla 850f136839 Extend content_export_complete live event with a qti export
closes: QUIZ-1389

test plan:
pre-reqs: quizzes2 feature enabled, course and quiz made,
kinesis stream setup (doc/live_events.md)
1. on the quiz index page, select "migrate" for the quiz
2. verify you see output in the kinesis stream
3. verify you see the authenticated s3 url in the payload

Change-Id: Iae1d3cd9675b9445ee0036093b2891f2d921a5ba
Reviewed-on: https://gerrit.instructure.com/104554
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Omar Khan <okhan@instructure.com>
Product-Review: Jayce Higgins <jhiggins@instructure.com>
2017-03-15 15:10:22 +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
Simon Williams 57497719a7 spec: rename the `course` helper to `course_factory`
closes CNVS-34046

test plan: specs should pass

Change-Id: I8684d30e5af7be04566b2d3903db2b7f4b14b24b
Reviewed-on: https://gerrit.instructure.com/98439
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:29 +00:00
Michael Brewer-Davis 82a6c7c1c2 clear cyoe cache on any assignment save
closes: CYOE-389

Test plan:
1.  Create a rule with student choice
2.  Score a student in a range with choice
3.  As student, view choice page
4.  As teacher, update the choice to add or remove
    options
5.  As student, review choice page
    The options should have been updated

Change-Id: Ibb48085a8e3fa7cb2eed2f659e50ab3adb238b92
Reviewed-on: https://gerrit.instructure.com/95298
Reviewed-by: Christian Prescott <cprescott@instructure.com>
Tested-by: Jenkins
QA-Review: Alex Ortiz-Rosado <aortiz@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2016-12-02 15:53:03 +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
Cameron Sutter b46d6e3bb3 fire global announcement live events
closes MBL-6063

test plan:
- I'm not sure how these things are tested, but
- create an account notification
- check that a live event was fired off

Change-Id: I2d041183fc4da859a9c7f2ab9a28f1572a02ccfb
Reviewed-on: https://gerrit.instructure.com/93222
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2016-10-28 22:15:57 +00:00
Michael Brewer-Davis 02964503b9 add functionality to get rules affecting an assignment
refs: CYOE-324

Test plan:
Solely an internal API, though can be tested from the
rails console:

1.  Ensure cyoe config
2.  For an assignment, call
  ConditionalRelease::Service.rule_triggered_by( a, user )
and you should receive back the rule if it exists (nil otherwise)
Call
  ConditionalRelease::Service.rules_assigning( a, user )
and you should get back the rules that assign `a`
Call
  ConditionalRelease::Service.is_trigger/(a, user)
and you should get back a boolean if rule_triggered_by would return a
rule

Change-Id: I877775c2a7b53a0cd786734bed41ab7398fcdb67
Reviewed-on: https://gerrit.instructure.com/91091
Reviewed-by: Christian Prescott <cprescott@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2016-10-06 18:51:07 +00:00
Christian Prescott fbbb07f388 Formalize WikiPage soft delete
refs CYOE-123

WikiPagesApiController already soft deletes pages, by updating
workflow_state manually. Overrides WikiPage#destroy to soft delete page
and associated objects.

Test Plan
1. Create a wiki page. Delete it.
2. In a Rails console, find the WikiPage and restore it.
   `WikiPage.last.restore`
3. Ensure the page is available in the app again.
4. With MP flag enabled, do the same for a "mastery paths content" page.
   Ensure the restored page appears in pages and assignments lists.
5. With an MP page, find the page's Assignment in the console and
   restore it. Should restore like 3.
6. Restoring a page that was in a module should not reappear in the
   module, but otherwise the page+assignment should restore like 3.

Change-Id: I4148f7ca0127ed2625a27059f918e64724cf2705
Reviewed-on: https://gerrit.instructure.com/90332
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-09-21 15:58:27 +00:00
Kacey Roberts 9f2419ec19 New Observer for when a Enrollment is modified for live envents
fixes: PFS-5114

test case:
- Update a enrollment and verify that it fires the event message
- Create a enrollment and verify the create event is still fired.

Change-Id: I2f5b45a2b766c6fc8dcc7dac27924b476c07cf32
Reviewed-on: https://gerrit.instructure.com/87560
Reviewed-by: Cody Tanner <ctanner@instructure.com>
Reviewed-by: Andrew Huff <ahuff@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Brandon Broschinsky <brandonbr@instructure.com>
2016-08-30 15:53:29 +00:00
Dan Minkevitch bdfa3a3906 Include CYOE data in Modules API
closes CYOE-239
closes CYOE-270

Test Plan:
* Prerequisites: CYOE-240 deployed on CYOE testing
  environment (if not already merged).
* Create a module with various module items that have
  conditional content/mastery paths data associated
  with them (e.g. assignment sets in scoring ranges
  with associated assignments)
* Make a Canvas API request to the List Module Items
  endpoint, adding `mastery_paths` to the `includes`
  parameter as part of the call
* The response should include the mastery paths data
  for the requested module items

Change-Id: I7f5f37ea10b1b37d8dc81bd54b1a9413f8bbbc05
Reviewed-on: https://gerrit.instructure.com/86868
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-08-25 22:17:01 +00:00
Andrew Huff 3983e8da1c add Enrollment + UserAccountAssociation kinesis live events
Adds kinesis events for enrollment create and
user_account_association create.

Adds missing specs for kinesis events

Test Plan:
* Set up Kinesis locally (see doc/live_events.md for instructions)
* Create an enrollment; verify that a `enrollment_created` event is sent
  to kinesis (use the `script/tail_kinesis` tool to view kinesis events)
* Reigster a new user; verify that a `user_account_association_created`
  event is sent to kinesis with `is_admin: false`
* Reigster a new admin; verify that a `user_account_association_created`
  event is sent to kinesis with `is_admin: true`

refs CNVS-30241
refs CNVS-30242

Change-Id: If1a4a2f415b95cc78a177a7cef75fbb03808dce1
Reviewed-on: https://gerrit.instructure.com/84339
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Andrew Huff <ahuff@instructure.com>
2016-08-07 17:39:06 +00:00
Matt Smith 6ba9c9242d added live events for assignments and submissions
* issueid: DS-595
* test plan:
  * create assignment and submission
  * update assignment and submission
  * ensure appropriate messages are in the kinesis queue

Change-Id: I0d7730c8a4ec01f780ae3b77581efb7b48c2733e
Reviewed-on: https://gerrit.instructure.com/68362
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Linda Feng <lfeng@instructure.com>
2015-12-18 21:41:50 +00:00
Zach Wily 5d232f03af initial live events implementation
This commit adds a new module called LiveEvents that knows how to send a
certain set of events to Kinesis. The module is configured via
normal plugin settings per account. Once the plugin is configured with
a Kinesis stream, events will start getting sent to that stream.

Events are sent asynchronously, in a background thread.

test plan:
 * See `doc/live_events.md` for instructions on how to setup a local
   kinesis stream and configure the LiveEvents plugin.
 * Start tailing the stream with the command specified in
   `doc/live_events.md` in a terminal.
 * Perform the actions described in `doc/api/live_events.md` and verify
   that events show up in your Kinesis terminal with the correct data.

Change-Id: Id799688c972205a1eee84a673912f84b0c7abb57
Reviewed-on: https://gerrit.instructure.com/50324
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Product-Review: Zach Wily <zach@instructure.com>
2015-04-03 15:22:33 +00:00
Cody Cutrer 3cf156f051 rspec 3-ify spec/observers
refs CNVS-16239

Change-Id: I302fc5190effeec8bfff59689a96d4862227a78f
Reviewed-on: https://gerrit.instructure.com/42669
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Paul Hinze <paulh@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Braden Anderson <braden@instructure.com>
2014-10-13 23:13:05 +00:00
Cody Cutrer bdbeeb992d cross shard dashboards
two major pieces:
 * use context_type/context_id instead of context_code for
   three relations so that sharding extensions will
   automatically work
 * deserialize stream item data as actual AR objects instead
   of OpenObject (for similar reasons)

test plan:
 * run the predeploy migration, but not the postdeploy one
 * view your dashboard on a shard other than your home shard;
   it should be identical to your home shard
 * view courses that you are enrolled in with the same id but on
   different shards. the activity stream should have the correct
   data for the course in that shard, for both courses (i.e.
   no mixing of data from the two shards)
 * do actions that generate new stream items, and verify the new
   items appear correctly for the above two steps
 * run the postdeploy migration, wait for the job to finish, then
   repeat the test plan

Change-Id: I8d5fcadb8d971acf7388a12e9151a3e927751f44
Reviewed-on: https://gerrit.instructure.com/15462
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-29 17:36:24 -07:00
Joe Tanner 5e4d2787dd dashboard caching of recent_stream_items, closes #11396
Change-Id: Ib84785c76addc15734162560e6a9de352aa7618f
Reviewed-on: https://gerrit.instructure.com/14998
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-11 21:56:28 -07:00