Commit Graph

332 Commits

Author SHA1 Message Date
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
Eric Saupe 70b08f119d Add pace plan controller actions
fixes LS-2427, LS-2429
flag=pace_plans

test plan:
 - Sending a POST request to /api/v1/courses/:course_id/pace_plans
creates a pace plan
 - Sending a GET request to /api/v1/courses/:course_id/pace_plans/:id
returns the pace plan
 - Sending a PUT/PATCH request to
/api/v1/courses/:course_id/pace_plans/:id updates the pace plan

Change-Id: I9134e32bf0df2550d1e8d09c907f3429b70a59c7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272216
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
2021-08-30 16:53:44 +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
Cody Cutrer c9d70612a2 don't use asset strings for querying assignments
Change-Id: Id3ab3842435ac715711f73f7b7fde260b8785d1e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271480
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-08-20 21:55:35 +00:00
Cody Cutrer 47885838c2 make timestamps NOT NULL on lots more tables
Change-Id: Ib7bb4968d1064bc7ead98de97be7e3a0a46d1509
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271662
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: August Thornton <august@instructure.com>
2021-08-19 20:29:57 +00:00
Cody Cutrer 0847dc9670 allow suspending pseudonyms
where suspending means they still show up everywhere, but the user is no longer
allowed to login

closes FOO-2039

test plan:
 * have a regular user with an access token, and an active session
 * (via a separate session or access token) suspend a pseudonym
   via the API as an admin (logins API, set workflow_state to
   suspended)
 * ensure the original user gets logged out when they refresh, and
   that their access token doesn't work
 * but as the admin, you can still see the user

Change-Id: Idc0c61bcc244697e3c89b9beb2edfbe2a504b00e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269878
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-16 19:40:52 +00:00
Cody Cutrer f5d0cc64bc add failsafe option for DynamicSettings
so that we're not re-implementing it at multiple callsites

also remove unused error classes

Change-Id: I938d705729f2208532b4522eddbc8edfa4f2031f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269561
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-02 18:27:59 +00:00
Evan Battaglia 4ee444f135 MSFT sync job: add integration_id as lookup option
Also fixes a bug where users in a course that had a null value for the
login attribute (SIS id is the one case I know of for sure) would make
UsersUlvsFinder crash.

closes INTEROP-6927
flag=microsoft_group_enrollments_syncing

Test plan:
- have a course with user(s) with pseudonym(s) with an integration id
  equal to the UPN (or email) of remote users in our test tenant
- set the root account micrososft_sync_login_attribute setting to
  "integration_id"
- clear the UserMapping table if necessary, and run a sync for the
  course
- check in the Microsoft admin console, the user(s) should be in the
  team there
- on one of the users, set the "integration_id" field on the pseudonym
  to null, e.g.
    my_pseudonym.update integration_id: nil
- clear the UserMapping table again
- run a sync. the sync should run successfully and the user should not
  be in the Microsoft team anymore. (or, if there are now no teachers
  with mappings, the job will actually fail saying a group can't have
  no owners)

Change-Id: I15d571a663247af4db60b55298ecbbd299a320a6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269672
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-07-26 23:28:40 +00:00
Manoel Quirino Neto 63bea65860 Add import outcome API
flag = improved_outcomes_management
closes OUT-4153

Test Plan:

- Setup some global outcomes
- Execute some queries in the /graphiql
- Import a whole group from global outcomes to account
mutation ImportOutcomes {
  importOutcomes(input: {
    contextId: ACCOUNT_ID,
    contextType: "Account",
    groupId: GROUP_ID
  }) {
    errors {
      attribute
      message
    }
    progress {
      id
    }
  }
}
- Import a whole group from account to course
mutation ImportOutcomes {
  importOutcomes(input: {
    contextId: COURSE_ID,
    contextType: "Course",
    sourceContextId: ACCOUNT_ID,
    sourceContextType: "Account",
    groupId: GROUP_ID
  }) {
    errors {
      attribute
      message
    }
    progress {
      id
    }
  }
}
- Try to import some outcomes replacing groupId to
  outcomeIds: [OUTCOME_ID_1, OUTCOME_ID_2, ... OUTCOME_ID_N]
