Commit Graph

2081 Commits

Author SHA1 Message Date
Chawn Neal 76d877e3ee datafix set root_account_ids ConversationMessageParticipant
this is the intended set_root_account_ids for
conversation message participants.

this will set it to the conversation's root_account_ids.

refs VICE-3181
flag = none

Test Plan:
1) you can run the loop locally,
 and for one cmp.
2) watch how it sets the cmp.root_account_ids

Change-Id: I7796e7bf76428840bd94fdb2bd54e0b001280d2c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/310674
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Product-Review: Jason Gillett <jason.gillett@instructure.com>
2023-02-09 19:13:08 +00:00
Omar Gerardo Soto-Fortuño bda150e266 Populate missing root_account_ids for Communication Channels
closes VICE-3182
flag=none

test plan:
  - Specs pass

qa risk: low

Change-Id: I9fea3003c97a6e62f4f3a917491cfd77aa4fdb8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/310495
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
QA-Review: Jason Gillett <jason.gillett@instructure.com>
2023-02-07 21:09:17 +00:00
Jacob Burroughs 48d17872bf Set root_account_ids for student view students
fixes FOO-3156

Change-Id: Ibd93e097544e7b5da082cdcf4429e97c83a24bed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304309
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
2023-02-01 18:30:16 +00:00
jake.oeding 656b315402 stop reviving deleted media files
don't bring them back from death when a user
views an embedded version of them

fixes MAT-1193
flag=none

test plan:
-upload a media file (audio or video)
-embed said file in a page/assignment/other rce location
 and save
-go to your 'Uploaded Media' folder and delete said file
-go back the the location where you embedded said file,
 view it, and make sure you wait until you can play the
 audio/video before moving on
>go back to files and ensure that the file wasn't recreated,
 i.e. it's not present in your 'Uploaded Media' folder
>go to an RCE, open the media embed tray, and confirm
 said file also does not appear in the files available to
 embed

Change-Id: Icc061234d2be8b853ed89107146cf161cdab3d28
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309791
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Allison Howell <allison.howell@instructure.com>
2023-01-31 15:00:31 +00:00
Mysti Lilla 9fb2262ca8 Fix folder_active functions
Turns out that trigger functions cannot reference
schema qualified tables, or we can't refresh test
cluster instances, so this should make them
generic

flag=none

Test plan
- Specs pass

Change-Id: I344ab266f1d37ab1935b6e2a51cb80ecdb37d247
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309949
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Rosser Schwarz <rschwarz@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2023-01-31 01:19:39 +00:00
Endre Berki 762b3aa448 Add canvas_tool_id custom field to Quiz LTI tools
Closes QUIZ-10477
flag=none

New Quiz LTI provisions are already requesting this  field with g/307628.
With this migration, the existing provisions will also be adapted.

Test plan:
- check that your Quiz LTI ContextExternalTool
  record does not have the canvas_tool_id custom field.
- execute rails db:migrate
- check that your Quiz LTI ContextExternalTool
  record HAS the canvas_tool_id custom field

Change-Id: I04c54dcdf5d9730756f67ae9459c5008c9aecfdf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308959
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ferenc Marcsó <ferenc.marcso@instructure.com>
QA-Review: Roland Beres <roland.beres@instructure.com>
Product-Review: Roland Beres <roland.beres@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
2023-01-27 11:37:12 +00:00
Jeremy Stanley 39dec149cf add resource_map_url to quizzes_next_quiz_duplicated live event
test plan:
 - have a course with a new quiz
 - copy it to another course
 - the quizzes_next_quiz_duplicated live event that is dispatched
   should include a resource_map_url that points to a file
   that looks like

   {
     "source_course": "203",
     "source_host": "pineapple.edu",
     "resource_mapping": {
       "assignments": { "1": "21", "2": "22" },
       "announcements": { ... },
       ...
     }
   }

flag=none
refs FOO-3302

Change-Id: I97196bd13c0cb2d95103540526e69e11f5c9c2f7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309121
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Logan <james.logan@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: James Logan <james.logan@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2023-01-25 00:24:40 +00:00
Ed Schiebel 0f018da4fb Remove unsplash code from canvas
One tricky bit I had to deal with here was migrating developer_key scopes

refs MAT-1140
flag=none

test plan:
  - jenkins passes
  - canvas still runs
  - you can set|change the course image on the course settings page
  - you can upload an image from the rce
  - Unsplash does not show up on the /plugins page

Change-Id: I36a88bcba0cd6f39a45a61ea38ede39f99d58a42
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308631
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Deyvison Penha <deyvison.penha@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Deyvison Penha <deyvison.penha@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2023-01-18 17:51:51 +00:00
Jason Gillett 94e7ee5b98 Populate quoted entry field
closes VICE-3240
flag=split_screen_view

Test Plan
- run the migration
- Verify that discussion_entries with include_reply_preview = true have a populated quoted_entry_id
- the quoted_entry should match the quoted_entry_id
- all existing quoted_entries should be their parent_entry