- You can import outcomes that belongs to differents subgroups,
  but they must have at least one common parent group
- The response must be an empty object in case of success,
  check the ui to see if the groups were imported correctly.

Change-Id: I586fcbce9ccf33db956ff5ef57903bb3f5d7f30b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259131
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Chrystal Langston <chrystal.langston@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-06-30 16:58:36 +00:00
Rob Orton cdc665d636 spec: publish course before the tests
Change-Id: Ie9ef4ee98d8d8fdec8de95739549f8cd3ab399fe
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265845
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-05-26 22:24:49 +00:00
Cody Cutrer 412e9f8ad3 more prep for root_account_id=0
refs FOO-1693

Change-Id: Ie12fc99703aa6aaebdff0828bf4aaa13179ef7c4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265810
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-05-26 17:34:48 +00:00
Pat Renner 9ffa3b5452 destroy LORs when a quiz changes from an assignment
closes OUT-4286
flag=none

test-plan:
- create a question & question bank with an outcome aligned to it
- align the question bank to a new quiz and publish the quiz
- take the quiz as a student
- verify you have a learning outcome result record for the student
- edit the quiz type to be a "practice quiz"
- verify the learning outcome result was soft deleted
- verify the result doesn't appear in the SLMGB
- change the quiz type back to assignment
- verify the result appears in the SLMGB

Change-Id: Ia17360a1ac4508590a19154e824f60194972eff6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263504
Product-Review: Augusto Callejas <acallejas@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-04-28 16:53:55 +00:00
Pat Renner e625d0828e add comment_bank_item type to graphql
flag=assignment_comment_library

refs EVAL-1559

test-plan:
- Create a record using for a specific user
within the rails console:
CommentBankItem.create!(comment:'comment#1!',
user: user, course: Course.first)
- after logging in to canvas locally with that
user, visit /graphiql
- run the following query (replace "course-id"
with the course id used above)
query MyQuery {
  course(id: "course-id") {
    commentBankItemsConnection {
      nodes {
        comment
        _id
      }
    }
  }
}
- verify the record that was created above is returned

Change-Id: Ief5fbfced28c785cbe8ad10e04eca04945d325e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262213
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Manoel Quirino <manoel.quirino@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-04-20 18:57:56 +00:00
Michael Ziwisky 247d91a4d7 Set up replica identity index for EnrollmentState
also moves the RootAccountResolver specs out of enrollment_state_spec.rb
and into a more generic root_account_resolver_spec.rb

refs FOO-1171
flag=none

test plan:
 - migration works up and down
 - tests pass

Change-Id: Ia3ee89d63974e4c787ca8d1c6ab80eba5f54beb4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260526
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-03-29 16:59:02 +00:00
Mauricio Salles e2f3833d85 implements the discussion entry type for graphql
new graphql type for DiscussionEntry model

fixes VICE-1193

flag=none

Test Plan:
   - See the new type on graphiql
   - Make a query for DiscussionEntry with no errors

qa risk=low

Change-Id: I1a58e629a816ecd838eaaa043ec9a6c2dd01e7c9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261335
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
2021-03-25 18:36:36 +00:00
Michael Ziwisky 7ab57265c9 Set up replica identity index for UserAccountAssociation
refs FOO-1171
flag=none

test plan:
 - migration works up and down
 - tests pass

Change-Id: I027da73a5ff87226206e3ba7b06618c0919ad8d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260531
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>
2021-03-16 20:01:43 +00:00
Michael Ziwisky 2ac314bdfa Set up replica identity index for CourseAccountAssociation
refs FOO-1171
flag=none

test plan:
 - migration works up and down
 - tests pass