Change-Id: I70f61e29bf47a30f3e90ab7d5c9a60d7e7a6610c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308223
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
2023-01-06 16:48:54 +00:00
Jason Gillett ebafef9661 Add Quoted_entry to discussion entry model
refs VICE-3240
flag=split_screen_view

Test Plan
- run the migration
- Verify that the discussion_entry model has a quoted_entry_id field

Change-Id: I921b23f839311d8d25a7e7d36067751285a3d0f7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/308220
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2023-01-06 16:43:13 +00:00
Tucker McKnight 8475b01547 Change dev key scopes that reference old API routes
A couple of outcome_imports endpoints were changed a while ago
and not caught it our first round of fixups for this issue.

The commit that changed these routes is d97ffa57a8, which is from
before we started cleaning these up and catching these errors.

test plan:
- I tested this by creating a developer key with the first two
  "before" values in SCOPE_CHANGES,
  ["url:POST|/api/v1/courses/:course_id/outcome_imports",
   "url:POST|/api/v1/accounts/:account_id/outcome_imports"]
  for its scopes, and saving it with dk.save(validate: false).
- Then I verified that you couldn't modify the developer key without
  getting a validation error.
- Then I changed the dk.scopes to be the first two "after" values in the
  SCOPE_CHANGES array below, and verified that you could modify it after
  that.

flag = none

fixes INTEROP-7864

Change-Id: I681d1d050c2af096e1e84e7038aa50b5bda854fb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306877
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
2023-01-04 16:53:01 +00:00
Tucker McKnight 2055aa0bc6 Refactor dev key scope fixup
Since a developer key won't save unless all of its bad routes are
fixed at once, if we discover a new bad route in the future, we'll want
to re-run all of the prior scope changes on that key at the same time.
Putting them all in the fixup class itself makes it easier to run all
of the route changes every time, and gives a straightforward place to
put new route changes that may come up in the future.

flag = none

Change-Id: I8c7c93d513d82b1c366bbe641c70196933be3363
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306601
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
2023-01-04 16:52:38 +00:00
Ryan Hawkins 78eb4617ec Increase valid length for dev keys redirect_uris
why:
- some of the DBAs noticed that we were trying to save URIs longer than
  255 characters to the database and silently swallowing the errors.
- we've decided to bump up the size of a valid redirect_uri, as 255
  characters is quite short in the grand scheme of things.
- additionally, added a validation on the front and backend to ensure we
  don't swallow errors like this again.
flag=none

closes INTEROP-7592

test-plan:
- Run the included migration
- In the UI, try and create a key with one of its redirect_uris having
  a length greater than 4096 characters. You should get an alert telling
  you that redirect_uri is too long.
- In a rails console, try and create a DeveloperKey with one of its
  redirect_uris having a length greater than 4096 characters. You should
  get an error from ActiveRecord::Validations saying that one of your
  redirect_uris is too long.

Change-Id: I86b437d62f95cbee81dac45250ad4a59fcd6b373
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306735
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
2023-01-03 21:42:21 +00:00
Derek Williams 4fc4538460 add submit for student file upload button and modal
closes EVAL-2685
closes EVAL-2686
closes EVAL-2687
closes EVAL-2688
flag=proxy_file_uploads

test plan:
- turn on proxy_file_uploads siteAdmin FF
- grant Teachers permission with proxy_assignment_submission
- create an assigment on a course with file_upload submissions
- as a teacher, navigate to that assignment in gradebook
- notice 'Submit for Student' button on the submission tray
- upload a file and see that it saves to the student's folder
- click 'submit' to save the submission
- notice that the proxy submitter is saved on the submission
- verify proxy upload indicator appears in the following places
    - gradebook submission tray
        - SubmissionTray.tsx
    - speedgrader
        - submissions_dropdown.handlebars
    - A2 student views
        - SubmissionWorkflowTracker.js
    - A1 student views
        - submission_sidebar.html.erb
        - views/submissions/show.html.erb

Change-Id: I2b9a7b8a5d1bd7c31bd2fe0c15b3316ce8b7e4bc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304943
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Cameron Ray <cameron.ray@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Christopher Soto <christopher.soto@instructure.com>
Product-Review: Deborah Kwak <deborah.kwak@instructure.com>
2023-01-03 21:28:01 +00:00
akemeny a71ad5b289 Add Commons LTI config backfill for Heap integration
refs PHO-3830
flag=none

Commons LTI provisions are already requesting these fields.
With this migration, the existing provisions will also be adapted.

Test plan:
- check that your Commons ContextExternalTool
  record does not have the necessary custom fields.
- execute rails db:migrate
- check that your Commons LTI ContextExternalTool
  record HAS the necessary custom fields

Change-Id: Id7e12bfb1569ba48c55f2d0e16c8dedc7c9cb335
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307266
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Andras Kemeny <akemeny@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-24 20:15:21 +00:00
Chris Soto f0d7a015c1 remove assignment visibility for concluded student
Before this change, if an assignment was assigned to a section that a
student was concluded in AND that student had another enrollment in
the course that was active, the student would maintain visibility of
any assignments that had a due date in the future. This meant that the
students could submit for that assignment. After this change,
students will no longer be able to see assignments that are assigned
to sections that concluded/completed in that have a due date in the
future. The will continue to see any assignments that were due before
their enrollment was completed.