Change-Id: Ib1e7f0cd2398c56fff8ec0208ace8a69a180a393
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260522
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>
2021-03-16 20:01:35 +00:00
Robin Kuss e0f025c0f2 spec: hackweek data generation project
closes: LS-1996

Test Plan:

Run:

script/rails runner spec/fixtures/data_generation/generate_data.rb --help

to get the options that can be run.  Try -a for running all the options
(with -n and -c for number of students and course_name) -- this will
cover most everything.  Try different options together.

Also works in docker env:
docker-compose run web bundle exec rails runner
spec/fixtures/data_generation/generate_data.rb -h

tbh it's a work in progress.  I'll write some documentation.

Change-Id: Ic8d8bf5462ea85a02fc37ae746fb5ec57ffbfef2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259496
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Robin Kuss <rkuss@instructure.com>
2021-03-11 15:27:53 +00:00
Augusto Callejas 33e4f27bbd Use versioned submission for tracking outcomes
fixes OUT-4264

flag=none

This fixes an issue where we use the latest submission's
version to determine what assessment questions are used
(to then determine outcome alignments) instead of the
attempt version provided.

test plan:
  - qa-cr

Change-Id: I20d0bf4cc9d433e9e1865e35a3e37f29acd3efc0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259136
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-02-22 19:49:14 +00:00
Jorge Arteaga a0426e119d Add GET route to the REST API that returns formatted answers
closes QO-580
flag=none

Test plan:
- Create a quiz with numerical questions with the answer types
  "Exact", and "Answer with Precision"
- Take the quiz as a student
- Get the quiz_submission ID and the question IDs for the next step
- make requests to
  GET /quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer
  with the param "answer" (Numeric)
- You should get a formatted number that meets the following rules:
  * Trailing zeros should always be removed.
  * If the question has at least one answer with "Answer with precision"
    type, it should have precision of 16 digits.
  * If the question don't have answers with "Answer with precision" type,
    is should be rounded to 4 decimal places

Change-Id: Ia295a0f1ca83a9834d0e978d36cce6ebe421fe27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257585
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
2021-02-17 18:35:24 +00:00
Eric Saupe 6aed7fbc6e Copy To search polish
Copy To now returns only active or future course results
and includes the term in the results. Results are sorted
by term and term start date. Long text in any field is
wrapped after two lines.

fixes LS-1815
flags=none

test plan:
- Open the Copy To sidebar
- Verify only active and future courses are listed
- Verify results include term name
- Verify results are sorted by term with Default term first
  then by term start date
- Verify results are then sorted alphabetically
- Verify long values in any field are wrapped after two lines

Change-Id: Ie5668f30724647a6503946756e9369cb4cc52ffb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258613
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: JuanPablo Montoya <juanpablo.montoya@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: JuanPablo Montoya <juanpablo.montoya@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-02-17 18:17:09 +00:00
Wagner Gonçalves b98393f981 part 3.1: change lookup_id and resource_link_id to UUID datatype
This is part 3.1 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links.

Stops writing into lookup_id and resource_link_id columns.

refs INTEROP-6488
flag=none

test-plan:
* specs should pass;
* you should check if LTI is launching as expected, and if the custom
    params was expanded as expected in all records that were created in
    the part 1, 2 and 3;
* you should be able to new persist custom params, for example you can
    use the RCE editor placement;
* you can follow the test-plan:
    * https://gerrit.instructure.com/c/canvas-lms/+/256029
    * https://gerrit.instructure.com/c/canvas-lms/+/254453

Change-Id: I9b2c85e0afb333c17afb1be0fb4a543f145ba400
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258317
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-02-17 18:08:57 +00:00
Wagner Gonçalves 005e90871c part 3: change lookup_id and resource_link_id to UUID datatype
This is part 3 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links.

We start to read from the new columns created lookup_uuid and
resource_link_uuid.

Adding a migration to remove the not-null constraint of lookup_id and
resource_link_id columns. As part 3.1 we'll stop writing into these
columns, we need to execute this postdeploy migration at this point.

refs INTEROP-6488
flag=none

test-plan:
* specs should pass;
* you should check if LTI is launching as expected, and if the custom
  params was expanded as expected in all records that were created in the
  part 1 and 2;
* you should be able to new persist custom params, for example you can
  use the RCE editor placement;
* you can follow the test-plan:
    * https://gerrit.instructure.com/c/canvas-lms/+/256029
    * https://gerrit.instructure.com/c/canvas-lms/+/254453

[fsc-timeout=30]

Change-Id: I401f53a82f4dbef66c45932eb2eed8727488313d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258246
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-02-11 18:02:20 +00:00
Jared Crystal 896ec8af70 show all NQ & QO together in the "add to module" modal
closes QUIZ-8081
flag=new_quizzes_modules_support

test plan:
 - create a module in a course
 - create some classic quizzes and some new quizzes in the course
 - on the modules page (also test by making modules the course home page),
   click the + to add content to a module
 - with the FF disabled, only classic quizzes
   should show when Quiz is selected from the dropdown
 - with the FF enabled, both classic quizzes and
   new quizzes should show together (alphabetized)
   when Quiz is selected from the dropdown

Change-Id: Ice394a3af4d88eed9441e9d7be71e87b8486e56d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256199
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Bryan Petty <bpetty@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
2021-01-14 19:38:33 +00:00
Weston Dransfield 867d2f01a4 Direct sessionless launches to correct shard
This situation occurs whith cross-shard enrollments
see details in ticket).

Note that these kind of launches currently work,
but require an extra login from the user.

This change negates the need for the extra login
by generating the sessionless launch on the
Canvas domain the user is already active in.

refs INTEROP-6371
flag=none

Test Plan:
1. An shard 2, create a course with an external tool
2. Add the tool to a module item in that course
3. On shard 1, create a user
4. Enroll the user from shard 1 into the shard 2
   course
5. Using an access token from the user, make a request
   to shard 1 to generate a sessionless launch.
   Example: http://shard1.docker/api/v1/courses/
     20000000000002/external_tools/
     sessionless_launch?id=20000000000008&
     launch_type=module_item&
     module_item_id=20000000000009&
     url=https%3A%2F%2Fwkd-lti-test.herokuapp.com
      %2Fmessages%2Fblti
6. Verify the response includes a launch URL that
   uses the shard 2 domain:
     http://shard2.canvas.docker/courses/2/
     external_tools/sessionless_launch?
     verifier=<verifier>
8. Make the same request from step 5, but this
   time use the shard 2 domain. Verify the
   response matches the response from step 6

Change-Id: I92dd3bbe80b07e844bfc91e5f77810b008ebd9fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254949
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2020-12-15 18:24:57 +00:00
Wagner Gonçalves 35c5b2c39e add custom fields to lti resource link
We're adding context_id, context_type, custom and lookup_id fields to
lti resource link. And, we're providing a datafixup service to fill
the new fields properly.

closes INTEROP-6309
flag = none

test plan:
* first of all, you need to apply the migrations to the database by:
rake db:migrate;
* check that the context_id, context_type, custom, and lookup_id columns were
created properly;
* check that if the indexes were created properly by:
  * SELECT indexname, indexdef FROM pg_indexes WHERE
    indexname = 'index_lti_resource_links_by_context_id_context_type' OR
    indexname = 'index_lti_resource_links_on_lookup_id';
* check that if the `NOT NULL` constrain were applied properly:
  * SELECT column_name, is_nullable FROM information_schema.columns
    where table_name = 'lti_resource_links';
* check if current lti resource links attributes were filled properly;
* Into the Course context, you should be able to add a new Assignment using
External Tool as the Submission Type without errors (you could use the LTI test
the tool previously installed);
* at the end you just need to check if our migrations are reversible by:
rake db:rollback STEP=5 (the current step of all migrations related to this
change);