closes EVAL-2748
flag=none

Test Plan 1:
* Pre-requisites: Migrations have been run, and a student enrolled in
two sections of the same course (A & B).

1. As the teacher, create one assignment in section A.
2. As the teacher, create two assignments in section B.
   - create one assignment with a due date in the past
   - create one assignment with a due date in the future
3. As the student, view your assignments. User should see all
   assignments
4. As teacher, go to the user page for the
   student (courses/:course_id/users/:id), click 'more user details...',
   and then click on 'Conclude this Enrollment' for Section B
5. As the student, view your assignments. User should now see:
   - Assignment for Section A (still enrolled)
   - Assignment for Section B with due date in past
6. Verify the student cannot see the assignment for Section B that
   has the due date in the future.

Change-Id: I68a5ae908077d2f591532513a022e339db2c8c3a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/306831
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Cameron Ray <cameron.ray@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Deborah Kwak <deborah.kwak@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-21 22:06:33 +00:00
Jacob Burroughs f5ef671937 Fix migrations on ruby 3.0
Change-Id: Id1240c757f3e8470c27b8c1fdd0f5fe3f9c48e4e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307222
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-13 14:26:35 +00:00
Mysti Lilla 9389b58c9f Error when trying to create files/folders in deleted folder
fixes MAT-917
flag=none

Test plan
- Upload a very large zip and extract it into a folder
  in the files interface
- When it has started importing, delete the top level folder
  (The import will still complete)
- Go to the modules page and add a file module item
  and verify that you can't see any of the files that your
  import would've created

Change-Id: Ibcf06940ad8306a015040508166e0a2b001409c4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305351
QA-Review: Deyvison Penha <deyvison.penha@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2022-12-02 19:55:13 +00:00
AJ Esa 8abef3d627 Timestamps for delayed jobs not null
Make the timestamps for delayed jobs not nullable. Fixes schema
inconsistency.

fixes FOO-3107
flag=none

Change-Id: I97050eb78fcfa4bd3989c120ee1736efa8abd879
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/305918
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ajmal Esa <ajmal.esa@instructure.com>
Product-Review: Ajmal Esa <ajmal.esa@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-11-29 16:55:55 +00:00
Cameron Ray 0dd4aec595 assignment_group rules
prevent decimal ignore rules from being added to
assignment_groups

Test plan:
 - As a teacher
 - In the Assignment Groups edit modal
 - Enter a non-integer value to 'Lowest Scores'
 - Click save
 - Should show error
 - Enter a non-integer value to 'Highest Scores'
 - Should show error

Refs EVAL-2720

flag=none

Change-Id: I51b86da6c0692231c1d7a6f28dbdeaf1dd1aac5f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304051
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
2022-11-16 21:22:18 +00:00
Eric Saupe 90c5693d36 Fix non-paceable content tags being updated/created
A check was added for "learning_outcome_association" tag types with
PFS-19614. There are other content tags that are not used by
context modules. Course pacing is only concerned with module items. This
patchset fixes the check when a content tag is updated to match the other
course pacing checks to only get content tags that are for context modules
and have an assignment.

fixes LS-3548
flag=course_pacing

test plan:
- Create a ContentTag with a tag_type other than "context_module" in a
course with course pacing enabled and a course pace published
- Verify the content tag is not added to the course pace
- Create a ContentTag with a tag_type of "context_module" without an
assignment attached
- Verify the content tag is not added to the course pace

Change-Id: Ibe32df8906cf96582874727a88e8ece9bd02fd84
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303975
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2022-11-08 19:36:22 +00:00
Chawn Neal a2314df6cc Fix pagination with unread filter
fixes VICE-3170
flag = react_discussion

Test Plan:
Solution:
- any entries marked as read after selecting the unread filter,
will still return under the unread filter, until the filter changes
or a page refresh.
- note the mutation will sill update and the blue unread icon
will disappear.

Have at least 60 unread entries (3 pages).
Have some unread entries.
1. Use the unread filter.
2. Notice the unread entries can update to read,
however. If you switch pages the same set of total unread entries
will be returned.
3. Upon page refresh or switching filter, then
returning to unread the entries will no longer return.

Change-Id: I911f85ed8a23b7f8bdfa22edce5745e79b389307
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304016
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-11-01 16:01:20 +00:00
Omar Gerardo Soto-Fortuño 45fc40f040 Create DiscussionEntryVersion
flag=none

test plan:
  - Tests pass

qa risk: low

Change-Id: Iaadf9cb6c0dd92946990a4fdee7649984b5a6143
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304362
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Chawn Neal <chawn.neal@instructure.com>
QA-Review: Chawn Neal <chawn.neal@instructure.com>
Product-Review: Chawn Neal <chawn.neal@instructure.com>
2022-11-01 15:28:34 +00:00
Mysti Lilla 74c87a0577 Clean up duplicate subscription creation code
flag=none