Change-Id: I8a80ebad31462f0df860583c3d64d663085948b4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253841
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2020-12-14 17:37:45 +00:00
Ethan Vizitei 4fb9f66d3a No custom JS for users from other root accounts (like siteadmin)
refs FOO-1264

TEST PLAN:
  1) visit an account with custom JS as a siteadmin
  2) you should not get custom JS in your page
  3) masquerade as a user on the account
  4) you should see custom JS

Change-Id: I571f2d3d35ccd295d52c03f13b1f861a4ec71c29
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254148
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-12-03 19:08:09 +00:00
Mark McDermott 5135c2c16f Fix quiz score miscalculation
The summation of multiple float values can return
an incorrect value due to the way floats are
represented in Ruby.

Closes: QO-493
flag=none

test plan:
- Create a quiz as a teacher with three questions all
  worth 1.3 points
- Get all quiz questions correct as student
- Check gradebook page for request from
  `/api/v1/courses/:course_id/students/submissions` shows
  `grade` and `score` as a decimal number with
  only 2 significant digits
- Check the
 `/api/v1/courses/:course_id/assignments/:assignment_id/submissions`
  for the same behavior

-

Change-Id: I3365a3447107021c223c6da1f7658d97c2336c08
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252051
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Han Yan <hyan@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Matthew Goodwin <mattg@instructure.com>
2020-11-10 17:40:38 +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
Cody Cutrer dfc0fe5f6a ruby 2.7/rails 6: several deprecation warning and spec fixes
Change-Id: I6314b3f304e8befc18ee2f832993a0740690d786
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249956
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-14 16:13:04 +00:00
Michael Brewer-Davis 9f01610f48 update rubrics after outcome proficiency changes
closes OUT-3779, OUT-3876
flag=account_level_mastery_scales

Test plan:
- enable mastery scales
- create an account level mastery scale
- create account and course level rubrics
- update the account level mastery scale
- verify rubrics updated
- associate the account level rubric
  with an assignment and assess for
  a student
- update the account level mastery scale
- verify account rubric unchanged, course
  rubric updated

Change-Id: I9bcaef171b2d118e18ddbbc0f8e619961d6b32fb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249289
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Jody Sailor
2020-10-14 16:01:37 +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
Rob Orton 3323d45448 create group_and_membership_importer
test plan
 - run the following with group category object and file contents
 - GroupAndMembershipImporter.create_import_with_attachment(category, file)
 - it should return a progress
 - it should import groups and group members

closes VICE-813
flag=none

Change-Id: Iccc7a4f491d7efbe035057a2915f318fd695deb1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249030
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-10-07 18:19:48 +00:00
Jared Crystal ff96eadadb prevent updating quiz scores for unassigned students
fixes QO-660
flag = none

test plan:
 (be sure to test with all quiz types: graded/ungraded/practice)
 - create a quiz and take it as 2 students
 - edit the quiz to be assigned to only one of the students
 - go to "Moderate this quiz"
 - attempt to "Update Scores" for both students
 - you should be able to for the student still assigned
 - you should not be able to for the unassigned student

Change-Id: Iea06b5b2a9c29817aae743945acc144563fe3c6d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247406
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Jared Crystal <jcrystal@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
2020-09-18 16:24:38 +00:00
James Williams a6e6fd0670 split built-in role rows by root account
test plan:
* a multi-tenant shard should still work
 creating enrollments and account admins before and after
 running postdeploy migrations
* the postdeploy should successfully run a datafixup
 to split up build-in role rows and reassign the role_id on
 other tables (account_notification_roles, account_users,
 enrollments, and role_overrides) accordingly

closes #INTEROP-6045

Change-Id: I8325acb635397ac1b008b9d09788595da597cec7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243906
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
2020-09-01 19:21:27 +00:00
Pat Renner c637d5d5eb allow course context proficiency/calculation methods
closes OUT-3878
flag=none