While working on g/289874 I discovered the
tool proxy controller was also attempting
to create/delete the live events subscriptions.
The model is already doing this now, and
the controller code is not necessary

Test plan
- Create a LTI 2 tool (with live events
  subscription service turned on) and
  ensure a subscription is created
- Delete the LTI 2 tool and ensure
  the subscription is disabled

Change-Id: Ieac06c9cc22faca27bfabaaf18f342abd68e8efa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/290866
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2022-10-27 18:18:32 +00:00
Cameron Ray f64c1ada94 Remove comments from the rubric assessments table
This is a field that has not been used for a long time and,
previously, someone tried to remove it.
It's causing data inconsistency issues across shards.

Test plan: all existing tests pass

flag=none

Refs EVAL-2631

Change-Id: I64533586806f4a0574ae39cca82bf8a07cf54236
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303968
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Cameron Ray <cameron.ray@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-10-25 15:27:19 +00:00
August Thornton cfa4c53bab backfill root_account_id for enrollment_dates_overrides
refs FOO-3155
flag = none

test plan:
 • run data fixup migrations
 • should populate any root_account_id columns that are NULL
   for enrollment_dates_overrides table

Change-Id: Idbb8d9f5811cf8da3f7245572cd3f1e1fbf59a76
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303632
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2022-10-20 20:06:15 +00:00
August Thornton 23de3cb6c8 add root_account_id to enrollment_dates_overrides
refs FOO-3155
flag = none

test plan:
 • run migrations
 • verify in rails console that root_account_id can now
   be set on the EnrollmentDatesOverride model

Change-Id: I801b344efffa88efc6a5ed351440a4bf2e5525f1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303609
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Sean Scally <sean.scally@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2022-10-19 21:07:59 +00:00
Omar Gerardo Soto-Fortuño 5b1b4e369d Change discussion_topic_materialized_views fields to text
flag=none
closes VICE-3126

test plan:
  - Tests pass
  - Cursory testing of legacy discussions

qa risk: low

Change-Id: Ifc84cbeadb439b919bc84d5cae400b92ff32eb0b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/302961
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Chawn Neal <chawn.neal@instructure.com>
Product-Review: Chawn Neal <chawn.neal@instructure.com>
2022-10-11 14:14:40 +00:00
Endre Berki 323f89e48a Add rcs_service_jwt custom field on Quiz LTI tools
Closes QUIZ-9848
flag=none

New Quiz LTI provisions are already requesting this  field with g/300117.
With this migration, the existing provisions will also be adapted.

Test plan:
- check that your Quiz LTI ContextExternalTool
  record does not have the canvas_rcs_service_jwt custom field.
- execute rails db:migrate
- check that your Quiz LTI ContextExternalTool
  record HAS the canvas_rcs_service_jwt custom field

Change-Id: I8c7061d8e64637bbfce02ab4a3dfc5863ab7cc83
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301864
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rajmund Csehil <rajmund.csehil@instructure.com>
QA-Review: Rajmund Csehil <rajmund.csehil@instructure.com>
Product-Review: Rajmund Csehil <rajmund.csehil@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-09-28 08:24:36 +00:00
paulo.chaves 35b93d1934 Add content_item to content_participations table
Add the content_item column to enable tracking the
read state of each submission item (grade, comment, rubric)

Ensure content_participation_counts doesn't allow negative `unread_count`

closes EVAL-2657
flag=visibility_feedback_student_grades_page

Test plan:
  - Existing test and new tests pass

Change-Id: Ia0a7aaadd944914de56e596736537d6946ce7d3c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301671
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Cameron Ray <cameron.ray@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-09-27 18:48:10 +00:00
Ethan Knapp feafc09667 add file permissions
adds a Course-level setting to control the visibility of uploaded files
also adds a per-file setting to override the Course-level setting

Test Plan:
1. Validate the the Course-level setting can be set and updated. It should
    behave similar to the Syllabus visibility setting, but should allow
    being looser or tighter than the Course itself.
2. Validate that the File-level setting can be modified.
3. Validate that Files can only be accessed based on the setting.
4. Validate that the existing "Only with link" and "Schedule availability
    rules work as expected with the new options.

flag = none
refs PFS-20427

[fsc-max-nodes=20]
[fsc-timeout=45]

Change-Id: Ie688264fff59e81b13c97ef58bf0ae81cf8a5610
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300000
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Douglas Rist <douglas.rist@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2022-09-26 22:51:46 +00:00
Jacob Burroughs 43f00db33e Actually create jobs timestamps not null
Fixes bug introduced in g/284968 and makes the migration match inst-jobs

refs FOO-3107

Change-Id: I09902b7f97450ddd461d6daf51c32906397f794d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301406
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-09-20 14:43:15 +00:00
Tucker McKnight 9f79475dcb Re-run the dev key scope fixup
This data fixup should be run again now that 10325309 has been merged
in. Before that, developer keys that had scopes that were defined
in a plugin would have run into a validation error when this job
ran the first time.