test-plan:
-login to http://canvas.docker/graphiql
-ensure you have at least one outcome
proficiency and calculation method for an
account
-for a course within that account, ensure
querying for proficiency/calculation method
returns the resolved value (account value)
-create an outcome proficiency and calculation
method for that course
-ensure querying that course again resolves to
the newly created objects

Change-Id: Ic4b9aa47eb9d890aaf6466c74197ba9dd182d68f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246082
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
2020-08-31 14:34:05 +00:00
Ethan Vizitei 9a27545ffe actually log authlogic session errors
refs FOO-853

TEST PLAN:
  1) login to canvas
  2) it should not fail to log you in.
  3) click around
  4) you should not be abruptbly logged out

Change-Id: I8e71fec8831f8978e011e7d86d81650e01c15ac4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245421
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-08-19 18:58:16 +00:00
Ethan Vizitei 52f9ce8558 differential diagnosis logging for 401s
Change-Id: I363222f2d1227d9b6e04e8a9576748e86f87eea4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245352
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-18 16:56:36 +00:00
Jeremy Stanley a258858a22 add recent history to global nav
test plan:
 - enable page views
 - enable Recent History feature
 - the global nav should show recent activity
   with links to the pages, the name of the context,
   and the time since the activity
   - the history should also appear in the
     responsive global nav, when the browser
     width is reduced
 - render API documentation
 - ensure the History API behaves as documented
 - ensure if an admin masquerades as a student,
   1. the admin does not see the student's history
      (but does see her own history as the student)
   2. the student does not see what the admin did
      while masquerading as him

closes LS-1311
flag = recent_history

Change-Id: I4c41f58622ce9ac7f18d00744ba108fd51b2d03a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/200801
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-08-17 15:50:21 +00:00
Pat Renner e846eaec57 remove account_id from outcome_proficiency model
closes OUT-3760
flag=none

test-plan:
- Run migrations
- Ensure outcome proficiencies cannot be made
without defining context (or context_type/id)
> rating1 = OutcomeProficiencyRating.new(
description: 'best', points: 10, mastery: true, color: '00ff00')
> rating2 = OutcomeProficiencyRating.new(
description: 'worst', points: 0, mastery: false, color: 'ff0000')
> OutcomeProficiency.create!(
outcome_proficiency_ratings: [rating1, rating2])
- Should pass with provided context
(may need to delete current proficiency ratings for Account.first)
> OutcomeProficiency.create!(
outcome_proficiency_ratings: [rating1, rating2], context: Account.first)

Change-Id: I67ea2237641e02e3339dbb7c468f9e91381422b2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242532
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Pat Renner <prenner@instructure.com>
2020-08-06 15:11:15 +00:00
Augusto Callejas 9e7912e3e0 GraphQL for outcome calculation methods
closes OUT-3762

flag=account_level_mastery_scales

test plan:
  - log in as an admin: canvas.docker
  - load GraphQL UI: canvas.docker/graphiql
  - test the folowing actions:
    mutations:
    * createOutcomeCalculationMethod
    * updateOutcomeCalculationMethod
    * deleteOutcomeCalculationMethod
    queries:
    * account -> outcomeCalculationMethod
    * course -> outcomeCalculationMethod

Change-Id: Ib875d7916790864eb4717c6dcce84dd1f4e75624
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243204
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2020-07-27 23:40:41 +00:00
Matthew Lemon b1ba4a9b9d SPEC: use factory to create comm channels in specs
Doing this will make any changes to communication channels in the future
100000000000% easier by limiting the blast radius to just a handful of
files rather than every single spec file in canvas_lms LOL

fixes VICE-540
flag=none

/ ---- ---- \
| Test Plan |
\ ---- ---- /

- tests pass