Keys that were already fixed the first time around will be unaffected
by this second run.

fixes INTEROP-7615

flag = none

Change-Id: Iecf0be69f072cc1893daf7e72eca6557a3ceb765
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300179
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Steve Mcgee <steve.mcgee@instructure.com>
2022-09-08 21:43:45 +00:00
daniel.artner 13248d5e76 Add rcs_host custom field on Quiz LTI tools
refs QUIZ-9572
flag=none

test plan:
- check that your Quiz LTI ContextExternalTool
  record does not have the canvas_rcs_host custom field.
- execute rails db:migrate
- check that your Quiz LTI ContextExternalTool
  record HAS the canvas_rcs_host custom field

Change-Id: I3d66a6d88698b1c83ce047ae21c289f82417beff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295040
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Migration-Review: Ben Rinaca <brinaca@instructure.com>
QA-Review: Endre Berki <endre.berki@instructure.com>
Product-Review: Endre Berki <endre.berki@instructure.com>
2022-09-05 11:16:36 +00:00
Jeremy Stanley 33dd2726dc scheduled publication of pages
test plan:
 - enable the scheduled page publication feature in
   your account
 - create or edit a page and set a publish_at date
   in the near future
 - wait for that time (and ensure jobs are running and
   not backlogged)
 - ensure the page became published (and its module item was
   published if it's in a module)
 - ensure when a page scheduled to be published in the future
   is copied as part of course copy, the copy gets published
   at that time too
   - unless dates are shifted. the publish_at date should be
     shifted the same as the others
   - if a page is scheduled for publication in the near
     future, then the course is copied after the page is
     published, shifting the publish_at date into the future,
     the page in the destination course should be unpublished
     (and the calendar icon should show the publication date)
 - ensure when a page in a blueprint associated course is
   automatically published, future syncs still update the page
   (the auto-publish isn't counted as a downstream change
   that causes sync exceptions)
 - on the pages index, a page that is scheduled for publication
   but not yet published shows a red calendar icon in place of
   the gray circle-slash thing ordinarily seen next to unpublished
   pages
   - same goes for the modules page
     and the button at the top of page show
   - clicking the icon lets you publish the page now,
     unpublish it (remove the scheduled publication), or
     change the publication date
 - when a page that is scheduled for publication is included in
   an unpublished module, publishing the module doesn't publish
   the page (and you get a notice)

if the feature is turned off after scheduling pages to be published,
no evidence of it is visible in the UI and the page will not be
published when the time arrives. (we figure this is easier than
updating all pages in the account to wipe the publish_at date
for a scenario that doesn't seem likely to begin with anyway)

note that I removed the tooltip from the publish button on page show
because it always duplicates the button text, but the tooltip
remains on the publish icon

closes DE-1346

flag=scheduled_page_publication

Change-Id: Iba16b3d788bcb0051e022e2706446020e6b8171b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/297715
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: David Lyons <lyons@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-08-30 16:10:55 +00:00
Xander Moffatt 145a560fe2 replace settings.use_1_3 with lti_version: 1.3
why:
* explicitly set lti version on tool model instead of in settings hash
* remove all direct usage of settings["use_1_3"]
* set lti_version: 1.3 on all tools that have 1.3 in settings

closes INTEROP-7598
flag=none

test plan:
* have a 1.3 ContextExternalTool that has a developer_key associated
with it and `use_1_3: true` in its settings hash
* run `dcr web rake db:migrate`
* reload that tool - it should have lti_version: 1.3 and not have
use_1_3 in its settings hash

Change-Id: Ib82aedaf1a19fec48eab28f9cd408c4712ec21c0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298327
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2022-08-23 18:14:00 +00:00
Xander Moffatt cb03441f04 fixup lti_version for 1.3 ContextExternalTools
closes INTEROP-7597
flag=none

test plan:
* have a 1.3 tool installed
* by default it should have an lti_version of "1.1"
* `dcr web rake db:migrate`
* reload that tool - it should have an lti_version of "1.3"
* create a new 1.3 tool using an LTI developer key
* that new tool should also have an lti_version of "1.3"

Change-Id: I446a523f62c4de58386375c4223dbfc9ac2e184d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298589
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
2022-08-17 19:52:45 +00:00
Xander Moffatt 74589c2e0f add lti_version column to tool
why:
* explicitly set lti version on tool model instead of in settings hash
* remove assumption that the presence of a developer_key_id means that
a tool is 1.3
* include new column in tool import/export

closes INTEROP-7596
flag=none

test plan:
* run `dcr web rake db:migrate`
* in a Rails console, run `ContextExternalTool.last`
* the model should have an lti_version of "1.1"

Change-Id: I101111a17f6ce06c466c142e7b312e6ba7c5149f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298326
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2022-08-17 19:52:37 +00:00
Xander Moffatt 7a6b1112a4 fixup more broken course copied resource links
why:
* the last fixup mistakenly only searched for resource links created
since 7/26 (since the first hotfix that introduced this bug)
instead of since 6/12 (the initial commit that added urls to resource
links and made this bug possible)

closes INTEROP-7580
flag=none

test plan:
* with a course with at least one resource link in it
(either LTI assignment, LTI module item, or LTI content item in an RCE),
that has a nil url (this is the old way of doing it and
you may need to manually create one like this)
* create a new course and Import Existing Content
* choose the original course as a source
* in a rails console, find all Lti::ResourceLinks associated
with the newly copied course
* update all of their created_at to be before 6/12,
and all of their urls to be not nil (you could use the tool's url since
that is what happened before the bug fix)
* run `DataFixup::FixResourceLinksFromCopiedCoursesNullUrls.run`
* these resource links should correctly have nil urls

Change-Id: I587a194ba96cc428b3880dd516870f33ba26f8e9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/297808
Reviewed-by: Paul Gray <paul.gray@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2022-08-03 21:34:44 +00:00
Paul Gray bbe1da583a Persist nil resource link urls during course copy
why

With resource_links now having urls, when looked up via retrieve, the
url launched is taken from the resource link's url column. If that
column is nil, then the tool's url will be used. Some resource links
rely on this behavior to launch the url. During course copy, the url in
the export is now included in the export and persisted in the import,
causing all imported resource links to never persist a nil url.

This commit updates the exporter with a new custom property in the cc
export, a resource_link_url, which includes the url column from the
exported resource_link. The importer will use this to populate the new
resource link's url column, and will use the standard cc launch_url
simply to lookup the tool to associate.

fixes INTEROP-7572

flag=none

test plan:
Find an existing course with a resource_link that has a nil url, and
copy that course. the new course should have the same resource_link,
except the url in the new resource link should still be nil.

Change-Id: I62f85689a4a6a7a2cbd8f95f82c6dde343d7b8e0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/297340
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Paul Gray <paul.gray@instructure.com>
2022-07-29 21:31:41 +00:00
Luis Oliveira c2e5418ddc Add course paces to blueprint syncs
fixes LS-3162
flag=course_paces
[fsc-max-nodes=18] [fsc-timeout=30]

test plan:
- Configure course paces in a course
- Make that course a blueprint
- Associate it and sync it to a second course
- Check that the proper assignment durations
  flow downstream
- Alter course pacing in the child course
- Check that on further syncs downstream
  changes aren't overwritten
- Lock the duration for some assignments
- Check that on further syncs those durations
  are now overwritten

Change-Id: I0a92835407566bd47581c7782039def18d31fe2c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293351
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Allison Howell <allison.howell@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-07-28 19:41:51 +00:00
Paul Gray 9b0e44cbcb Prefer a Resource link's own url in export
why

Previous to g/293521 the lti_resource_links table did not have a url
column. That commit added it, and modified resource links added via RCE
to rely on the url in the resource link. The resource link exporter
wasn't updated to copy this url, instead, using the associated tool's
url. When courses were copied, they use the export/import logic, and so
resource links were being copied without the correct url.

test plan:

Create a course with a single assignment, which is RCE text content.
Inside that text, add a Deep link url chosen from the lti13testtool,
when launching, you'll see that the
`https://purl.imsglobal.org/spec/lti/claim/target_link_uri` claim has a
url with a `deep_link_location` parameter.

Copy the course, and find the same assignmnent you created, and click
the link. The launch should contain the same `deep_link_location`
parameter.

fixes INTEROP-7562

flag=none

Change-Id: I62deea4f9fdc232d9e6069e7f02cd399a3bcd923
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/296776
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
2022-07-27 19:07:59 +00:00
Jackson Howe 228f483cbc Add account calendars api controller
This api will be used by students and admins to see what account
calendars are available (all available calendars, not the calendars
that the user is "subscribed" to). It will also be used by admins to
set account calendar visibility.

Includes a miration to add an account_calendar_visible column to the
accounts table. This is preferable to using a setting on Account since
we'll be querying accounts using this valueas a parameter and prefer
the performance of a column.

closes LS-3253
flag = account_calendar_events

Test plan:
 Part 1: index
 - Enroll a user in a few courses in different accounts
 - GET /api/v1/account_calendars as that user
 - Expect to see an entry for each account where the user has an
   enrollment, as well as all of those accounts' parents, up the chain
 - In the rails console, set one of the account's calendars as hidden:
   account = Account.find(x)
   account.account_calendar_visible = false
   account.save
 - GET /api/v1/account_calendars again, and expect the same result as
   before, but without the hidden account

 Part 2: show
 - GET /api/v1/account_calendars/xyz as the user from before, where
   xyz is the account id of one of the user's associated accounts
 - Expect to see the account calendar details
 - Try to request an account calendar that the user doesn't have
   access to; expect to see 401
 - Attempt to access the hidden account calendar; expect a 401
 - As an admin with the manage_account_calendar_visibility
   permission, attempt to access the same hidden calendar; expect
   success

 Part 3: update
 - As an admin with manage_account_calendar_visibility permission,
   PUT /api/v1/account_calendars/xyz with param visible=<true/false>
 - Expect the visibility to be updated accordingly
 - Try to update visibility as a student (or any user without the
   permission); expect 401

 Part 4: all_calendars
 - As an admin with manage_account_calendar_visibility permission,
   GET /api/v1/accounts/xyz/account_calendars, where xyz is the
   *root account* id
 - Expect a list of all account calendars for the entire
   institution, regardless of visibility status
 - Expect this request to return 401 for students or admins without
   the permission

Change-Id: I0a3bcd58b509c62326b0a885b87ec3f8779fcd37
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/296293
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2022-07-22 21:52:10 +00:00
Joshua Richardson db853abd72 Add database migration for blackout dates
Create a new database migration file to add a boolean variable
to the calendar events that shows whether it is a blackout date
or not. Add a test to make sure this field is there in
spec/models/calendar_event_spec.rb

closes LS-3290
flag=account_level_blackout_dates

Test Plan
 - Open the project in the command line
 - Run `rails db:migrate`
 - Run `rails db:migrate RAILS_ENV=test`
 - Run `rails c`
 - Run `CalendarEvent.last`
 - Notice that the `blackout_date: false,` field is somewhere in the output
 - Run `rspec spec/models/calendar_event_spec.rb`
 - Notice that the tests pass

Change-Id: I4ba40323afe92320cdc69ff7b4fddc43ef30fb50
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/296579
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Joshua Richardson <joshua.richardson@instructure.com>
2022-07-20 21:34:15 +00:00
Jacob Burroughs 75b82ebdd6 Improve score details and grade statistics
Adds median and quartile calculations, and uses them to generate a
proper box and whiskers plot.

fixes GH-1871
fixes GH-1139

flag = enhanced_grade_statistics

test plan:
- Grade an assignment for at least 5 students
- Verify the student view score details show median and quartile
  numbers
- Verify the box plot matches those numbers and looks reasonable

Change-Id: I6ce4b792a112eed72df095503a6f4e82da2912c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242741
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
2022-07-20 13:24:01 +00:00
Tucker McKnight 690007200c Replace old developer key scopes
Several API routes were changed in ceed52fc49.
This data fixup will change the scopes field for any developer
keys that references those API routes, and change them to
the new API routes.

flag = none

test plan:
- Create a developer key, either in the UI or the rails console,
  and limit it to some API routes.
- Temporarily change one of those API routes in config/routes.rb
- Run the data fixup manually, like so:
```
old_route = "url:GET|/api/v1/your_chosen_route"
new_route = "url:GET|/api/v1/what_you_changed_it_to"
change = [ { old: old_route, new: new_route } ]
DataFixup::UpdateDeveloperKeyScopes.run(0, DeveloperKey.last.id, change)
```
- Also see that it works by running the migration (and adding your
  changed route to the list of routes in the migration file).
- Verify that when you look at developer_key.scopes, the route is
  changed.
- Poke around the developer keys page and verify that things still work.
Change-Id: Ia0f522b12e53c424de1ef48d1c5904c5d21bb899
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295903
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Migration-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
2022-07-19 19:18:52 +00:00
Evan Battaglia ce25d3d508 Refresh MS Sync user mappings after email changes
closes INTEROP-6817
flag=none

Why:
- When a user's primary email changes, if the root account is set up to
  use email as the login attribute, mapping which maps the user to the
  Microsoft 365 user will be out-of-date.
- We never delete UserMappings except when changing Microsoft Sync
  settings at an account level so currently this is almost impossible
  for customers to rectify

I didn't want to actually immediately delete a mapping, because if a
CommunicationChannel changes in the middle of a sync, the missing
UserMapping could cause us to remove the user from the Microsoft 365
group, even if the user's primary email has not even really changed (for
instance, if the user added a non-primary email). So instead I use a
needs_updating field.

Test plan:
- Make sure you have an account set up with Microsoft Sync using email
  as the login attribute.
- Make sure you have a course set up with Microsoft Sync, ideally with
  2+ users. Make sure it is successfully synced so that there are 2+
  users in the group visible in Microsoft 365 admin console.
- Look at one of the users who has a account in the Microsoft 365
  tenant and change their primary email address to another email address
  of a another user on the Microsoft 365 side
- Manually sync the course
  (course.microsoft_sync_group.syncer_job.run_synchronously)
- Look in the Microsoft 365 admin console and check that the old user
  has been removed and the new user has been added to the group.
- Change the email address again to something not corresponding to any
  user on the Microsoft side
- Sync again and see that the user has been removed from the Microsoft
  group
- Make sure one of your tests used the API to update the email address
  - add a communication channel with the POST API endpoint, e.g.:
    tok http://canvas-lms.docker/api/v1/users/123/communication_channels \
      communication_channel[type]=email \
      communication_channel[address]=someaddress@example.com \
      skip_confirmation=true
  - remove the old communication channel
    tok http://canvas-lms.docker/api/v1/users/123/communication_channels
    tok delete http://canvas-lms.docker/api/v1/users/123/communication_channels/456
- Repeat the steps above but update a primary email address from a
  SIS import. You should be able to do this by creating a users.csv file
  like this and uploading with "SIS Import" in the account menu (and
  choose the "Override UI changes" checkbox):
    user_id,login_id,first_name,last_name,email,status
    sisuser1,sisuser1login,FirstNameOne,LastNameOne,myemailaddress@instructure.com,active
- from a console, set the needs_updating on user's UserMapping to false,
  then destroy one of the user's email communication channels with
  commchannel.destroy_permanently!
- make sure the UserMapping has gotten needs_updating set to true
- destroy all email communication channels for a user, or make all their
  communication channels something without a user on the Microsoft 365
  side. Sync the course. The user should be removed from the course
  (note that you cannot remove the last course owner), and the
  UserMapping should no longer exist at all.

Change-Id: I9e2f3d5e439bebc8c9eaf89b1595908213dc1981
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294820
Product-Review: Alexis Nast <alexis.nast@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Ben Rinaca <brinaca@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2022-07-18 19:53:35 +00:00
Ed Schiebel 359731d4dc Tweak notifications for recurring event series
closes LS-2805
flag=calendar_series

I do not know how to test the message channels
for sms, summary, twitter

test plan:

for notifications to work the email communication channel
must be confirmed for your student(s).  For the student, do

stud = User.find(student_id)
c = stud.communication_channels.where(path_type: "email")
c.first.confirm

it will help to know how to find messages being sent to students
 in the console:
 Message.where(context_type: "CalendarEvent").pluck(:id, :subject)
 #  find the id with the title of the event you just created
 Message.find(:id)[:body]
 # or for html email
 Message.find(:id)[:html_body]

 in psql canvas_development
 select id, subject from messages where context_type='CalendarEvent' order by created_at;
 -- find the id of with the title of the event ou just created
 select body from messages where id=<message_id>;

  first with a single event
  - as a teacher, create a calendar event in your course
  - inspect the messages table
  > expect a message like
    There's a new event scheduled for Course 1 that you should be aware of:
    etc.

  - now create a recurring event series in your course
  - inspect the messages table
  > expect only 1 message for the event series
  > expect the link in the message to point to the first event
    in the series
  > expect the message to now include text about how it repeats.
  > expect the message "html_body" column to also include text
    about how it repeats

Change-Id: I68b576710896c26bef12d15e2ae44fcc8385564d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295025
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Allison Howell <allison.howell@instructure.com>
Migration-Review: Alex Slaughter <aslaughter@instructure.com>
2022-07-11 20:29:36 +00:00
August Thornton 1a785fcb9d limit subject field input for help dialog ticket form
also, allow arbitrary length to error report's subject column.

closes FOO-2912
flag = none

Test plan:
 • trigger a HelpDialog CreateTicketForm component to render
   the ticket dialog form
 • ensure no more than a generous 200 characters gets posted
   on form submit for the "error[subject]" input

Change-Id: I2c8f32e25bba1a0c5593fac0e6feb66367f8c3be
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295080
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2022-07-05 15:58:07 +00:00
Ed Schiebel 3fd163a375 Recurring events: add update series to calendar_events api
This commit adds the ability to update events in a recurring series.
It should behave like google calendar.
(also slipped in an auth check to destroy_from_series)

when which="one"
- update the one event whose id is in the url
- invalid request if the rrule changed
when which="all"
- update all events in the series
- invalid request if the start_at date changed
  (time is OK)
- if the rrule changed, the series may get more or fewer
  events.
when which="following"
- update the event from the URL and all those after it
- if the rrule changed, the series may get more or fewer
  events
- if the start date or time changed, it creates a new
  series with the updated events

- in all cases, the api returns the updated events
- if a series shrunk as a result, the deleted events
  are not returned by the api.
- if the series spans a DST transition, the wallclock
  time of the event should remain consistent

NOTES: I know nothing about sharding. Did I screw anything up?

closes LS-2804
flag=calendar_series

test plan:
  - with calendar_series site_admin flag on
  - create a recurring event series with the create api
    POST to /api/v1/calendar_events
    the data should be event data + an rrule. For example:
    {"calendar_event":{"title":"abbbaa",
     "start_at":"2022-11-04T12:00:00-06:00",
     "end_at":"2022-11-04T13:00:00-06:00",
     "context_code":"user_1",
     "rrule": "FREQ=DAILY;INTERVAL=1;COUNT=4"}}
  - modify the series with the update api
    PUT to /api/v1/calendar_events/:event_id
    JSON with the new properties. The JSON looks just
    like the create, but with new values in there.
  > expect the returned events (or more easily, refresh
    the calendar in Canvas) to be what you expected
  > expecdt to see only 1 sql UPDATE setting the
    context's updated_at time, no matter how
    many events were updated.

Some interesting test cases
  - the invalid requests (see above)
  - which="following" with a new time
  - which="following' with a new date
  - which="following' with a new rrule
  - which="all" with a new rrule
  - a new rrule that makes the series longer
  - a new rule that makes the series shorter

Change-Id: I9fa6ed0e90887510e9f7a38575dd7aa182e7e09f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293568
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2022-06-15 20:58:15 +00:00