Change-Id: I9a61b3c7155bc76e0f813b4f35466baf6a8f7589
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239871
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-07-27 16:22:01 +00:00
Jeremy Stanley db911f6e87 direct share: add quiz or graded topic to module properly
test plan:
 - enable direct share
 - create a graded discussion topic and a graded classic quiz
   in Course A
 - create some modules in Course B
 - FROM THE ASSIGNMENTS INDEX in Course A, right-click the
   discussion topic and quiz and use "Copy To" to copy them
   to Course B and add them to a module
 - in the gradebook in Course B, check View | Filters | Modules
   and select module names from the dropdown at top-right
 - ensure the newly copied quiz and graded discussion appear
   when their module is selected in the dropdown

flag = direct_share
fixes LA-1016

Change-Id: I6bd929490ec9fda86a5862a1cc29aa5b6d9e38a9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239583
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-06-09 19:54:58 +00:00
Cody Cutrer a81944a73a rails 6: s/update_attributes/update/g
Change-Id: Ie137c1040260b363979160e1f0558883577ebebd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222510
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-01-09 20:56:35 +00:00
Anju Reddy d09d1be7fc spec: preview direct share specs
Change-Id: Ie076ac6347d09355b35145f00d7def40c4cca059
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222087
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Anju Reddy <areddy@instructure.com>
2020-01-07 20:45:40 +00:00
Anju Reddy 18d7d90991 spec: allow stubbing CCPreviewer URL
flag=none

Change-Id: I1641acbfb7b3861d81241ee1ec215d49e33fc9e8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/219919
Tested-by: Jenkins
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Putnam <jeremyp@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Anju Reddy <areddy@instructure.com>
2019-12-09 16:43:38 +00:00
James Williams 47feefb953 allow notifications to be sent for global announcements
test plan:
* should be able to mark the checkbox when creating
 a global announcement for an account (other than site
 admin) to queue a job to send the announcement in
 a notification to all applicable users

closes #CORE-3384

Change-Id: I0540196164be283f3acc6c6b5232a945e1916fbe
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/212448
Tested-by: Jenkins
Product-Review: Lauren Williams <lcwilliams@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2019-10-31 16:35:33 +00:00
James Williams 56a487811b spec: knapsack for selenium
Change-Id: I30c0c0006de8779dea1743d6c626022756f05d5a
Reviewed-on: https://gerrit.instructure.com/210564
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2019-09-25 14:13:39 +00:00
Jeremy Stanley 977ea70adc point user and course analytics links to analytics 2
test plan:
 - install analytics 2 LTI tool
 - enable new analytics feature
 - verify links to new analytics exist in the following places:
   1. course right side nav
   2. course people page student kebab menu
   3. course user page (with and without user profiles)
 - for 2 and 3 above, links should only appear for students
 - the /api/v1/courses/X/users?include[]=custom_links API
   should not include analytics links for students
   (assuming the tool configuration sets required_permissions)

fixes ADMIN-2900

flag=analytics_2

Change-Id: Iddefdb6c119f0d50240144b6e507a4428fcf8af6
Reviewed-on: https://gerrit.instructure.com/209758
Tested-by: Jenkins
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2019-09-20 21:03:57 +00:00
Derek Bender 8cf3d457d6 Fix moderated assignments with graded rubrics
Closes: GRADE-2414

Test plan:
- Given a course with a Teacher, on TA and a student
- Given a moderated assignment with one Grader
- Given the teacher is the final grader
- Given a rubric attached to the assignment with the option "use for
  grading" enabled
- Given the TA has graded the student with the rubric
- Given the TA has also given a *different* score in the normal grade
  box than what the rubric score was
- Given on the moderation page the Teacher selects the TA's score.
- When clicking the "Release Grades" button
- Then submitting grades works and does not error

Change-Id: Ia2d06047ec492bd79a17a1fd086861e016ccdf9d
Reviewed-on: https://gerrit.instructure.com/208051
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2019-09-20 20:38:16 +00:00