Commit Graph

8795 Commits

Author SHA1 Message Date
balazs.komaromi 977238b035 add sis import batch_mode_enrollment_drop_status
batch_mode_enrollment_drop_status parameter can be used to set different
state than 'deleted' for enrollments that are not included in the
sis_batch.

closes SOS-1968

Test plan:
 - Do a SIS import
 - Remove one or more enrollments from the input CSV
 - Run SIS import again
 - Check the status of the removed rows in Canvas

flag = none

Change-Id: I0a4c5dad14ad4b586138cdb3c7917cc81878cbe7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262802
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Balazs Komaromi <balazs.komaromi@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-05-26 08:48:14 +00:00
Cody Cutrer 8a5e8478ed rails 6.1: update several gems for compatibility
the bundle now installs

Change-Id: I0aa908efa3e18860cb05303d31d41ba27eac7881
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265603
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-25 22:32:39 +00:00
Manoel Quirino Neto 21fc4b9d82 Add bulk move outcome link mutation
closes OUT-4401
flag=improved_outcomes_management

Test plan:
  - Navigate to canvas.docker/graphiql
  - Test moving an outcome link using the mutation bellow
    mutation {
      moveOutcomeLinks(input: {
        groupId: DESTINATION_GROUP_ID
        outcomeLinkIds: [OUTCOME_LINK_ID]
      }) {
        movedOutcomeLinkIds
        errors {
          attribute
          message
        }
      }
    }
  - Assertions:
    - Required arguments: groupId, outcomeLinkIds
    - Assert group/outcome links exists on database
    - Assert can manage group/outcome links
    - If you pass one outcome link that can be managed
      and other that can't, assert it moves that one who can
      and check for the correct movedOutcomeLinkIds and errors response

Change-Id: I976255a1dadb9bb5f9fcb0def52a7b623c4538d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265297
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-05-25 21:12:21 +00:00
Jeremy Stanley 56bccc7b87 sync enrollment roles and dates from homeroom course
test plan:
 - create a custom course role
 - enroll a user with this role in a homeroom course
 - in a subject course, enable syncing enrollments from
   the homeroom course
 - the user should appear in the subject course in the
   same custom role (not the base enrollment type)

flag = none
fixes LS-2255

Change-Id: I61a1f742aa81095187d44837865f9a5231dd8e49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265711
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-05-25 20:42:25 +00:00
Cody Cutrer b459579c9d prep for root_account_id being NOT NULL
refs FOO-1693

Change-Id: I11cc02894ef709cb6183041057a8fa0ac994a882
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265620
Reviewed-by: Jacob Burroughs <jburroughs@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-05-25 19:16:48 +00:00
Jacob Burroughs 0bb01c5e60 Fix deleting published release notes
Change-Id: I70caf606b5aa268d46c17b55217aa1ec7c0d7930
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265712
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-05-25 19:09:51 +00:00
Adrian Diaz 48ff07c356 Translate item banks tab label and apply permissions
closes QUIZ-8300 QUIZ-8301

flag = new_quizzes_account_course_level_item_banks

Please, take in count that cache may affect the result.
Perhaps, you will need to test this in a clean environment
or wait 1 hour before cache refresh tabs.

Also, You'll need an updated lti version running that supports
item banks and course_placement and account placement.

Test plan:

- Log in as Admin
- Go to /uuid.quiz.next and provision
- Enable all "New Quiz"/"New Quizzes" feature options in Site Admin
  and your CANVAS_LMS_ACCOUNT_NAME
- Create a course and verify "Item Banks" appear
- Add a Teacher role user to the course
- Enroll a Student to the course
- Log out and log in as a Teacher
- Go to the course and verify "Item Banks" appear
- Log out and log in as a Student
- Go to the course and verify "Item Banks" doesn't appear

Extra:
- Switch user language in settings
- Then go back to a Course and see "Item Banks" is translated

Change-Id: I296c5ac1a00947530da77cb648bbf0e0953aaff3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264787
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
QA-Review: Stephen Kacsmark <skacsmark@instructure.com>
2021-05-25 18:48:14 +00:00
Cody Cutrer f0335e3bd9 ensure dummy course is marked as soft deleted
Change-Id: Id70c046f85d5ad8d777e11d2db1bc6810974e2ae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265699
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-05-25 17:30:25 +00:00
Cody Cutrer f1b857bff8 feature flag to disable self service user merge
closes FOO-1906

Change-Id: I7375fede11e02a98c11cb3b3e777a57af13dc752
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264564
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2021-05-25 15:54:52 +00:00
Jeff Largent d33e54d3cd Remove canvas_for_elementary feature flag
This change removes the canvas_for_elementary feature flag, making all
K5 functionality based off of the canvas for elementary account
setting instead. It also adds a warning banner to the canvas for
elementary account setting and removes the "beta" indicator.

closes LS-2213
flag = canvas_for_elementary

Test plan:
  - Go to the settings page of a non-K5 account as an admin
  - Check the "Canvas for Elementary" setting
  - Expect a warning message to appear with a link to the C4E focus
    group FAQ
  - Un-check the "Canvas for Elementary" setting
  - Expect the warning message to go away

  - General regression of C4E functionality
    * Ensure that the dashboard still gets loaded as expected only for
      users that are associated with an account that has C4E on for
      all users
    * Ensure that courses still render with simplified navigation (for
      students), home page, and elementary theme when associated with
      a C4E account

Change-Id: I80c6b61265ff3dc91a3de2b7bb9ca490e7fc7b5f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265421
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: Peyton Craighill <pcraighill@instructure.com>
2021-05-25 13:39:59 +00:00
Evan Battaglia 43b82e9f1a MSFT Sync refactor: move enqueue_future_sync
refs INTEROP-6804
flag=microsoft_group_enrollments_syncing

This is necessary because StateMachineJob will allow an initial
argument; the enqueue_future_sync strand would need tohave the argument
in it. This isn't necessary because we only use it in for enrollment
changes in the Group, so it's easiest to remove it from SMJ. Also SMJ is
big enough as-is.

Test plan:
- add/remove an enrollment on a course with a MicrosoftSync::Group
- in a console do this:
  def thejobs(group)
    Delayed::Job.where(
      strand: "MicrosoftSync::Group:#{group.global_id}:enqueue_future_sync"
    ).to_a
  end
- check thejobs(group) and see that there is one job with a run_at time of 10
  minutes.
- Make another enrollment change. Check thejobs(group) again to see that
  there is still only one job, but it has been moved up 10 minutes in the
  future.
- Run a jobs container and wait 10 minutes (or run
  Setting.set('microsoft_group_enrollments_syncing_debounce_minutes', 1)
  and wait 1 minute) and make sure the sync happened (e.g. look at the
  Microsoft admin to see that the users have been added/removed)

Change-Id: Ife02ab22c19fab54a2d96392523ef1e2ffc7499c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265388
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-05-21 18:52:52 +00:00
Jeff Largent 7d71e6dc8f Fetch K-5 dashboard announcements and apps in batches
Updates the latest announcement-fetching logic for the K-5 dashboard
homeroom page to retrieve all announcements in one request. A new
"latest_only" parameter was added to the announcements API in order to
support this.

Also updates the dashboard_card logic for the K-5 dashboard to not
show any info associated with courses with outstanding invitations.
This means that if a user has not accepted an invite to be enrolled in
a course, that course should not show up anywhere on the K-5
dashboard.

fixes LS-2227
flag = canvas_for_elementary

Test plan:
  - Log in as a teacher enrolled in a homeroom course and subject
    course
  - Create announcements for both of those courses (if recent
    announcements don't already exist for them)
  - Expect the homeroom announcement to show up at the top of the
    teacher's dashboard (like it did before this change)
  - Expect the subject announement to show up on the bottom of the
    subject course card on the dashboard (like before)
  - Log in as a student enrolled in the same courses and ensure that
    both announcements show up as expected on their dashboard too

  - Invite a student or teacher to a L-5 subject course that they're
    not already in
  - Log in as the invited user and go to their dashboard, but do not
    accept the invite yet
  - Except to not see cards, LTIs, grades, or planner items associated
    with that course

Change-Id: I8fae07ec101ff34811f42e05e1f1845e76f482b7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265234
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: Jeff Largent <jeff.largent@instructure.com>
2021-05-21 17:52:18 +00:00
Cody Cutrer a6932908f3 fix csp specs if account_chain has been loaded
Change-Id: I1e599f240ca61907fc25a0e3f6b167fcdbe50f0e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265202
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-21 16:10:31 +00:00
Dustin Cowles fa8e5bc280 update SubmissionComment.reply_from to use submission.add_comment
closes EVAL-1602
flag = none

Test Plan:
- teacher must have email notifications for submission comments enabled
- create an auto-posted assignment
- as student, submit the assignment and leave a comment
- as teacher, reply to the comment notification email
- as student, verify comment reply is visible on submission details page

Change-Id: Ia0213fc1e433192b8e7d75f5ce7739ff52ab47d3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264716
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-05-21 15:53:48 +00:00
Jackson Howe defc9bbac0 Add important info section to k5 subjects
g/264712 adds the important info section to k5 dashboards; this change
does the same for k5 subjects. Moves the resources page theme
overrides to k5-theme.js to keep all theming variables in one place.

closes LS-2202
flag=canvas_for_elementary

Test plan:
 - Open up a k5 subject without a syllabus and click on resources tab
 - Expect to see loading skeletons for both important info and apps
   sections
 - On load, expect the important info section to disappear (since
   there's no syllabus content)
 - Go to manage course as a teacher
 - Click "Important Info" in the course nav
 - Expect all references to "Syllabus" to be replaced with "Important
   Info"
 - Edit the important info
 - Go back to the subject's resources tab, expect the new content to
   appear there
 - Expect a teacher to have an edit button

Change-Id: I3e7db8a67098cf4859b6f2ff170834de61c3c387
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265092
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: Peyton Craighill <pcraighill@instructure.com>
2021-05-20 22:12:43 +00:00
Jeremy Stanley 2db8de77d6 allow related attachment UUID to be used as verifier
this is intended to mitigate an issue where the source
verifier remains in the URL after a course copy

test plan:
 - have a course wiht a file
 - copy the course
 - as an unauthenticated user, construct a URL to the new
   course's copy of the file with the old course's file's uuid
   as a verifier, i.e.
   /courses/2/files/2/download?verifier=`file1.uuid`

refs LS-2225

Change-Id: Id7e61e2baa817b25f83cc125843ace70a5bf0497
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265196
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-05-20 20:14:03 +00:00
Cody Cutrer f6f48c5764 fix bugs with persist_inferred_authentication_providers
when all specs are run with the flag on, several issues were found

Change-Id: I69927392131bc05842e66f8ccec9ad214db64350
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265190
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-05-20 19:49:50 +00:00
Rob Orton 349550aef4 truncate long conversation messages from email
Change-Id: Ie093567439b5b2489e6d049962cd3f138dfc0cc4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265349
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-05-20 15:24:54 +00:00
Rob Orton 32ecb785da fix 500 level errors in reply_from methods
fixes VICE-1426
fixes VICE-1427

flag=none

test plan:
- specs should pass

Change-Id: I776b51810b672d49dab106bec76a88666ae5e6f7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265345
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-05-20 15:23:52 +00:00
Simon Williams e1c35a85e0 require at least 1 enrollment or account_user to create eportfolios
closes FOO-1897

test plan:
- create a new user, they should not be able to create an eportfolio
- add them to a course, now they can
- OR add them as an account admin, now they can

Change-Id: Ib18d1ccbfef7c5aff3e977c017ec471312867049
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263432
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2021-05-20 01:49:05 +00:00
Alejandro Garrido 539a66d660 Flag submission_type_tool_placement was removed entirely
The flag submission_type_tool_placement was
Removed entirely, and now it’s not being shown
at admin account feature options.

fixes LS-1977
flag=none

Test plan:

-
1.Go to site admin account feature options.
2.Look for the Submission Type LTI Placement
3.Expect the flag is not being presented.
4.Create new assignment in a course.
5.The field should not be present.

Change-Id: I2092001401614f7d99526676e9e4bd72f5baadc8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265021
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: Americo Garrido <americo.garrido@instructure.com>
2021-05-19 20:58:19 +00:00
Rob Orton 0534b823f8 move broadcast_policy to mention object
test plan
 - create a mention
 - it should send a message

refs VICE-1254
flag = none

Change-Id: I92d3cecc6eebba12893f40e96448a7d44326764a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264876
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@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>
2021-05-18 20:34:43 +00:00
Jackson Howe fd72fea924 Show latest announcement on k5 subject home
If an announcement is visible from the last 2 weeks, show it on
whichever k5 tab is set to be the home. Announcement details are sent
with the ENV since it should be visible immediately on load.

closes LS-2208
flag=canvas_for_elementary

Test plan:
 - As a teacher, create an announcement (with an attachment) in a
   subject
 - Load the subject home - expect to see the announcement at the top
   of the main tab with a link to attachment and an edit button (if
   teacher)
 - Switch the main tab in subject settings
 - Load the subject home again - expect the announcement to appear on
   the new main tab

Change-Id: Iadd375881098730cd56674af1a9335e73a112829
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264813
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-05-17 17:59:39 +00:00
Cody Cutrer 9c85580737 fix course permission checks for cross-shard students
fixes FOO-1793

test plan:
 * have a student from shard 1 enrolled in a course on shard 2
 * the teacher of the course should be able to see the Pair with Observer
   button on the people details page in the course for the student

Change-Id: I90545e7b3bef53526d92e461cf77676eb78d8787
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264837
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-05-17 16:28:46 +00:00
Gary Mei 59e37fb2c8 fix moderated grading for student annotation
fixes EVAL-1603
flag=annotated_document_submissions

Test Plan
- Create a moderated, student annotation assignment with number of
  graders set to 2.
- As a student, annotate and submit the assignment.
- As Provisional Grader 1, verify that the student submission appears
  in SpeedGrader, verify that making annotations are possible, and
  leave a grade.
- As Provisional Grader 2, verify that the student submission appears
  in SpeedGrader, verify that making annotations are possible, and
  leave a grade.
- As a non-final grader, separate from the provisional graders above,
  verify that the student submission appears in SpeedGrader, and
  verify that making annotations is NOT possible.
- As the final grader, verify that leaving annotations is possible,
  then go to the Moderate Grades page and select a provisional
  grader's score for the assignment. Release and post grades. Verify
  that the student's and selected provisional grader's annotations
  appear.

- Test with any combination of moderated assignment options.

Change-Id: Ide747a19a36ae7988239e8d1987be897c9302214
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263233
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jody Sailor
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
2021-05-17 15:06:32 +00:00
Jackson Howe a386d399ac Add important info section to k5 resources
Under the resources tab of k5 dashboard, add a section called
`Important Info`. This shows the syllabus content from each homeroom
course. Renames everything called `Syllabus` to `Important Info` in
homeroom courses. Shows an edit button next to important info to
users with edit permissions. Only shows the title of the homeroom
course if there's more than one homeroom being displayed. Shows
loading skeletons for all sections under resources tab. Adjusts
styling of apps and staff info sections to make them look better.

closes LS-1769
flag=canvas_for_elementary

Test plan:
 - As a teacher, go to a homeroom course. Expect course nav to have
   an `important info` button.
 - Go to important info page (i.e. /assignments/syllabus). Expect
   page title, breadcrumbs, sidebar, and page content to all read
   `important info`, not syllabus.
 - Expect help text to read `You can add important information here
   that you want to display under the Resources tab in your homeroom`
   when syllabus is blank.
 - Add some syllabus content.
 - Go to dashboard resources tab.
 - Expect to see some loading skeletons for each section.
 - Expect to see syllabus rce content on load.
 - Expect to see edit button that takes you to the syllabus iff you
   are a teacher/admin.
 - Expect not to see the homeroom title.
 - Enroll in another homeroom and add some syllabus content.
 - Expect to see both important infos on the resources tab with a
   homeroom name above each (since there's more than one).
 - Delete the syllabus content from both homerooms. Expect the
   important info section to be entirely gone.

Change-Id: Iaaed03976108fc0d9878e0ab6da4d8f88876c12f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264712
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: Peyton Craighill <pcraighill@instructure.com>
2021-05-14 21:11:01 +00:00
Pat Renner 48833bd85d scope comment library to users rather than course + user
closes EVAL-1677

flag=assignment_comment_library

test-plan:
- enable feature flag
- launch speedgrader for a course
- add a comment to the comment library
- open speedgrader in another course
- verify the comment you added before is shown
- verify deleting a comment removes it from the library
and the comment is no longer visible in either course

Change-Id: Iaa1c5f78f8ff171c8fbba787241b85589c252a1e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264553
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Pablo Gomez <pablo.gomez@instructure.com>
Product-Review: Jody Sailor
2021-05-14 16:51:43 +00:00
Jacob Burroughs a6ea5fa1b2 Release notes unread tracking
Fixes FOO-1757
Fixes FOO-1758

Change-Id: I4c16ee82372751daee146172f70f91336a5fa310
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264578
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
2021-05-13 22:56:07 +00:00
Cody Cutrer 4714915683 allow requiring MFA per-auth-provider
closes FOO-1520

test plan:
 * go to auth providers page; notice that there are no MFA settings
 * set MFA to optional on the account
 * there should now be a checkbox on the auth providers page for each
   provider to make it required
 * make it required for canvas auth
 * ensure your login is explicitly associated with canvas auth
 * log in to canvas again via canvas auth
 * it should make you set up MFA

Change-Id: Ied6068ad282bde831964259bdd39721bf81c87fe
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264543
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-05-13 18:04:09 +00:00
Eric Saupe 46b4a0ce2e Allow courses to sync enrollments with a homeroom course
Having a course sync enrollments from the homeroom it is associated with
while in K5 mode will make it easier to manage many courses that are
part of the same homeroom group. This adds a nightly sync as well as a
manual trigger from within the subject courses to sync enrollments from
the attached homeroom course.

flag = canvas_for_elementary
closes LS-2181

test plan:
- Turn K5 mode on for an account
- Create a course and set the course to be a homeroom course in the
 course settings
- Enroll a teacher and a student in the homeroom course
- Create another course
- In the course settings, select Sync enrollments from homeroom
- Select the first course in the dropdown
- Save the settings
- Verify the enrollments have been copied from the homeroom course

Change-Id: I30416d72d2d2b0f5be5826cc1fa86baab5d217c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264491
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-05-13 17:52:25 +00:00
Jonathan Guardado 05ea9930de Teacher edits course v2
The ManageCourseTray component used for the V1 edit mode was
removed; instead a href is now being used to redirect the user to the
course settings path, also the application layout has been modified
to remove from the UI the breadcrumb and home tab of the nav menu
when user is in k5 mode.

fixes LS-2179
flag=canvas_for_elementary

Test Plan:
- With K5 mode enable, go to a course as a teacher of that course
- Click on the “Manage Subject” button at the top left corner:
- Expect to be redirected to the course setting page
- On the course settings page:
- Expect the Home tab not to be on the nav menu.
- Expect the breadcrumb not to be on the screen; instead a
button "Back to Subject" should be in its place.
- Click on the "Back to Subject" button
-Expect to be redirected to the home course page

Change-Id: Ic949c3395dc7e6cf43dd43fe2583c1e23f5c3e72
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264764
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: Peyton Craighill <pcraighill@instructure.com>
2021-05-13 17:52:16 +00:00
Omar Gerardo Soto-Fortuño 8486c4fffe Fix issue w/duplicating discussion topics as admin
Test Plan:
 - Spec pass

flag=none

Fixes VICE-1414

Change-Id: I9c7211d6df2b6b7e51ddbce51e6c43af57dad6c3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264906
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-05-13 16:28:35 +00:00
Caleb Guanzon a215e0f4fc fix 500 level errors in discussion helpers
fixes VICE-1426
fixes VICE-1427

flag=none

test plan:
- specs, old and new, pass

it seems like this is only a helper
method for when quickly writing specs
and stuff. so risk is very low

Change-Id: I4fe474ade6b1acfba0074135489add4d0bf464c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264850
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>
2021-05-12 21:52:36 +00:00
Cody Cutrer d99eb9dc50 "sticky" pseudonyms to particular auth providers when a user logs in
it's becoming more and more important to know which auth provider a
pseudonym belongs to

Change-Id: If5195422d982d2ecea9b45658da9debac045a2ed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264544
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-05-12 16:56:32 +00:00
Cody Cutrer 0e7429b116 actually create the dummy course for course templates
fixes FOO-1962

Change-Id: Ia95ed7df67af812ad63fcd16103cf3c9c157851d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264717
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-05-12 16:45:47 +00:00
Weston Dransfield e122c2fab0 Revert "restrict external tool API based on visibility"
This reverts commit aa3a2ecd05.

Reason for revert: Does not handle global navigation

AND

Revert "restrict tool launches based on visibility"

This reverts commit 181cab70ed.

Reason for revert: Does not consider global navigation launches

Change-Id: Icf7093d0c61c0e1e192278b1087a7995d50a73e3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264763
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2021-05-12 02:13:34 +00:00
Jeremy Stanley 457898f814 don't associate accounts via rejected/inactive enrollments
test plan: users do not get account associations through inactive
or rejected enrollments

refs LS-2154

Change-Id: Ia9a2e00cd0625efaff049a386480a4a0ab7f178a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264665
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: Jeremy Stanley <jeremy@instructure.com>
2021-05-11 20:02:10 +00:00
Jeremy Stanley 7fc059ffd4 don't keep subaccount associations for concluded enrollments
test plan:
 - enroll a user in a homeroom course in a K-5 subaccount
 - the user should see the K-5 dashboard
 - conclude the student's enrollment in the homeroom course
   (e.g. by soft- or hard-concluding the course; note that
   if you soft-conclude the course, you may need to wait
   up to 5 minutes beyond the course's conclude_at date before
   the enrollment_state cache is updated by
   EnrollmentState.recalculate_expired_states; be sure that
   jobs are running and the queue isn't backed up)
 - update the user's account associations, e.g.
   `user.update_account_associations`
   (note that, in production, a periodic job updates all the
    user account associations weekly on Sundays)
 - the student should no longer see the K-5 dashboard

flag = canvas_for_elementary
closes LS-2154

Change-Id: Ie772aea6cadbd340784554f950c718656eeac83a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264560
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: Jeremy Stanley <jeremy@instructure.com>
2021-05-11 14:42:52 +00:00
Marek Materzok d8b3dcdac3 Add federated attributes support for CAS logins
closes gh-1718

Change-Id: Ic6601b6254b68e327e0e2e1ef50e1982918f87a8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264530
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-05-10 17:54:35 +00:00
Jeff Largent 3566820b51 Allow K-5 subject home tabs to be configured
This change replaces the normal course nav tabs in the Navigation
section under course settings with the tabs/LTIs that appear on the
home page when in a subject course. It introduces a new option
`course_subject_tabs` to `course#tabs_available` that determines
whether course nav or subject nav tabs should be returned.

closes LS-2176
flag = canvas_for_elementary

Test plan:
  - Log in as an admin or teacher
  - Set up a course with a couple of LTIs available. Start with the
    canvas_for_elementary flag off or the account K-5 setting off.
  - Go to the navigation section in the course's settings and move the
    tabs around a bit, then save. Move one of the LTIs to the top or
    near the top (above modules / grades). Potentially hide one or two
    of them.
  - Turn K-5 mode on for the course's account.
  - Go back to the navigation section in the course's settings, and
    expect to only see "Home", "Schedule", "Modules", "Grades", and
    the LTIs. Expect the order and hidden/shown state to be preserved
    from before, except that "Home" and "Schedule" should be the first
    two tabs. Also expect the LTIs to always be at the bottom.
  - Move the tabs around and show/hide some, and expect them to
    persist this configuration when saved. Expect LTIs to always
    appear at the bottom of the show/hide sections.
  - Expect the course nav in the sidebar to always be the default and
    be unaffected by the changes you're making the navigation settings
  - Turn K-5 mode back off for the course's account.
  - Expect the order and show/hide configuration of the "Modules",
    "Grades", and LTI tabs to be preserved. Expect "Home" to be at the
    top and "Schedule" to be gone.

Change-Id: I48c662596431b18339482ba294fcd923ced6a230
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264226
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: Peyton Craighill <pcraighill@instructure.com>
2021-05-10 16:43:08 +00:00
Jacob Burroughs c8ad1dea91 Show the help tray for everyone
Change-Id: Ieb9e8675f939d93d65dd496f010ab23658cb5a4a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264510
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-05-10 15:27:04 +00:00
Jacob Burroughs e6ca5a7208 Release notes editing UI
fixes FOO-1749
fixes FOO-1753
fixes FOO-1754

test plan:
- Enable dynamo locally
  - See docker-compose/dynamodb.override.yml
  - See config/dynamic_settings.yml.example
  - See config/vault_contents.example
- You should be able to created/edit/delete and publish/unpublish release notest check

Change-Id: Id34a9abff807dbdaa884df6c0f4e4b8c43876b47
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263405
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-05-10 13:57:06 +00:00
Rob Orton 6bed78d73c use defined notifications for validation of edit
test plan
 - updating notification preferences should work

fixes VICE-1441
flag = none

Change-Id: Ifcb5bc996365523e9f33a0a15f5951ffa5f9e84f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264475
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-05-08 03:59:42 +00:00
Spencer Olson 9d70637ae3 destroy annotation contexts on submission destroy
closes EVAL-1669
flag=none

Test Plan:
1. Log in as an admin or teacher and go to a course.
2. Click the "Student View" button in the top right.
3. As the test student, submit to a student annotation assignment.
4. After submitting, click the 'Reset Student' button in the pink
   banner at the bottom of the page. Verify the student resets
   successfully without any errors being shown.

Change-Id: Iafc6686f4bed8e3a4ce68a070fc222543aea3509
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264377
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
2021-05-07 17:23:23 +00:00
Adrian Packel 55241736c8 Set grader ID for non-current quiz submissions
fixes EVAL-1645
flag=none

Test plan:
- Create a quiz with multiple attempts
- As a student, take the quiz once and submit
- As the same student, start the quiz a second time, and partially
  complete it, but do not submit
- As a teacher, open the quiz in SpeedGrader and assign a score to the
  completed quiz (by, e.g., setting fudge points)
- In gradebook history, the resulting change should show the teacher as
  the grader

Change-Id: I1c99abe6fc2a29bac3c6e4fbbe2b08034bf1aabb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264245
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Product-Review: Jody Sailor
2021-05-07 16:49:05 +00:00
Jeremy Stanley a578221872 don't clean up Ignores for users with concluded enrollments
because apparently they still see these items in the todo list,
and this only makes them reappear overnight after being X'd out

test plan:
 - a teacher who sees todo items for a course in which her
   enrollment was completed_at > 6 months ago should be able to
   get rid of them by clicking X, and they should not reappear
   after Ignore.cleanup is run

flag = none
fixes LS-2200

Change-Id: Ic1fe0c3325d6e32ee553b8a0251ea302de33d0c2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264296
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>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-05-06 22:18:13 +00:00
Adrian Packel aa6dc6b9fc Don't consider draft comments postable
fixes EVAL-1615
flag=none

Test plan:
- Have a course with multiple students
- Create an assignment and set it to post manually in gradebook
- Leave a draft comment for a student in SpeedGrader
- Both Gradebook and SpeedGrader should still show "No grades to post"
  and not allow posting grades
- Submit the draft comment
- Posting should now be allowed

Change-Id: Ieabf90121d320a12d26f8a417e1805aed2cd1582
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263992
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
Reviewed-by: Syed Hussain <shussain@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
2021-05-05 21:36:39 +00:00
Rob Orton 37e132802d create notification preferences for mentions
test plan
 - open notification preferences
 - it should show the mentions

fixes VICE-1253
flag = none

Change-Id: I926c93a89d0200a508ec445745a7d3ffd5e48549
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264216
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@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>
2021-05-05 19:02:14 +00:00
Augusto Callejas 540fd63894 Optimize for_context queries for accounts
fixes OUT-4382

flag=none

Replaced a join between content tags and a union of account
and course content tags with a single union of account and
course content tags.

See blog link in the comments of the Jira issue above for more details.

test plan:
 - confirm that viewing account outcome alignments, that both
   account-level and course-level alignments appear
 - this can be tested by creating an account outcome, aligning
   it to an account rubric, then importing the outcome into
   a course, then aligning the outcome to a course rubric,
   then viewing the outcome in the account outcomes page

Change-Id: I3b1a5ead325cdcf8720351e744b3d484813e55dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264212
Reviewed-by: Manoel Quirino <manoel.quirino@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-05-05 18:18:37 +00:00
Rob Orton 407745792a sort allowed notifications
test plan
 - specs should pass

refs VICE-1253
flag = none

Change-Id: Ide41265eb0dadad8678d7ac747439296b1b82449
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264256
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
2021-05-05 17:56:17 +00:00
Rob Orton 48d17e51d6 create broadcast policy block for mentions
test plan
 - manually create a mention and entry in console
 - call the aftershave callbacks
 - it should send a mention notification
 - see specs for how to

fixes VICE-1252
flag = none

Change-Id: I7cbbfc03e6b94348cd5d1ab951a50c1dc6354de4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264107
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
2021-05-05 15:36:41 +00:00
Rob Orton bef5539842 parse entries and create mentions
test plan
 - specs should pass

we will likely need to modify the selector as we nail down the format
for sending the mention from the rce to discussion_entry.rb, but the
general mechanisms will not need to change.

closes VICE-1248
flag=none

Change-Id: I2d4c44ce6a37fb1e5c1c09cc4ef3431e6d4205fe
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264133
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
2021-05-05 15:06:16 +00:00
August Thornton 62a93ace8a allow show user create course button for special case
we want to show the "show user create course" button if we're
checking rights against the manually created courses account,
the user has an active enrollment somewhere within the account
chain that grants :manage_courses:add permission

fixes FOO-1930
flag = granular_permissions_manage_courses

test plan:
 • enable :granular_permissions_manage_courses feature flag
   for the root account
 • allow :manage_courses_add for an active teacher enrollment
 • log in as that user and verify the "Start a New Course"
   button appears on the right-side Nav on their Dashboard
   page

Change-Id: I77bad8201718b0ca602b9c630d5fb6b39bc0f029
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264082
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-05-05 14:40:17 +00:00
Rob Orton 0f3bce393d create mentions model
test plan
 - rake db:migrate should work

closes VICE-1251
flag = none

Change-Id: I7110c2c7f2687cb26d58d009d712035d605ece56
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264096
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
Reviewed-by: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
QA-Review: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
Product-Review: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
2021-05-04 18:35:40 +00:00
Chrystal Langston cff9f90568 Add create learning outcome mutation
closes OUT-4374

flag=improved_outcomes_management

test plan:
- Navigate to canvas.docker/graphiql
- test creating a learning outcome for both the
Account and course context
> mutation {
  createLearningOutcome(input: {
	groupId: 19, //(will need to update to valid group id)
	title: "Spec Learning Outcome via Mutation"
   }) {
    learningOutcome {
      _id
      id
      title
      displayName
      description
      vendorGuid
      contextType
      contextId
    }
    errors {
      attribute
      message
    }
  }
}
- verify an error is returned if you do not supply the
Following arguments:
> groupId and title
- verify an error is returned if a group id is supplied
that does not exist for the given context
- verify that if you supply more than 255 characters
You receive an error for the following arguments:
> title, displayName, and vendorGuid
- verify permissions by:
> login to the graphiql endpoint as a student
> verify the create mutation is not supported
as the manage_outcome permission is required

Global context
  - confirm as a teacher, that you cannot create
    global learning outcomes in a global group
  - confirm with your admin account, that you
    can create global learning outcomes in
    a global group

Change-Id: I8e15ab84ce1350ebc82df213d0b2b0c1d03b1146
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263119
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Reviewed-by: Manoel Quirino <manoel.quirino@instructure.com>
QA-Review: Pat Renner <prenner@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-05-04 15:42:43 +00:00
Xander Moffatt 5c7dc06da4 MSFT sync: run job on enrollment changes
closes INTEROP-6573
flag=microsoft_group_enrollments_syncing

test plan:

Jobs scheduling
* have a course with a msft sync group set up
* add a user to that course (ie, change or add an enrollment),
preferably a user that has a matching MSFT user (see MSFT tenant)
* find the sync job scheduled for 10 min in the future with:
`Delayed::Job.where("strand like ?","%enqueue_future_sync%").first`
* wait a minute
* add/remove another user to the same course
* that same job should now have a new run_at time, 10 minutes from the
second enrollment change
* repeat the same with a batch enrollment update, by adding a couple of
users to a specific section of that course, and then deleting the
section
* that same job should be scheduled for 10 minutes in the future

UI
* add/remove a user to that course
* go to the course settings page, and to the Integrations tab
* Status should say "Sync auto-scheduled"
* You should be able to manually sync
* Click Sync Now to manually start a sync job, confirm the UI behaves
as before
* add/remove another user to the course to auto-schedule another job
* Status should say "Sync auto-scheduled"
* You should not be able to manually sync, since the cooldown is still
in effect

Change-Id: Iec65e5bda63d38b701109350156d075b5065c34b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263485
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
2021-05-04 15:32:33 +00:00
Violet Baddley 18ac4e7d33 allow external_tool assignments to submit through the API
This removes the restriction that LTI assignments can't be submitted
through the main API, which is helpful for MasteryConnect
integration.

closes MCE-13157
flag = none

Test plan:

1. Create an assignment, with an LTI 1.1 tool as the submission type.

2. Take note of the course and assignment ids, as well as the id of a
   student in the course who we'll be submitting for.

3. As an admin, send an API request to post a submission:

       POST <canvas host>/api/v1/courses/<course id>/assignments/
       <assignment id>/submissions

       submission[submission_type]: basic_lti_launch
       submission[url]: https://app.masteryconnect.com/lti/v1.1/launch
       as_user_id: <student id>

   The actual submission URL doesn't matter for this test, because we
   won't be needing to open it up for grading. In real usage, this URL
   will be particular to the individual student's responses.

   The API request should come back OK.

4. For completeness, you should now be able to use the API to grade
   the submission:

       PUT <canvas host>/api/v1/courses/<course id>/assignments/
       <assignment id>/submissions/<student id>

       submission[posted_grade]: <some point value>

   and that should come back OK as well. However, this step isn't
   strictly related to this changeset, as it already works for
   external_tool assignments upstream.

Change-Id: I5154a8e9f65329ca98efde9bd5af3532de47c3ae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263872
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2021-05-03 21:33:03 +00:00
Pat Renner 5499e17d52 add comment bank item mutations
flag=assignment_comment_library

closes EVAL-1608

test-plan:
- visit canvas.docker/graphiql (or equivalent non-docker
version)
- test the create and delete mutations for a specific course
> mutation MyMutation {
  createCommentBankItem(input: {}) {
    commentBankItem {
      _id
    }
  }
}
- verify an error is returned specifying that
courseId, comment args are required
> mutation MyMutation {
  createCommentBankItem(input: {courseId: "<courseId>",
comment: "comment 1"}) {
    commentBankItem {
      _id
    }
  }
}
- verify no errors are returned
> mutation MyMutation {
  deleteCommentBankItem(input: {}) {
    commentBankItemId
  }
}
> verify an error is returned specifying that
id is a required argument
> using the id returned above, run
mutation MyMutation {
  deleteCommentBankItem(input: {id: "<id>"}) {
    commentBankItemId
  }
}
- verify no errors are returned
- run the delete again
- verify an "Unable to find CommentBankItem"
error was returned
> login to the graphiql endpoint as a student
> verify the create mutation is not supported
as the manage_grades permission is required

Change-Id: Ib3433c5a36d618bfebaedc7d24fc1472f9261e30
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262986
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Augusto Callejas <acallejas@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-05-03 20:09:58 +00:00
Ethan Vizitei 2244ec98ab AUA writes on message bus
closes FOO-1835
closes FOO-1837
closes FOO-1838
flag=none

TEST PLAN:
  1) enable aua on pulsar
  2) all aua log messages that go to the
     db also get sent to a pulsar topic

Change-Id: I0f90ab7c8aa32376a122e30a1c104a1651a507bf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263930
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-05-03 16:33:02 +00:00
Eric Saupe 972c3bb048 Support course subject tabs
Adds support for a subset of tabs to be used for K5 subject courses
when include[]=course_subject_tabs is sent. This is to support an
optional param for backwards compatability with courses that suddenly
become K5 courses.

fixes LS-2187
flag=canvas_for_elementary

test plan
- Enable Canvas for Elementary for the account and course
- Go to /api/v1/courses/COURSE_ID/tabs?include[]=course_subject_tabs
- Verify the tabs are Home, Schedule, Modules, and Grades.
- Remove the include[] param and make the request again
- Verify the results are the default course tabs

Change-Id: I915ed3da63dfcd11359d2b7fa684c003b204132c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263887
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-05-03 15:48:16 +00:00
Rob Orton 957e6417da create discussion_topic#address_book_context
returns context relative to the user and topic

test plan
 - group topics should return the group
 - course topics should return the course
 - section_specific topics should return the sections

fixes VICE-1242
flag=none

Change-Id: I1a4e648d3526f343574f588689dc6eece7f91e1c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263805
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@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>
2021-05-02 22:28:50 +00:00
Ryan Hawkins 1e214ae35e Show Account settings and edit MSFT Sync settings
Added an endpoint that allows you to view the specified accounts
settings, as long as you're authorized.

In addition, update the update_api action to allow updating Microsoft Teams
Sync settings, namely :microsoft_sync_enabled, :microsoft_sync_tenant,
and :microsoft_sync_login_attribute.

closes INTEROP-6631, INTEROP-6630

test-plan:
- Ensure you have an authorization token with AccountAdmin privileges or
  higher.
- Using curl/Postman/Insomnia, try to enable Microsoft Sync with the
  feature flag disabled. Ensure a 400 is returned.
- Enable the :microsoft_group_enrollments_syncing feature flag
- Try to enable Microsoft Sync without a tenant or login_attribute and
  ensure a 400 is returned. Gotta have that info
- Try to enable Microsoft Sync with an invalid login_attribute. Choose
  any random string at all. Ensure you get a 400.
- try to enable Microsoft Sync without a valid tenant/domain name, such
  as "://$$$$$", or "invalidtenant-". Ensure a 400 is returned.
- Enable Microsoft Sync with a valid tenant and login_attribute. Ensure
  a 200 is returned.
- Try and modify settings as an unauthenticated user. You should get
  back a 401.
- To test the show settings endpoint, make sure you have some account
  settings set.
- Try to access the account settings as an unauthenticated user. Make
  sure you get a 401.
- Access the account settings as an authorized user (Account Admin).
  Ensure that you get back a JSON object that represents all of your
  current account settings.

flag = microsoft_group_enrollments_syncing

Change-Id: Ib785987621e090a80ffa63fb48be3ed63243fe56
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261189
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
2021-04-30 23:05:18 +00:00
August Thornton 0c439d0847 add backend permission changes for manage courses granulars
closes FOO-1745

flag = granular_permissions_manage_courses

test plan:
 • see g/261805 for test plan

Change-Id: I683db559d923b93b8dfb9cfd7552d90a15a48ff9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261094
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: August Thornton <august@instructure.com>
2021-04-30 21:29:00 +00:00
Han Yan 0d959f9f46 fixes NQ auto-submit late status
closes QUIZ-8255
flag=none

test plan:
- create a NQ with a close due_at and until dates
- take the quiz as a student and wait for an auto submission
- on Canvas grade page (/courses/:course_id/grades/:student_id),
  the submission should not be marked as late

Change-Id: I0e3d8fc662cc8a68c8520dd1018207685801fce1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263229
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jared Crystal <jcrystal@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
2021-04-30 18:56:40 +00:00
Cody Cutrer cba2510076 exclude deleted users from being found in general
but still let site admins see them

Change-Id: I643e365c26061e3f7c9e4835d5b6300d9cc424a8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263659
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-04-29 19:07:35 +00:00
Xander Moffatt dae478b289 rescue from feature flag undefined in specs
* this prevents the need for checking for flag existence before calling
feature_enabled?, or the need to add real flags to the stubbed flags
in feature-flag-specific tests

refs INTEROP-6573
flag=none
[pin-commit-multiple_root_accounts=748b8bbe3d06c71f74e46e72bffd3fb17d388ea7]

test plan:
* specs

Change-Id: Ic6a7d32c1aea10671e6929f87202513e00fe8715
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263798
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>
2021-04-29 17:49:21 +00:00
Kai Bjorkman 7db88f57f5 set graded_at when late_policy_status changes
closes EVAL-1317
flag=none

Test Plan:
- have a course with a few students enrolled with an assignment
- manually change one student's status to 'missing'
- manually change one student's status to 'late'
- manually change one student's status to 'excused'
- grade one student with a score
- check in the ruby console that each corresponding submission got the
 the graded_at field set to the correct time

Change-Id: I2ec1d2362c39ed861e3aed98b982a3e9ce36a899
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263709
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-04-29 15:58:44 +00:00
Evan Battaglia 347644dfb4 MSFT sync: link to error report for site admins
Also, don't show job_state to the end-user, as this could have
[semi-]sensitive internal information (e.g. the retried_error field with
error message)

Note: I didn't bother setting last_error_report_id to null when the
error is cleared (job completion) because that doesn't affect the UI
anywhere and could theoretically be useful for debugging a sync that
failed but later succeeded. I'm open to changing that if anyone
disagrees and cares enough, though.

refs INTEROP-6716
flag=microsoft_group_enrollments_syncing

Test plan:
- add "raise SocketError" in any one of the syncer steps (first one will
  do), reduce the retry timeouts (STANDARD_RETRY_DELAY) if you want, and
  run a sync
- check the Course settings page: Under Integrations -> MicrosoftSync,
  it should show the error:
  * As Site Admin, it should show a link to an error report
  * Masquerade as a teacher. it should not show a link to an error
    report
  * as the teacher, check the traffic coming back from the "show" endpoint.
    It should not include job_state
- change the raise in the syncer steps to "raise StandardError" and run
  the sync
- check the Course settings page and again, check that the link to the
  error report shows up as an admin but not as a teacher
- remove the 'raise' and run a successful sync; check that no error is
  shown in the UI

Change-Id: I9916d426d8c1e00342b0f29b450b5584ae1af57b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263645
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-04-28 20:14:31 +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
Cody Cutrer 4e5aeabf01 record where a user was merged in to
Change-Id: Ia02495da93a193daa7c61ce65a9d40d3e336c813
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263688
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>
2021-04-27 17:17:34 +00:00
Syed Hussain 937561d7a2 Remove 'Allow Bulk Grade Export to SIS" FF
closes EVAL-1018

flag = none

Test Plan: specs pass

Change-Id: I99f77c1725a42e64776b20e110100924f3a03d52
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261789
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
2021-04-27 14:36:11 +00:00
Cody Cutrer df936044ec don't recompute due dates multiple times
when moving students between sections in a sis import

Change-Id: Ia04fb6c5d2d17ea4a6da24080735319f787a7622
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263374
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>
2021-04-26 23:06:38 +00:00
Pat Renner 2ffc19c48e use beta domain for outcomes_service url when in beta/test
refs OUT-4386
flag=none

test-plan:
- follow the steps in g/249764 and verify everything
works as expected
- go to gems/plugins/instructure_misc_plugins and pull
- add a config/test_cluster.yml file
- within it, specify `test_cluster_name: beta`
- for your account tied to the outcomes service, add a
beta_domain key to the account settings that points to a different
shard/domain than your domain key
- repeat the steps from the test plan but verify the request goes
to this new url

Change-Id: I8002275a663b4015011bacf42bcf2f02adbe5d1b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263297
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-04-26 21:50:26 +00:00
Jeremy Stanley 52e4e7c864 check correct shard for content share linked to export
the content share lives in the user's shard, not necessarily
the export's shard or the domain root account's shard

test plan:
 - have multiple shards set up
 - as a teacher/admin, find a content share you sent
   more than 30 days ago (or create a new content share
   and modify the linked content_export's created_at date
   to be older than 30 days)
 - ensure if you hit the /api/v1/users/self/content_shares/sent
   endpoint, the attachment is included under the content_export
   in the results, regardless of which domain you hit the endpoint
   from (the user's native domain or another one)

fixes LS-2171

Change-Id: I56390adaf29f600f4fbf666d8dbed06615a7fadb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263550
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>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-04-26 20:00:08 +00:00
Eric Saupe c4bd796f60 Respect post_to_sis setting in blueprint associated courses
fixes LS-1995
flag=none

test plan:
- Enable Post to SIS feature flag
- Create a blueprint course with associated courses
- Create an assignment in the blueprint course
- Keep assignment unlocked
- Enable 'Post to SIS' on the associated course assignment
- Make a change to the blueprint course assignment and trigger sync
- Verify 'Post to SIS' setting is unchanged
- Lock blueprint assignment content
- Change 'Post to SIS' on the blueprint assignment and trigger sync
- Verify 'Post to SIS' setting on associated assignment is the same
 as the blueprint course's 'Post to SIS' setting

Change-Id: I3f1f66b82d34fb3048fd138aeff076e3634c00ab
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263541
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
2021-04-26 15:55:50 +00:00
Jonathan Guardado e0b8033da8 Copy to ignores active course dates in past terms
A flag has been added to the logic for fetching the courses by
account, also the query for fetching these courses has been modified
adding a union statement based on the flag to include those courses
where the terms dates have been overridden by the course dates

fixes LS-2050
flag=none

Test plan:

1- Create a term in the past and a term in the present
2- Create a course in each term and publish both
3- In the course with the past term set the participation to course
and override term dates
4- In the course with the present term create a page or other
shareable content
5- Add the same teacher to both courses
6- As the teacher select the copy to option on the page in the
present course and see that the past course is listed in the dropdown

Change-Id: Ie53892a3bdedbe2bb5fd37c0258f3e1ebfd25144
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262419
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jonathan Guardado <jonathan.guardado@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2021-04-23 23:12:40 +00:00
Spencer Olson ba1051ea46 fix submission comment n+1 in submissions api
closes EVAL-1600
flag=none

Test Plan:
1. Switch to the 'master' branch. Before verifying the fix, we're going
   to reproduce the problem.
2. Create a course that has multiple assignments, submissions, and
   submission comments.
3. As a teacher of the course, make the request:

   GET /api/v1/courses/1/students/submissions?&student_ids=all&
     include[]=has_postable_comments

   Once you make the request, keep an eye on the server output and
   notice you see a bunch of consecutive `SQL SubmissionComment Load`
   statements. Then, make the request:

   GET /api/v1/courses/1/students/submissions?&student_ids=all&
     include[]=submission_comments

   and verify the same issue. Verify you see the consecutive SQL
   statements issue again with the following 2 requests:

   GET /api/v1/courses/1/students/submissions?&student_ids=all&
     grouped=1

   and

   GET /api/v1/courses/1/students/submissions?&student_ids=all&
     grouped=1&include[]=submission_comments

4. Now, switch to the branch for this commit. Make all the same
   requests that you did in step 3 and verify that you no longer see
   the consecutive 'SQL SubmissionComment Load' statements.
5. In the UI, go to the Gradebook as a teacher.
6. Once the Gradebook loads, open the Submission Tray for a student's
   submission and verify you can see their comments.

Change-Id: I4a7033802963b4cd3b9eddf691719404ff8ca913
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263173
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
2021-04-23 18:24:14 +00:00
Cody Cutrer 091d2348bb don't use a bad singleton name for DueDateCacher
using the root account id means that only one job will be queued,
even if many courses are touched

luckily, the called method will already compute a proper singleton
name

Change-Id: I0678b0da092b1263f07884ab0529a49ba688e89b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263369
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>
2021-04-22 16:07:50 +00:00
Weston Dransfield 82d8e5479c Show msft sync group details
closes INTEROP-6565
flag=microsoft_group_enrollments_syncing

Additionally, this change modifies the behavior
of the cooldown period when the group is in an
"errored" state.

A cooldown is no longer required in this sate. This
means a user can immediately retry failed syncs

Test Plan:

- Perform a sync successfully from the UI
- Verify the UI shows the sync time, the
  workflow state, and the message "no errors"
- Force an end to the cool down period with
  group.update!(last_manually_synced_at: 90.minutes.ago)
  in a rails console
- Disable syncing in your account:
   a = Account.root_accounts.first
   a.settings[:microsoft_sync_enabled] = false
   a.save!
- Start another sync and refresh the page
  after the sync job fails
- Verify a "!" warning symbol is shown on the
  un-expanded view of the MSFT sync integration
- Expand the integration and verify that a error
  explaining why the sync failed is shown
- Verify the integration view no longer says "no errors"
- Verify you can start another sync without waiting
- Verify starting another sync clears the error from the
  UI (until you refresh, since the job should fail again)
- Enable syncing in your root account:
   a = Account.root_accounts.first
   a.settings[:microsoft_sync_enabled] = true
   a.save!
- Start another sync and verify it finishes and the UI
  indicates a success
- modify the "sync" action in the microsoft groups controller
  to always respond with "bad request":
   head :bad_request and return
- Clear the cool down period on the MSFT sync group again
- Refresh the UI and attempt to sync
- Verify an error is shown. There should be a "!" icon
  on the integration row and a detailed message in the
  expanded view.
- Remove the modification made to the "sync" action
  of the microsoft groups controller
- Without refreshing the page, attempt another sync
- Verify the errors in the UI clear
- Refresh the page and verify the UI indicates a
  sync success
- Verify the UI is enforcing the cooldown period now
  that the sync was successfull

Change-Id: I5228630ff68260dd87eb8d738ebf708d54c59ae1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263290
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2021-04-22 15:55:39 +00:00
Cody Cutrer dbe392f43d fix deadlock in GradeCalculator
fixes FOO-1450

Change-Id: Idb63e95fc728b4f063db25bcd54d5a419729aff4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263388
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-04-21 19:48:18 +00:00
Rob Orton 0653ff2f53 use root_account association when possible
when our context is an assignment we currently are loading a
rubric_association to identify the root_account

test plan
 - specs should pass

fixes VICE-1280
flag = none

Change-Id: I9d9493da1d80cb8208e999619700f657a8c00bca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263328
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
Reviewed-by: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
QA-Review: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
Product-Review: Mauricio Ribeiro <mauricio.ribeiro@instructure.com>
2021-04-21 16:18:57 +00:00
Rob Orton 1167a551cb handle user loaded notification_policy_overrides
this is the same functionality as before but avoids the query when they
are already loaded.

test plan
 - specs should pass

refs VICE-1280
flag = none

Change-Id: I20e711b222874f9d082c6a4a284b7a1b4346193b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263268
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-04-21 15:05:15 +00:00
Rob Orton 1f2be8fd22 preload notification_policies for both objects
this is the same queries, but now both objects recognize that the
policies are already loaded

test plan
 - specs should pass

refs VICE-1280
flag = none

Change-Id: Ide3ada84bfd1f7ff97077d54065af6cc3519eee0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263270
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
2021-04-21 14:37:18 +00:00
Weston Dransfield 5205ddde73 Add button to schedule MSFT sync
refs INTEROP-6575
flag=microsoft_group_enrollments_syncing

Test Plan:
- Set up your local environment for microsoft enrollment
  syncing using the steps in the test plan from g/260232
  (if needed)
- Enable the MSFT sync flag in your root account if
  needed
- Navigate to a course with students
- Go to settings -> integrations and enable the
  MSFT sync integration (if needed)
- Click "Sync now"
- validate that a spinner is shown while a network
  request is being made
- verify a "success" message is show indicating
  a sync has been scheduled
- verify that after a few seconds, this message
  becomes an info message indicating a sync currently
  taking place and that the user should wait before
  starting another.
- Verify the "Sync Now" button is disabled
- Run jobs
- When all scheduled jobs have completed, check to
  see that the MSFT sync completed:
  MicrosoftSync::Group.find_by(
    course_id: <your course id>
  ).workflow_state == 'completed'
- Referesh the page and go back to the integrations UI.
  Expand the details for the MSFT integration
- Verify that a message is shown indicating the time
  remaining until the user can manually sync again
- Verify the "Sync Now" button is disabled
- In a rails console, reset the "last manual sync time"
  with MicrosoftSync::Group.find_by(
    course_id: <your course id>
  ).update!(
    last_manually_synced_at: 90.minutes.ago
  )
- Refresh the page, go to the integrations tab, and
  expand the MSFT sync details.
- Verify the "Sync Now" button is enabled (but don't
  click on it yet).
- Modify the "sync" action in controllers/microsoft_sync
  /groups_controller.rb so that the first line
  of the method is `head :internal_server_error and return`
  We just need to simulate an error temporarily.
- Click the "Sync Now" button. Verify an error message
  is shown.
- Remove the "head :internal_server_error" line from
  the controller
- Without refreshing the page, click the "sync now" button
  again. Verify the error message is replaced with a
  success message (which transitions to an info message,
  as before).
- Verify toggling the MSFT sync integration on/off works
  as before
- Any other test that come to mind :)

Change-Id: I99bb0a1d7f3708e4dc4784dbd1624c31292beeb0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262881
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2021-04-20 20:44:28 +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
Evan Battaglia 8ab08c50f6 MSFT Sync: comments describing UPN/AAD terminology
flag=microsoft_group_enrollments_syncing

Test plan:
- n/a

Change-Id: Ieab218b09380af1d599fbb4fbf87b3f64a854ef9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263092
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Ryan Hawkins <ryan.hawkins@instructure.com>
2021-04-20 18:49:11 +00:00
Mauricio Ribeiro abedde2b37 allow pending/invited students in group csv import
fixes VICE-1287
flag=none

test plan:
  - Invite a student to a course;
  - In that course, navigate to the people
  tab and create a group set and a group;
  - Click import from the group set on the top-right
  - Click download course roster CSV
  - Manually add the student with the pending enrollment to the CSV
  - Attempt to import the CSV into course groups
  - Check if the student is added to a group

qa risk: low

Change-Id: Ifc710ecf6a8fca8bb7e26feb7284028ea20922f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263252
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-04-20 17:07:49 +00:00
Matthew Lemon be7b4045e0 add moderate_forum permission to discussion GQL
fixes VICE-1338
flag=react_discussions_post

Test Plan:
- Navigate to /graphiql
- Run the following query

```
query MyQuery {
  legacyNode(_id: <id>, type: Discussion) {
    ... on Discussion {
      id
      permissions {
        create
        attach
        duplicate
        delete
        moderateForum
        rate
        read
        readAsAdmin
        readReplies
        reply
        update
      }
    }
  }
}
```

- The query should return not just the accurate moderateForum
  permission but it should return all the permissions correctly

Change-Id: Ide03296f92ad9540b7907b1b10425bbb4ebbc0d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263153
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>
2021-04-20 15:57:03 +00:00
Rob Orton de135bd790 return empty array when an item is not generated
this commit is fixing an error found in sentry from a method run in a
job by returning early when the conditions match the stack trace

test plan
 - specs should pass

fixes VICE-1300
flag=none

Change-Id: I220586f6b198de4674d36aa882024d5d343dc9cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263228
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-04-20 15:31:50 +00:00
August Thornton 4df7b6b1e9 add additional new role overrides for manage courses granulars
refs FOO-1762
flag = granular_permissions_manage_courses

test plan:
 • verify new role overrides for publish / conclude
   • they should be grouped accordingly by manage files
 • ensure they're guarded by manage_courses feature flag
 • ensure we're making them available to appropriate base
   role types
 • ensure they're only true for the minimum base role types
   required

Change-Id: I1cdeafbc0564931d863b3dd06d8cdc21035ba214
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262945
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-04-19 19:24:42 +00:00
Xander Moffatt 181cab70ed restrict tool launches based on visibility
closes INTEROP-6643
flag=none

* hiding tool in course settings -> navigation now adds visibility:
   'admins' to the course_navigation placement, preventing students from
   accessing the tool from that placement
* this doesn't prevent students from launching from another placement,
   which is preferred

test plan:
  * with a tool with `course_navigation` placement, go to Course
      Settings -> Navigation, and drag the tool to the Hidden section
   * the page will reload, and the tool won't be visible
   * as a teacher, hitting the tool url
      `http://canvas.docker/courses/:id/external_tools/:id` should still
      launch the tool
   * as a student, hitting that same url will not launch the tool

Change-Id: I8b743a51c9a8ff62223be2791d2b3e62e03dee52
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262762
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
2021-04-16 21:54:05 +00:00
Gary Mei 3ea42de1cb add image support for Student Annotation
Images uploaded to Canvas weren't rendered by DocViewer unless they
were part of a student submission, to avoid rendering images to PDFs
in cases where the user just wanted an image. This change takes
attachments for Student Annotation and adds them to a special folder
in the course so that DocViewer is aware that any image files for
Student Annotation are intended to be rendered as a PDF.

closes EVAL-1569
flag=annotated_document_submissions

Test Plan
- Upload an image to a teacher's personal Folder.
- Create a Student Annotation assignment and select the image
  uploaded in the prior step.
- Verify that a new folder in the course is created named Student
  Annotation Documents and that it contains a copy of the selected
  image.
- Verify that a student can view the Student Annotation assignment
  with the image rendered.
- Verify that the teacher's personal Folder still contains the image
  and that clicking it shows an image preview not in DocViewer, not
  rendered as a PDF.

Change-Id: Idbc8f02ae76ed42b3612bf85601e0186565dc5cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262902
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
2021-04-15 21:50:50 +00:00
Adrian Packel 1ce4daa7d4 Show submissionless assignments in A2
closes EVAL-1478
flag=assignments_2_student

Test plan:
- Have a course with A2 enabled
- Create assignments with the following submission types:
  - No submission
  - On paper
- Add at least one of the above assignments to a module, and add a "mark
  as done" requirement for the assignment
- As a student, open those assignments and check that you are shown the
  A2 view
  - The description and other details should be shown, but there should be
    no way to submit anything to the assignment
  - If part of a module with a mark-as-done requirement, the "mark as
    done" button should appear in the footer and toggle the assignment's
    completion when clicked
  - If not part of a context module, the footer should not be shown

Change-Id: Id8e5b904474e2fa05db3923165a9e08cb39f2636
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262367
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-04-15 15:28:25 +00:00
Spencer Olson 0992981d30 disallow annotated assignments to be group assignments
closes EVAL-1531
flag=annotated_document_submissions

Test Plan:
0. Enable the "Annotated document submissions" feature flag at
   /accounts/site_admin/settings .

Plan 1: UI
1. Click to create a new assignment.
2. Give the assignment a name.
3. Under "Submission Type", select "Online". Before checking any
   checkboxes, verify the Group Assignment checkbox is enabled. Then,
   check the "Student Annotation" checkbox and verify the "Group
   Assignment" checkbox is disabled and has the message, "Group
   assignments cannot be enabled for annotated document assignments"
   below the checkbox. Then uncheck the "Student Annotation" checkbox
   and verify the "Group Assignment" checkbox is re-enabled.
4. Leave the "Student Annotation" checkbox unchecked. Then, check the
   "Group Assignment" checkbox. Verify the "Student Annotation" checkbox
   is disabled, and hovering over it provides a tooltip that reads,
   "Student annotation assignments cannot be enabled for group
   assignments". Then, uncheck the "Group Assignment" checkbox and
   verify the "Student Annotation" checkbox is re-enabled.
5. Save the assignment as an annotated document assignment with an
   annotatable attachment. Then, refresh the page. Verify on page
   refresh that the "Group Assignment" checkbox is disabled with the
   message, "Group assignments cannot be enabled for student annotation
   assignments" below it.
6. Save the assignment as a group assignment. Then, refresh the page.
   Verify on page refresh that the "Student Annotation" checkbox is
   disabled with the tooltip, "Student Annotation assignments cannot be
   enabled for group assignments".

Plan 2: API
1. Create an attachment in the UI. I think the easiest way to do this is
   to upload a file at /files.
2. Create a group category (easiest way to do this is create a group
   assignment and select the dropdown option to create a new group).
3. As an instructor or admin, make the following API request:

     POST '<localhost or docker>/api/v1/courses/<course ID>/assignments'

     {
       assignment[name]: "Testing Stuff",
       assignment[submission_types]: "student_annotation",
       assignment[group_category_id]: <the group category id>,
       assignment[annotatable_attachment_id]: <the attachment id>
     }

   Verify the response comes back with errors that state
   annotatable_attachment_id must be blank when group_category_id is
   present, and that group_category_id must be blank when
   annotatable_attachment_id is present.

4. Make the same request as in step 3, but without the group_category_id
   param. Verify the request succeeds.
5. Make the same request as in step 3, but without the
   annotated_document_id param and with submission_types set to
   "on_paper". Verify the request succeeds.

Change-Id: I47db416ec999df031daeeaaf5aec93ac684a3f87
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262441
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
2021-04-15 15:10:42 +00:00
Pat Renner dd9e95d63b add comment_bank_item model
flag=assignment_comment_library

refs EVAL-1559

test-plan:
- run migrations
- verify you can create a record within the rails console:
 CommentBankItem.create!(comment:'comment#1!',
user: User.first, course: Course.first)
- rollback the comment bank item migration
- verify table was dropped

Change-Id: I8fcfbb3c0da1803f8836ef50c2f22be934387f0f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262202
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Pablo Gomez <pablo.gomez@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-04-14 22:58:12 +00:00
Evan Battaglia a9a6699abf MSFT Sync: simplify update_unless_deleted
Follow-up commit to 3aa284b6

refs INTEROP-6571
flag=microsoft_group_enrollments_syncing

Test plan:
- Run a sync
- Run the following
  g = MicrosoftSync::Group.find(123) # etc
  job = g.syncer_job
  MicrosoftSync::Group.find(123).destroy
  ap g # check workflow_state is not deleted
  job.run_synchronously # now, check that the sync quits immediately
  ap g # check workflow_state is deleted

Change-Id: I11861f70c068003c2ffd6ae39f1fbc0beb17d597
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262906
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
2021-04-14 21:54:38 +00:00
Evan Battaglia 01995d25e8 MSFT Sync: Rename Syncer & CanvasGraphService
Follow-up commit to 3aa284b6

refs INTEROP-6571
flag=microsoft_group_enrollments_syncing

Test plan:
- Run a sync

Change-Id: Ib4dd18fdcd92b1708ff34d01049ec688bbe6e515
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262903
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: Evan Battaglia <ebattaglia@instructure.com>
2021-04-14 20:23:34 +00:00
Jeremy Stanley 552a157bac fix false course link validator failures
Rails.application.routes.recognize_path expects a path, not a
complete URI, and can be confused by the combination of a
trailing slash and query parameters. This causes the course
link validator to report a working link as failing.

test plan:
 - upload a previewable document file to a course and link it
   into a page
 - export the course
 - import the package into a new shell
 - run the course link validator in the new course
 - it should not report that the link is invalid

flag = none
fixes LS-2082

Change-Id: I88b502814de5565ab2b06d69734dbd3ef3bec5e1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262818
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: Jeremy Stanley <jeremy@instructure.com>
2021-04-14 15:52:18 +00:00
Adrian Packel aca6a64cab Ignore test student when checking anon posted
When considering whether an anonymous assignment has any unposted
submissions, do not include test student submissions. This ensures that
adding a test student to a course will not flip an already-posted
anonymous assignment back to unposted.

fixes EVAL-1343
flag=none

Test plan:
- Have a course and an assignment with anonymous grading enabled
- Without a test student in the course, post grades for the anonymous
  assignment
- Add a test student to the course
- In the Gradebook, the anonymous assignment should continue to behave
  as though grades have been posted, despite the presence of the test
  student
- Remove the test student and check that you can hide/post grades
  as normal

Change-Id: I1e581e59ab76144ff354cdc5ec1ee1980ab9f10b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262715
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2021-04-14 15:51:27 +00:00
Evan Battaglia 3aa284b60b MicrosoftSync state machine job
* Sets up framework for running a job with many steps, each step of
  which can be retried
* If a step succeeds, the next step will run immediately and you can
  pass in-memory data
* If a step fails with a retriable error, you can return a Retry object
  which will instruct the framework to retry the same step, or fail if
  the maximum number of retries has been surpassed. You can pass a block
  to run only if a retry happens to store data for the retry.  For
  convenience, extra data can be passed directly to the retry (stored in
  job_state[:data]).
* If a step fails with a non-retriable error, a cleanup function will
  run and the job will be set to an errored state. This will bubble up /
  produce a Delayed::Job::Failed (unless the error explicitly includes
  GracefulCancelErrorMixin)
* Jobs run 1-at-a-time (per Group record) on a strand to prevent
  interference from jobs running at the same time. If a new job
  starts when an existing job is in-progress, it will be ignored, unless
  the old job is considered to be stalled, in which case it will kick
  off a new job.
* This commit also converts the Syncer to use this framework, and sets
  up retry for creating a team, replacing the sleep. I will adjust the
  exact timings later.

refs INTEROP-6571
flag=microsoft_group_enrollments_syncing

Note: the test plan below assumes the first time setting the properties
on a new group will fail, and after sleeping 45 seconds -- after
everything is consistent on the Microsoft side -- all subsequent
requests will succeed (except for possibly the team creation -- this is
retried with a 1 minute retry delay). However, I've seen widely varying
behavior in terms of what delays are necessary before which endpoints
will find the newly-created groups. You may see 404 errors still in
steps I don't have retry in yet.  I'm working on adding retry in all
steps, in the meantime if you see 404s, let me know, but you can just
delete the group and try again.

Test plan:
- Make sure you have a course/group with a teacher and student
- Before each run/step below, delete the group on the Microsoft side
  before syncing (in the admin console, or do
  `gs.request(:delete, "groups/#{g.ms_group_id}")`and delete the
  MicrosoftSync::Group record and create a new one for the course.
- Delete group & run synchronously with
  `group.syncer_job.run_synchronously`
  - During the 1 minute sleep, check the workflow_state and job_state of
    the group. workflow_state should be retrying, job_state should have
    {step: :step_ensure_team_exists, retries: 1, updated_at: ...}
  - At the end, check in the Microsoft admin console that the group and
    team have been created and the group has the teacher and student in.
- Delete group & run asynchronously with run_later, and with a jobs
  container running.
  Again, during 45-second or 1-minute wait period, check state of group.
- After it completes successfully, delete group on MS side and locally
  again. Stop the job container. Then run the following:
    c = Course.find(...)
    g = MicrosoftSync::Group.create(course: c)
    g.syncer_job.run_later
    g.syncer_job.run_later
    g.syncer_job.send(:run_with_delay, :execute_diff)
- Start the job container and wait until the job is in the retry wait
  period (you will see a bunch of lines of yellow output with it
  updating the microsoft_sync_group job_state).  At that point you
  should see the second job run and immediately quit immediately because
  the group is in a retrying state. (Look for output like "Processing
  MicrosoftSync::StateMachineJob#run(nil)" and "Completed
  MicrosoftSync::StateMachineJob#run(nil)".) Then after that, you should
  see the third job run (with argument :execute_diff) and fail with an
  "InternalError" saying the step doesn't match the state.
- Try adding and removing some members/owners and without deleting the
  MicrosoftSync::Group record or deleting the remote group, try syncing
  again (with an async job) to make sure updates still work.

Change-Id: I8fafac65b79df8bf3ecea51d027424c1e3bda40e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262148
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-04-14 01:31:54 +00:00
Spencer Olson a1454de972 rename submission_type "annotated_document" to "student_annotation"
closes EVAL-1585
flag=annotated_document_submissions

Test Plan:
1. Smoke test creating, updating, and submitting to annotated
   document assignments.

Change-Id: I64504c48d35a84ad30911bc3af05a827c0dad229
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262817
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
2021-04-13 19:02:31 +00:00
Spencer Olson 1f0101422a rename annotated_document_id to annotatable_attachment_id
closes EVAL-1584
flag=annotated_document_submissions

Test Plan:
1. Smoke test creating, updating, and submitting to annotated
   document assignments.

Change-Id: I7a20d8521459f1b660e3ba0d34f71cd776d7ba43
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262805
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
2021-04-13 18:27:08 +00:00
Kai Bjorkman dea2e254ab rename 'Annotated Document' type to 'Student Annotation'
flag=annotated_document_submissions
closes EVAL-1581

Test Plan:
-all instances of Annotated Document renamed to Student Annotation

Change-Id: I625869764453a65a6cd4ba4cad076c9a856b39b4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262615
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
2021-04-13 18:00:18 +00:00
Ed Schiebel d06e44eed8 Add Auto Show Closed Captions user feature
closes MAT-40
flag=auto_show_cc

Requested by the Columbus Public Schools (my homies), create a
setting so videos automatically show CCs when playing
videos.

test plan:
  - create RCE content and include a video
  - add a couple CC files in different languages, including the
    user's language (the .srt files don't have to be in another language,
    just tell canvas they are)
  - save
  > expect no CC without selecting them from the CC menu in the
    media player
  - click on the user's avatar to open the user's tray and choose Settings
  - enable the  "Automaticaly show media captions" feature
  - refresh to the page with RCE content
  > expect the CCs in the user's language to automatically show
  - change the user's language to another one you have CCs for
  - refresh the page with the video
  > expect the new language's CCs
  - change the user's language to something not in the CC list
    and not English
  - refresh the video page
  > no CCs and nothing bad happens.

note: I wanted to test with with various combinations of en, en-US,
and en-GB but canvas won't let you add CCs in regional locales. I don't
know why, but that's a problem for another day.

Change-Id: I355fd12c5ea42fe5bc8e776a0c602c2857aaf4c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262500
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-04-12 17:44:51 +00:00
Rob Orton 64ef6939a0 add unread_count and replies count to entry type
test plan
 - create a discussion entry
 - create sub_entries
 - run the following graphql query:

```
query MyQuery {
  legacyNode(_id: <root_entry_id>, type: DiscussionEntry) {
    ... on DiscussionEntry {
      id
      rootEntryParticipantCounts {
        unreadCount
        repliesCount
      }
    }
  }
}
```
- The result should show number of entries, and unread for the user

fixes VICE-1309
flag=none

Change-Id: I4a5a640498d3e31002e7a62f0e4ac556374a6c56
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262628
Tested-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Reviewed-by: Matthew Lemon <mlemon@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
2021-04-12 15:34:44 +00:00
Rob Orton cda82fb549 fix create n users per group by section for reals
this is a partial revert of 673e55edea
the previous commit attempted to use a variable from memory but in a
job process. This correctly calculates the number of groups needed to
accommodate the per section logic.

This will still not be perfect, because we are not aware of the n from
when the group category was created. That number gets thrown away and we
are left with a number of groups. This tries to calculate the number of
groups needed better and tries to calculate the number of people per
group slightly more accurate.

test plan
 - create 2 sections with 3 students each
 - create a group category keeping students in same section
using 2 users per group
 - it should create 4 groups

fixes VICE-1241
flag = none

Change-Id: I13a051dc7669d6471e531834f2d0f4f1422ce703
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262537
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
2021-04-09 17:38:01 +00:00
Matthew Lemon bc9128a7c6 truncate messages that are too big
fixes VICE-1166
flag=none

Test Plan:
- Specs Pass
- Generate a notification that would have a message body
  bigger than 64 kilobytes
- Navigate to /users/<user_id>/messages
- Note that the notification message should display
  "message preview unavailable"

Change-Id: I0d61a1beb9fe876e7462d5ce22a3be1cc7a42a80
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262452
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-04-08 21:37:15 +00:00
Matthew Lemon 2a71c7e132 add last reply field to discussion entry type
fixes VICE-1290
flag=none

Test Plan:
- Create a discussion entry with multiple levels of nesting
- Run the following graphql query:

```
query MyQuery {
  legacyNode(_id: <root_entry_id>, type: DiscussionEntry) {
    ... on DiscussionEntry {
      id
      lastReply {
        message
        createdAt
      }
    }
  }
}
```

- The result should show the last added discussion entry

Change-Id: I92f88225c7d631829344efb0159808832f9890fc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262491
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-04-08 18:21:13 +00:00
Omar Soto fd2fdce729 Validate that user can duplicate discussion topic.
fixes VICE-1263

flag=none

test plan:
  - Call /duplicate endpoint  as student without editing
      rights and expect an Unauthorized (401).

qa risk: low

Change-Id: If1fcd9377237592cc0dfe298439f0df393a9fb70
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262478
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-04-08 15:40:59 +00:00
Davis Hyer 7bb8bc17b1 handle invalid collaboration types
fixes VICE-1273
flag=none

Spec failure was from attempting to access `[]` method on a nil object.
Although ActionController::Base is intended to handle exceptions and
return a 500 (as evidenced by the previous test assertion), for some
reason our testing infrastructure began to fail with an uncaught error.
This commit doesn't directly address the issue at hand, but rather hits
the odd behavior in hopes that the custom error will not result in the
same failure. Worst case, it helps clean up some Sentry errors.

test plan:
  - tests pass

qa risk: low

Change-Id: Ic44b8291d8f24444af73d4d3bc71e02047001791
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262401
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-04-08 14:58:12 +00:00
August Thornton 7f9d8c148b add new role overrides for manage courses granular permissions
closes FOO-1762
flag = granular_permissions_manage_courses

test plan:
 • verify new role overrides for add / edit / delete
   • they should be grouped accordingly by manage files
 • ensure they're guarded by manage_courses feature flag
 • ensure we're making them available to appropriate base
   role types
 • ensure they're only true for the minimum base role types
   required

Change-Id: I0c042f466c1e703aea9b9771ea07b38a4ffc1a7c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261088
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-04-07 20:15:43 +00:00
Gary Mei 5aa1a30677 start canvadoc render for annotated documents
For Annotated Document assignments, this starts a render on assignment
creation if the attachment doesn't already have a render, rather than
waiting for the first launch of the document.

closes EVAL-1513
flag=annotated_document_submissions

Test Plan
- Create an Annotated Document assignment with a brand new attachment
  as the document.
- In a rails console, find the attachment.
  `att = Attachment.last`

- Verify that the corresponding canvadoc has a document_id
  associated.
  `att.canvadoc.document_id`

Change-Id: Idfc0f036bdb33e9ad75011f4879030182d29dc13
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262252
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-04-07 20:03:15 +00:00
Spencer Olson a78e7c6e87 allow students to comment on unposted submissions
Allows students to comment on unposted submissions for the improved
student submission workflow.

closes EVAL-1552
flag=assignments_2_student

Test Plan:
0. Enable the assignment student enhancements feature flag

Plan 1: Not-Anonymous Assignment
1. Create an assignment that posts manually.
2. As a student, go to the assignment page. Open the Feedback Tray
   and verify you don't see any comments, and you see an image with
   text below it that says, 'You may not see all comments for this
   assignment until grades are posted.'.
3. As the teacher, leave a submission comment for the student in
   SpeedGrader.
4. As the student, verify the same as in step 2.
5. As the student, leave a comment in the Feedback Tray. Verify that
   when you leave the comment, the image at the top of the tray goes
   away and the 'You may not see all comments for this assignment until
   grades are posted.' text is placed within an Info Alert. After
   leaving comments as the student, verify they show up in the Feedback
   Tray.
6. As the teacher, post grades for the assignment.
7. As the student, open the Feedback Tray on the assignment page.
   Verify there is no longer a message at the top of the tray, and you
   see both your own comments and comments from the teacher.

Plan 2: Anonymous Assignment
1. Create an anonymous assignment (student names hidden from teachers).
2. As a student, go to the assignment page. Open the Feedback Tray
   and verify you don't see any comments, and you see an image with
   text below it that says, 'You may not see all comments for this
   assignment until grades are posted.'.
3. As the teacher, leave a submission comment for the student in
   SpeedGrader.
4. As the student, verify the same as in step 2.
5. As the student, leave a comment in the Feedback Tray. Verify that
   when you leave the comment, the image at the top of the tray goes
   away and the 'You may not see all comments for this assignment until
   grades are posted.' text is placed within an Info Alert. After
   leaving comments as the student, verify they show up in the Feedback
   Tray and that the author shows as the student's actual name (before
   this change, the author would show as "Anonymous User").
6. As the teacher, post grades for the assignment.
7. As the student, open the Feedback Tray on the assignment page.
   Verify there is no longer a message at the top of the tray, and you
   see both your own comments and comments from the teacher.

Change-Id: I6ae82861105f2607013fe1dcbf8fd8382d267ca9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261858
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Juan Chavez <juan.chavez@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-04-07 19:54:53 +00:00
Han Yan 537e0d741b refactor to avoid deadlocks in submit_homework
I have gone over the submit_homework transaction many times, and
haven't found an explict issue causing deadlocks, but I see the
transaction can be optimized to reduce possibility of deadlocks.

The optimization moves unneccessary operations from the transaction,
so make the transaction smaller and less complex

For the case of 300+ concurrent submmissions of a group assignemnt,
I think it can be better to move submit_homework to backend jobs
with strand, but it may need UI changes.

closes DEMO-170
flag=none

test plan:
- regression test on submitting normal and group assignments

Change-Id: I433201443ab3739723ac18e9dfac27480f6cfdcb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261256
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Han Yan <hyan@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2021-04-07 18:51:25 +00:00
Augusto Callejas 09ed9f1d5f Add source outcome group association
closes OUT-4354

flag=improved_outcomes_management

When importing a learning outcome group from one context
to another, its useful to know what group was copied from,
so this association will help us track that source.

test plan:
  - qa-cr

Change-Id: I642b1db42a685dbd81117c037443241b37b52ed7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262149
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Pat Renner <prenner@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>
2021-04-07 18:26:44 +00:00
Eduardo Escobar 2e6b15a359 fix re-upload submission file with LATE tag bug
The function that Infers the user, submission
and attachment from a filename now removes the
LATE tag before matching the substrings to variables

fixes EVAL-1423
flag=none

test plan:
- Enable Anonymous Grading at account level
- Create an online file upload assignment
  (anonymous grading enabled), with a
  past due date and publish.
- Have a student submit to the assignment which
  will be marked as late.
- Download the submissions.
- Edit the submission and then add to a zip file.
- Re-upload the zip file to the assignment.
- Notice that the submission is accepted.

Change-Id: I00aeeb8c23e5592f4b14184f28a851cb2f3f9741
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261741
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
2021-04-07 13:42:55 +00:00
Eduardo Escobar b05363f72b fix incorrect grader bug when updating assignment points
The function that update the student submission
now have one argument (updating_user) and it prevents
getting null values when the model is being updated latter

fixes EVAL-1453
flag=none

test plan:
- Create a course with at least one student
  and two teachers.
- Create an assignment worth 10 points
  in the course.
- As teacher A give a grade for the student
  for this assignment.
- As teacher B edit the assignment and make it
  out of 20 points instead of 10.
- Go to the gradebook and click Graadebook History
  from the Gradebook dropdown in the top left.
- Notice there are two events for the submission
  and one belongs to Teacher A, the other one
  to the Teacher B.

Change-Id: Iadf252bd9a262f82bf57d9e9a9c02733d36c7891
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262011
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-04-06 21:51:34 +00:00
James Logan 43993bbe57 fix numeric answers showing 0.0 in quiz log
fixes QO-730
flag=quiz_log_auditing

Before saving quiz events we deserialize numeric answers
using BigDecimal. However, big decimal can't handle commas.
This strips out commas while deserializing.

Test Plan
- You may need to rebuild locally with:
  services.jobs.environment.RAILS_LOAD_ALL_LOCALES: 1
- You may need to run `rake i18n:generate_js` on your
  canvas docker container.
- Enable the feature flag.
- Create an old quiz.
- Add a numerical question with an answer >=1000.
- Add a numerical question with two numbers after
  the decimal that is >=1000.00.
- Add a numerical question with precision answer.
- Act as a student and take the quiz.
- Change back to a teach and observe the log.
- The answer entries in the log should reflect
  the answers given (not 0.0)
- Change the default language to french and
  repeat the above steps. Observe that the logs
  display the answer without commas and with a
  period for the decimal marker (this is expected)

Change-Id: Ifa8b890b0fb2a5ff3315075fff8c93688aff988b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259042
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Reviewed-by: Jared Crystal <jcrystal@instructure.com>
2021-04-06 21:05:06 +00:00
Ahmad Amireh 4243097b21 rename some things
fixes FOO-1265

[skip-eslint=true]
[pin-commit-analytics=7e49eefd7f59cbf43fd03bf8957bbbfa76f8d9d5]
[pin-commit-demo_site=adade2e38e46a358a4643cd3db2fe5ccffe39ec5]
[pin-commit-instructure_misc_plugin=47a3161102b0611af56d134fbd0c828ddc1b8abf]
[pin-commit-migration_tool=0dbac2f5b421d894395605ce4b583ef0f7d60b22]
[pin-commit-multiple_root_accounts=cc96d28c0d59bbe47acc64de4fdd8e1d2b029805]

Change-Id: I14c07f20bd260cf0de1f48ceb70b3c2313edf2d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-04-06 01:12:49 +00:00
Cody Cutrer 5dd1df2bab allow setting a course template on accounts
closes FOO-1682
flag=course_templates

test plan:
 * configure one or two courses as course templates
 * in the root account, you can choose the template, or no template, and save
 * in a sub account, you can choose a template, no template, or inherit
 * play with permissions - edit permissions you can still do any of the above,
   add permission only you can only go from no template to some template,
   delete permission only you can only go from template to no template or
   inherit

Change-Id: Ie0b02c1ae7d3ffe17d73ca46c8f1f0eec5adb7ba
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261029
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-04-05 19:57:17 +00:00
Cody Cutrer 7f0db1bfac apply course template to newly created courses
closes FOO-1419

except for course copies

also had to loosen course copy and course audit records to allow for
course copies without a user (i.e. kicked off by the system)

test plan:
 * create a template course, with some content, and assign it to an
   account (you may need to do this in console)
 * create a new course in that account via various methods
 * the new course should always have content copied from the template,
   unless you created it via a course copy

Change-Id: I9ec7e2e8dea47ee24aac43ee291c477d80424736
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260809
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-04-05 19:56:05 +00:00
Matthew Lemon b7e21d5daf add create discussion entry GQL mutation
fixes VICE-1201
flag=none

Test Plan:
- Create a discussion topic in a course with a student
- As the student navigate to /graphiql
- run the following mutation

```
mutation MyMutation {
  __typename
  createDiscussionEntry(input: {
    discussionTopicId: <id>,
    message: <message>
  }) {
    discussionEntry {
      _id
      author {
        name
      }
      createdAt
      message
    }
    errors {
      attribute
      message
    }
  }
}
```

- The mutation should create a new discussion entry on the
  discussion topic
- Navigate to the discussion topic to verify that the entry
  was created
- Re-run the above mutation but include a parent entry id to
  create a nested discussion entry reply
- Navigate back to the discussion topic to verify that the
  nested discussion entry was created

Change-Id: I0732d1460fa6b8c84c689a01a044eacd5acb7bae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262125
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2021-04-05 16:11:09 +00:00
Jacob Burroughs 088cbb4cd5 Introduce release notes data model
Single dynamo table for all release notes data.  Should support active-record
style patterns (mostly) for CRUD operations, plus querying the latest N visible
records by role and environment.  Also supports paginated listing of *all* notes
for administrative purposes

fixes FOO-1752

Change-Id: Ic1e7e204e93e263479a738af18daf312c801269c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261548
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-04-05 16:09:59 +00:00
Han Yan 416a756d0f retire import_to_quizzes_next FF
closes QUIZ-8257

flag=quizzes_next

test plan:
- enable/disable quizzes_next, on Import Content page,
  "Import assessment content as New Quizzes" option will
  be shown/hidden

Change-Id: Ie0b88f1a3940a34512e0627e593258ddf100deb8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261928
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
2021-04-05 14:39:23 +00:00
Nate Armstrong e32994134e Fix syncing deleted question groups with banks
fixes LS-2013
flag=none

The issue here is pretty simple: when deleting question groups as part
of a blueprint migration, the quiz questions must first be deleted
otherwise the Restrictor will get mad (if the quiz is locked).

The bug was that we were only deleting "active" quiz questions which
excludes "generated" quiz questions which is the workflow state
whenever a quiz question is generated from a question bank as
part of a submission.

The fix: delete all the non-deleted quiz questions, not just the active
ones.

test plan: automated :)
- Create a blueprint course and an associated course
- Create a new quiz in the blueprint course
- Create a new question group and link it to a question bank
- Lock the quiz
- Sync changes
- In the associated course:
  - publish the quiz
  - take the quiz as a student
- Back in the blueprint course
  - Edit the quiz
  - Delete the question group
  - Sync changes
- Question group should be deleted in associated course

Change-Id: I3cb64f6d1122268f5b37053c99cc79a086b06ab1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262073
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Nate Armstrong <narmstrong@instructure.com>
2021-04-02 17:00:46 +00:00
Eric Saupe 4a81a51965 Remove autocreate_attachment_from_media_object flag
fixes LS-1982
flag=none

test plan:
- Attachment creation in the RCE should work as expected and the
 flag should be gone

Change-Id: I99076a26c56ffd9008f24939561073e65fcc9a5d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261909
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
2021-04-02 16:16:25 +00:00
Cody Cutrer 1e0150b2cc reduce schema queries
* hard code that Tableless doesn't have a table
 * use a cacheable method for checking table renames
 * make sure to HA cache all the adapter methods that SchemaCache
   falls back on

Change-Id: I11b662ee69f7a21234d0f5df09b13f2cb9a5b0a5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262129
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>
2021-04-02 15:21:27 +00:00
Jeff Largent 3157a33d53 Add Course Color setting
closes LS-1913
flag = canvas_for_elementary

Test plan:
  - Go to a K-5 course (canvas_for_elementary flag on, associated with
    an account with the K-5 setting enabled)
  - As a teacher or admin, go to that course's settings
  - Expect to see a "Color:" field and array of color presets under
    the "Image:" field
  - Expect to be able to type valid color hexcodes into the text box
  - Expect to not be able to type invalid characters (anything but
    0-9, A-E, and a # at the beginning)
  - Expect to be able to click on a color preset button and have that
    color hexcode appear in the text box
  - Expect a checkbox to appear on a color preset if its hexcode is
    present in the text box
  - Expect a small square preview to show the color of the current
    hexcode in the text box
  - Enter a valid hexcode (e.g. #AA2299) and click the "Update Course
    Details" button
  - Reload the course settings, page and expect that hexcode to have
    been persisted
  - Enter an invalid hexcode (e.g. #a) and click "Update Course
    Details"
  - Expect an error message "Invalid hexcode provided" and the color
    to not have been persisted

A11y:
  - When tabbing through the settings form, expect only the first (or
    selected) preset to receive focus
  - When focused on one of the preset buttons, expect the left and
    right arrow keys to move through the presets
  - Expect focus to wrap around the ends of the list of presets
  - When tabbing past the presets then back to them, expect focus to
    return to the last preset that was focused
  - Expect enter and space to select the focused preset
  - Expect a screenreader to read instructions on arrow key navigation
    when tabbing to the color section of the form

Extra Credit:
  - Set a course color on a K-5 course
  - Copy the course to another course
  - Expect the course color to have been copied

Change-Id: I8404fece0bde9fc333d3c6538191e2abd3cd7aed
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261761
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Nate Armstrong <narmstrong@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
2021-04-01 19:14:49 +00:00
Steve Kacsmark 711ebc5bf8 Don't autograde submissions for ungradable users
closes QO-744
flag=none

Test Plan:
  - Create a course with a quiz.
  - Have some students launch but not take the quiz.
  - Conclude a student.
  - Have a student view the quiz index page
  - Grades should not be submitted for the concluded student

Change-Id: I3cd82a8b63b1b0e8584b1da01423ef7ffc73ab3a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260884
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: James Logan <james.logan@instructure.com>
2021-04-01 15:20:34 +00:00
Chawn Neal fcb6bc4119 implement mutation delete discussion entry
fixes VICE-1196
flag=none

adds a mutation for discussion entries to
be deleted by authorized users

TEST PLAN
 1) Create a discussion_entry with one user.
    make sure you have an unauthorized user etc another student.
    Go to /graphiql.
    go to add new mutation. deleteDiscussionEntry. Check everything.
    First try to run query with unauthorized user.
    You will get an error.
    Next run the query with an authorized user. for:
    input: {id: [valid_entry.id, invalid.id, another_invalid.id]}.
    You should see a batch of only invalid.
    Finally run an input with only valid_entry.
    You should see success.

 2) See rspec spec/graphql/mutations/delete_discussion_entries_spec.rb
 for the workflow of creating a discussion entry and deleting.

Change-Id: I61182cfd8ee93fda13f2c9b606b8ca8ad6080033
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261743
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>
2021-04-01 01:41:21 +00:00
Adrian Packel a7c9e5a56d Don't show moderated annotations before posting
When deciding whether to show instructor annotations in DocViewer for
moderated assignments, check whether the current submission has been
posted, instead of whether the assignment has had its grades published.
This ensures we don't show instructor annotations to students when the
instructor has clicked the "Release Grades" button on the moderation
page but not yet clicked the "Post to Students" button.

flag=none
fixes EVAL-1489

Test plan:
- Have an assignment with moderated grading and file upload submissions
- As a student (S1), upload something that is viewable in DocViewer
- As a provisional grader (PG1):
  - Assign a grade to S1 and leave some annotations in DocViewer
  - Assign some grades to any other students in the course
- As the moderator, open the moderation page for the assignment
  - Select PG1's grade for S1, and whatever grades you like for other
    students
  - Click the "Release Grades" button, but do *not* click the "Post to
    Students" button
- As S1:
  - Open the submission details page for the assignment
  - You should not see any annotations from PG1 (or anyone besides
    yourself)
- As the moderator:
  - Open the moderation page and click "Post To Students"
- As S1:
  - Open the submission details page for the assignment
  - You should now see PG1's annotations (as well as any annotations
    left by the moderator)

Change-Id: Ic6b579ba832bb2d0d5ead8eb040872e963f31e71
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262006
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-31 22:08:25 +00:00
Cody Cutrer baa224946d add an `ordered` scope to acts_as_list, and use it
Change-Id: Ib7756119e01f4c54a68da2424d647fd902e407cd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261979
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>
2021-03-31 21:48:10 +00:00
Jeremy Stanley 90e7ab67de drop unused visibility and manipulate columns from feature_flags
these were introduced as part of a major refactor that never
materialized. they have never been used.

closes LS-2098

Change-Id: I9c6711a9c2175f2e094d055f5d12fc21989c6d68
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262001
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>
2021-03-31 21:19:38 +00:00
Evan Battaglia 2ba8092d0a MicrosoftSync job: Basic sync of MS & local users
Test plan:
- Make a course with a couple users (students, teachers, TAs) enrolled.
  The users should have email addresses corresponding to users if our
  Microsoft Tenant (check the Admin console if unsure).
- Clear out your UserMapping table, to make sure you test everything
- Make sure you have the test tenant set in your Account settings and
  you have the creds loaded in dynamic_settings.yml
- Run the sync job:
    course = Course.last # etc.
    g = MicrosoftSync::Group.create(course: course)
    g.sync!
- Use the Microsoft Admin console to check that the students are members
  and the teachers/TAs/designers are members and owners.
- Remove a member on the Microsoft side, rerun the sync, and check that
  it adds them back. Cases to check:
  - Remove a non-owner group member
  - Remove a teacher as a group member
  - Remove a teacher as a group owner (or change to another user if it
    doesn't let you delete the last owner)
  - Remove a teacher as a group member and owner
- Add extra users on the Microsoft side as members and owners and make
  sure they are removed.
- Ideally we could also try doing adding more than 20 users (or at
  least n > 20, where n=2*owners+members), but we might not want to make
  that many Microsoft users in the Admin yet (?)
- Sync with no changes necessary and watch for the logging that it
  doesn't make any requests to modify the group (no requests to
  `patch /v1.0/groups/...`)

refs INTEROP-6568
refs INTEROP-6570
flag=microsoft_group_enrollments_syncing

Change-Id: I930472cef7c2bbd7e2ecb7f57ac4b61245353809
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261379
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: Evan Battaglia <ebattaglia@instructure.com>
2021-03-31 20:12:05 +00:00
Matthew Lemon 5c39a6938c handle MRA in graphql audit log
fixes VICE-1022
flag=none

TEST PLAN:
- specs pass

Change-Id: Ifb8b19003ce83ca10e05a082270d4e1dd657dea3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254661
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-31 18:41:04 +00:00
Gary Mei 0836cdacd8 add read-only mode for annotated document attempts
closes EVAL-1515
flag=annotated_document_submissions

Test Plan
- Create an Annotated Document.
- As a student, annotate the document.
- Refresh the page and verify that annotating is still possible.
- Submit the assignment.
- View the Submission Details page.
- Verify that the annotations made previously appear.
- Verify that adding more annotations to that attempt is not
  possible.

Change-Id: I6dbfdb3f107ef04e2a042d9c50bc719a1357a324
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261650
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-30 22:46:49 +00:00
Augusto Callejas 47163f70a8 Don't override quiz results from later attempts
fixes OUT-4265

flag=none

Since Quizzes::SubmissionGrader runs update_outcomes in
a delayed job, its possible for submissions from different
attempts to be processed out of order. Protect against
overriding quiz results from later attempts with earlier
attempts by comparing the attempt number.

test plan:
  - qa-cr

Change-Id: I28ac02b517aa71a56a69250b7b817d77d79faf47
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261742
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
2021-03-30 22:13:12 +00:00
Mysti Lilla bb90feb131 Add attachment url to all error messages
refs INTEROP-6650
flags=none

Test plan
- Upload an inaccessible s3 file to
  a migration in Canvas
- Check the attachment it created
  and verify you can see the URL
  in the error message

Change-Id: I665214875110e9c57fed58b3eb480b2099267fcc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261572
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
2021-03-30 21:48:11 +00:00
Jeff Largent 9ffdb76b0b K-5 Subject Course Tab View
This change updates the course view for non-homeroom courses
associated with a K-5 account to display tabbed navigation on the
front page (courses_controller#show). This replaces the course nav,
breadcrumbs, and right sidebar.

Also included in this change are a few bits of refactoring to make
sharing the components in the app/jsx/dashboard directory more
reusable-- e.g. making K5Tabs.js more general and extracting two hooks
(useTabState and usePlanner) to make setting up the planner / hooks
simpler and more reusable. However, this still doesn't structurally
reorganize the dashboard jsx files much since we're still waiting for
the bit frontend reorganization PS to land.

closes LS-2021
flag = canvas_for_elementary

Test plan:
  SUBJECT COURSES:
  - Enroll in a non-homeroom course in a K-5 sub-account as a student
  - Navigate to /courses/<course id>
  - Expect to see a giant header with the course name and image (or a
    solid gray background if the course has no image).
  - Expect to see tabs for Overview, Schedule, Modules, and Grades
  - Expect clicking on the tabs to mark the tabs as selected and
    update the hash in the url (although the content below won't
    change yet)
  - ...Except for the schedule tab. Expect the schedule tab to display
    as it does on the K-5 Dashboard, but without any course info
    (this will be added later)
  - As a teacher enrolled in the non-homeroom course, navigate to the
    schedule tab and expect to see the teacher preview empty state

  HOMEROOM COURSES:
  - As a teacher or student enrolled in a homeroom course in a K-5
    sub-account, navigate to /courses/<course id>
  - Expect to NOT see the new header and tabbed navigation
  - Expect to only see Announcements, People, and Settings in the left
    navigation

  NON-K5 COURSES:
  - As a teacher or student enrolled in a course in a non-K-5
    sub-account, navigate to /courses/<course id>
  - Expect the front page to look like classic Canvas, and for the
    course nav, breadcrumbs, and right sidebar to appear and work as
    normal

Change-Id: I2a00a75eacfd96cd4be4d268078d42cc41e4be10
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260869
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: Jeff Largent <jeff.largent@instructure.com>
2021-03-29 18:39:44 +00:00
Jeremy Stanley 34e04307d6 remove direct_share feature flag
test plan:
 - direct share features appear if the user has permission
   to use them

closes LS-2046

Change-Id: I0a3d4614d572d3037d06494bbb05c5a8a1956125
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261055
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-29 16:25:30 +00:00
Rob Orton 686271a82e always use jobs to update cached_due_dates
there is a known condition in our submission upsert that cause a
deadlock to happen because of a bunch of history that I have mostly
forgotten. see 7fd0528c3a for more context

The logic will rescue a dead lock, and then the job knows to retry if it
hit the dead lock. If it is not run in a job, we don't get the retry,
and it it hits the deadlock and fails the import.

test plan
 - specs should pass
 - move to section should not hit visible dead lock errors

fixes FOO-1555
flag=none

Change-Id: If8c7e6fa1d24e92a8dab1d6ebf5b29a7802ba5d3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257699
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-03-26 22:34:54 +00:00
Matthew Lemon fa0c899c38 add update discussion topic mutation
This currently only allows updating the published
state of the discussion topic but we can add more
functionality later as is needed

refs VICE-1203
flag=none

Test Plan:
- Create a discussion topic but don't publish it
- navigate to /graphiql
- run the following mutation

```
mutation MyMutation {
  __typename
  updateDiscussionTopic(input: {
    discussionTopicId: <id>,
    published: true
  }) {
    discussionTopic {
      published
    }
  }
}
```

- Navigate back to the discussion topic and note that
  it should now be published
- Run the same mutation again but set published to false
- The discussion topic should now be unpublished

Change-Id: Ic2f2b66aa2b9b73d0d55af1cd8ad6c61c44e2ca1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261509
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>
2021-03-25 21:04:09 +00:00
Gary Mei 7f4d24ad06 allow students to submit annotated documents
closes EVAL-1367
flag=annotated_document_submissions

Test Plan
- Create an Annotated Document assignment.
- As a student, load the assignment page and click Start Assignment.
- Verify that DocViewer displays the attachment.
- Make some annotations.
- Reload the page and click Start Assignment.
- Verify that the annotations from before appear now.
- Click the Submit button.
- Click New Attempt and verify that the document has no annotations.

Change-Id: Ieb9516f8ae235141f5920f4b550bd9e6fc431449
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261406
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-25 15:58:31 +00:00
Pat Renner 7c824e39c8 remove reassign_assignments feature flag
closes OUT-4329
flag=reassign_assignments

test-plan:
- create a published assignment within a course
- have a student submit the assignment
- verify that the teacher can reassign the
assignment

Change-Id: I9dd85f90f317823f5818a7e6c991294755e7154b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261404
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
QA-Review: Michael Brewer-Davis <mbd@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2021-03-24 21:14:24 +00:00
Aaron Shafovaloff 9d0f66b525 Add student view for annotated document assignment
Test plan:
 - Create an annotated document assignment
 - Open the assignment as a student
 - The document iframe should display

Refs EVAL-1366

flag=annotated_document_submissions

Change-Id: I781038d78ed95965a57b417388fe1288e9557a28
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260502
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Jody Sailor
2021-03-24 18:57:36 +00:00
Eric Saupe 12dd590618 Add setting to prevent teachers from editing course availability
The setting is used in both the new UI and the old. With the React
component a new JS environment variable was required for this
specific check.

fixes LS-1959
flag=none

test plan:
- Create a course and add a teacher
- Verify the teacher can edit course availability
- As a site admin, enable the prevent teachrs from editing course
 availability flag in account settings
- As the teacher, verify you can no longer make course availability
 changes
- Enable new course availability ui
- Verify the teacher is still unable to edit course availability

Change-Id: I27a1fb77a43d7cb6ff1bea48d8b01a293c05333c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261288
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: Eric Saupe <eric.saupe@instructure.com>
2021-03-24 17:51:06 +00:00
Jeremy Stanley 6eba4f0cc1 link cross-shard Attachment#cloned_item_id correctly
test plan:
 - specs.

I don't know of any side-effects of this bug, since the only
place I know cloned_items are still used is in blueprint
courses, which currently do not operate across root accounts.
Might as well fix the issue though, so it doesn't obstruct
consortium blueprints should we implement those

flag = none
fixes LS-1673

Change-Id: Ic19e57d3df3b1f7e9b9f6003f34c20ab440ceb29
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261462
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: Jeremy Stanley <jeremy@instructure.com>
2021-03-24 14:47:23 +00:00
Evan Battaglia a0aae89688 MicrosoftSync: fetch AADs for users
I added two tickets for further work:
- INTEROP-6637: Supports non-email address UPNs.
- INTEROP-6640: correctly/efficiently handle multiple email addresses.
  Need to think a bit on how best to do that.
- INTEROP-6641 (and INTEROP-6608): retry & retry based on throttling

closes INTEROP-6569
flag=microsoft_group_enrollments_syncing

Test plan:
- Add some users in your test course with email addresses that
  correspond to the users we have accounts for in our microsoft tenant
  (talk to me if you are unsure of what these are)
- Run Syncer#sync for a Microsoft Group for the course
- Check that `UserMapping`s have been created corresponding to the user
  and the AAD object ids for their email addresses (look at the
  Microsoft admin console for our test tenant to get the IDs, or look up
  the IDs from the API with `graph_service.list_users`)
- Run the job again. Test both of these cases:
  - If you have extra users enrolled in the course that don't have email
    addresses or don't have users on the Microsoft side, you should see
    the job hitting the MS API again for them, but no new UserMappings
    should be created.
  - If you don't have any extra users, you should see that the the job
    doesn't the MS API.
- Clear out your UserMappings, unenroll one user (enrollment should have
  a workflow_state of 'deleted') and sync again. It should ignore the
  deleted enrollment.

Change-Id: I58575db23de7b2b56c785784efc53b8bd6b8216a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261093
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2021-03-24 14:32:24 +00:00
Evan Battaglia 220b44cbf1 Microsoft Sync, initial syncer job
* Lays out framework for getting and caching Microsoft API tokens and
  hitting the Microsoft Graph API.
* Simple sync job which creates a group for the class if it doesn't
  exist and sets the extra LMS/SIS metadata.

NOTE: I discovered the MS API is eventually consistent -- it does not
immediately create a group when we hit the POST /education/classes
endpoint. In a future commit (I added a new ticket) we can work replace
the "sleep" with polling with sleeping or launching a new delayed job.

closes INTEROP-6567
flag=microsoft_group_enrollments_syncing

Test plan:
* Get creds from me and put in dynamic_settings.yml
* Try getting a token and observe it is cached (only the first time you
  run will you see "get service:timeouts:microsoft_sync_login:error_count"
  and "set microsoft_sync_login/<OURTESTTENANT>" calls to the redis cache):
    MicrosoftSync::LoginService.token(<OURTESTTENANT>)
* Put our test tenant (you can get that from me) into your root
  account's settings[:microsoft_sync_tenant]
* Create a course with a name and description that clearly label it
  as your test course for the Microsoft sync project
* From a rails console run:
    c = Course.find(...) # your new test course
    g = MicrosoftSync::Group.create(course: c)
    syncer = MicrosoftSync::Syncer.new(g)
    syncer.sync
* Run the syncer again and observe (from the MicrosoftSync::GraphClient:
  log lines) that we do not create or delete anything.
* Check that the group looks OK on the Microsoft side:
    g = MicrosoftSync::Group.last
    syncer = MicrosoftSync::Syncer.new(MicrosoftSync::Group.last)
    cgs = syncer.canvas_graph_service
    gs = cgs.graph_service
    gs.get_group(g.ms_group_id)
* Check that the extra properties on the group have been set:
    gs.get_group(g.ms_group_id, select:
      %w[microsoft_EducationClassLmsExt microsoft_EducationClassSisExt])
* Update the group's ms_group_id to nil in the database:
    g.update! ms_group_id: nil
  Then rename the course to something similar but slightly different and
  re-rerun the sync job (you may have to run syncer.course.reload and/or
  syncer.group.reload to make the syncer get new values). Then repeat
  the last two steps. In the first of those two steps, the group name,
  but in the second step, the data in microsoft_EducationClassLmsExt
  should be updated. This is because the syncer assumes if a group has
  been created it was created correctly, but it doesn't assume the extra
  metadata was ever set to it re-sets it. Also check that ms_group_id
  has been re-filled in on the group record.
* Change your creds to something invalid and clear the rails cache.
  Run the sync. It should raise an error. Then check that the Group
  record has been updated with workflow_state=errored and
  last_error="Invalid Status Code: Login service returned 401 for tenant
  <OURTENANT>". This is what will be shown to the user (teacher).
* If you need/want to look at the Microsoft admin web console, you can
  get those creds from me. From there you can delete your group, if
  needed. You can also delete your group by using:
    gs.request(:delete, "groups/#{ms_group_id}")

Change-Id: I077497c1c412095420079ea80d461bd172425bca
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260232
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-03-24 14:30:20 +00:00
Cody Cutrer 60c2b652fe prevent deletion of template courses
closes FOO-1687

test plan:
 * designate a course a template (in console)
 * the Delete this Course button should be gone from the course settings sidebar
 * trying to delete via API should fail

Change-Id: I64621a1cab664bf29bae35a443d168bf51345e05
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260510
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
2021-03-23 20:12:49 +00:00
Michael Brewer-Davis 2297b2e346 delete outcome results when rubric replaced
closes OUT-4247
flag=none

Test plan:
- create new outcome
- create two rubrics which include a single outcome criterion using the new outcome
- create an assignment
- attach one of the rubrics to the assignment
- assess a student using the rubric
- attach the other rubric to the assignment, replacing the first one
- view the /api/v1/courses/xxx/outcome_results endpoint

Change-Id: I94049974b68fe804bd9f61e214ffea57ac2f3510
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260698
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-03-23 17:17:00 +00:00
Michael Brewer-Davis a9ff89f509 make LearningOutcomeResult soft-deleteable
refs OUT-4247

Test plan:
- ensure results from aligned rubrics and from quizzes
  are visible in the learning mastery gradebook

Change-Id: Ie9731f2c702f91b3da2ce4d8ae43f7045ee5509e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260613
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
2021-03-23 17:16:41 +00:00
Nate Armstrong 62e0c3f8f8 Fix modules items api for public_to_auth_users
closes LS-2015
flag=none

test plan: automated

Change-Id: If26b259acf319923060936bd84dfd44c26ce4ecc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261334
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: Nate Armstrong <narmstrong@instructure.com>
2021-03-23 15:24:02 +00:00
Evan Battaglia 046a0ccb13 Add ms_group_id to microsoft_sync_groups
It turns out creating a Microsoft group for a course is a two-step
process; the easiest way to determine if both steps have run is to save
Microsoft's ID for the group one the model, and only save it once we
have run both steps.

flag=none
refs INTEROP-6567

Test plan:
- run migration up, observe new field in DB
- run migration down, observe field is gone

Change-Id: I46be7cce6555cdc8a91770fc13cd94ea9dec23b9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260506
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-03-22 16:30:58 +00:00
Evan Battaglia f32bf09676 MicrosoftGroup::UserMapping
closes INTEROP-6597
flag=none

Test plan:
- rake db:migrate
- try creating a MicrosoftGroup::UserMapping model. make sure Rails
  requires it to have both a root account and a user id (failing
  validation otherwise). Make sure Rails also fails validation if you
  try to create two records with the same user id and root account id.
- describe table (\d+ microsoft_groups_user_mappings) and check that
  root account id is non-nullable, the indexes look good,
  replica identity is on [root_account_id, id]
- Rollback migration (rake db:migrate:down VERSION=20210308210138) and
  check that table is gone

Change-Id: I2430eec8843494409e0026fbe761cc7945abf568
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260311
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-03-22 16:30:48 +00:00
Xander Moffatt a31df57c36 correctly mark 1.1 tools not_selectable
* when resource_selection placement is toggled, it doesn't correctly
disable the tool since those placements are on by default
* the not_selectable attribute is what turns off those default
placements, so toggle it with the placement

closes INTEROP-6432
flag=none

test plan:
* install a 1.1 tool with the resource_selection placement
* create a new module item of type external tool and that tool should
appear in the list of tools
* from the apps page where you installed the tool, click the gear ->
Placements -> disable "Assignment and Link Selection"
* on the modules page again, open the dev tools and then right click
Refresh and choose Empy Cache and Hard Refresh
(the `launch_definitions` api endpoint gets cached)
* create new module item of type external tool and that tool should
not appear in the list of tools
* from the apps page, enable the placement
* from the modules page, clear cache again and create a new module item
and the tool should once again appear

Change-Id: I8af0f9c2a93d7a92dfa0f3e7d85cc59c4d3c337c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254752
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>
2021-03-19 23:05:08 +00:00
Cody Cutrer 57a1bb7774 course template setting
closes FOO-1680

flag = course_templates

API and UI; only shown in API and UI if feature flag is enabled

test plan:
 * as an admin, enable the feature flag, then go to a course with
   no enrollments
 * you should be able to check the Course Template checkbox in settings,
   and it saves. then uncheck and it saves
 * in a course with enrollments, the checkbox should be disabled

Change-Id: I778e7a2d7c7cef83d4c32c84bb0940f87ea9d74a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260652
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2021-03-19 18:10:11 +00:00
Cody Cutrer 42c242de41 prevent adding users to template courses
closes FOO-1686

Change-Id: I0355504ad3062d79d8458d66834a70963b803de7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260511
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-03-19 18:08:02 +00:00
Cody Cutrer 091ee63614 add course template columns
refs FOO-1682, FOO-1680

Change-Id: I646619d7b65b97c7c5a62091573d60ac5b541388
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260504
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-03-19 18:07:48 +00:00
Jeremy Stanley bb70052cd1 blueprint: fix syncing files when folders deleted downstream
test plan:
 1. Create a blueprint course with a folder and a file, sync
    to an associated course
 2. Delete the folder in the associated course
 3. Rename the folder in the parent, add a new file, sync it
 4. The sync should succeed
 5. The folder should be recreated in the associated course
    containing only the newly added file from step 3

flag = none

fixes LS-2047

Change-Id: I7753f2459e90bf5e1be47313157824513d7de4d9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261070
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-18 21:41:40 +00:00
Cody Cutrer b83ebeacff log error reports on the shard that was active
when the exception was thrown

Change-Id: I6cda8d863d4fc39125ccc062a58a62fe95d55d75
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258942
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-18 16:58:48 +00:00
Mauricio Salles a4ee9e90be fix no method error on DelayedNotification job
no method error was throwed when a unexpected context was passed
thru a polymorphic_url for a Message object

Test Plan:
   - Monitor the sentry logs to check if theres no new occurencies

fixes VICE-1190

flag = none

qa risk=medium: It may causes unexpected behavior when anchor media
links aren't proccessed as expected due to this unexpected parameter
bug

Change-Id: I0477e0337682f99c84575fb1245bc19a58604cf8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260911
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-18 16:17:27 +00:00
Ethan Vizitei 207af72f16 de-namespace pageview event_stream logging
PageView names it's event_stream instantiation
the constant "EventStream" which shadows the gem
"EventStream", which is not ideal.  This makes sure
we're looking for the logger in the right place.

TEST PLAN:
  1) with pageviews going to cassandra, on write
     failure, we can log the error to actual logs.

Change-Id: I043d7b59bf0eeb187c1eb8c19059b566605211da
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260958
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-17 21:10:42 +00:00
Eduardo Escobar 750c7847da fix grade to score wrong calculations bug
Math operations between float and bigdecimal can get
wrong results so the grade_to_score and score_to_grade
calculations were changed to use only bigdecimal
instead of multiplications and divitions by float

fixes EVAL-1491
flag=none

test plan:

- Create a course with at least one student enrolled.
- Create a grading scheme that has a variable grade
  with a range of 1% so that if the variable grade is given,
  the score will default to the lowest possible
  percentage for that range.
- Create an assignment and set "Display Grade as"
  to GPA Scale or Letter Grade, then choose the
  grading scheme that you just created.
- Set the point value for the assignment that corresponds
  with the grading scheme chosen so that when the variable
  grade is given for the 1% range, the score will have
  more than three decimals.
- Save the assignment and navigate to Speedgrader.
- Give the variable grade for the 1% range to the student
  and notice that the variable grade changes in Speedgrader
  and in the Submissions API. Notice in the Submissions API
  that the score has more than three decimal places
  and is repeating.

Change-Id: Id216698e72c58c4fc46301c48f2f504b4b2a1ef8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260503
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
2021-03-17 19:11:30 +00:00
Gary Mei 67b93cb9a7 persist annotated attachment selection
closes EVAL-1536
flag=annotated_document_submissions

Test Plan
- Create an assignment of type Annotated Document.
- Verify that saving, and reloading, displays the same attachment.
- Verify that this works for multiple combinations of Annotated Document
  and other types of Assignments.
- Verify that uploading an attachment from the FileBrowser works with the
  above steps as well.
- Verify that removing the attachment prompts for another attachment to
  be selected.

Change-Id: Ib9f7825ab4b94a6ccc04462022531fbd40bafdfb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260590
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-17 18:45:15 +00:00
Rob Orton 7baa9ded91 mark announcements as read on correct shard
stream item instances are all stored on the users shard, so we need to
update them on the users shard.

spec covers case

test plan
 - have course with announcement on shard 1
 - enroll user as student from shard 2
 - create course announcement
 - user dashboard should show as unread
 - read announcement as student
 - it should be marked as read on dashboard

fixes VICE-1197
flag=none

Change-Id: I4e103b79992c084d3a383587d420d6a5e95db33b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260577
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-17 17:02:42 +00:00
Pablo Marti-Gomez 4c65f3f583 Add cache to Outcomes::LearningOutcomeGroupChildren
Updates Outcomes::LearningOutcomeGroupChildren by adding cache
at the queries for getting the total subgroups and outcomes.

closes OUT-4148
flag=improved_outcomes_management

Test plan:
- Create nested learning outcome groups
- For each nested learning outcome group create learning outcomes
> With FF improved_outcomes_management: OFF
- On Rails console: calls to Outcomes::LearningOutcomeGroupChildren
methods should return a default value
- On web: when generating actions over ContentTag, LearningOutcome
and LearningOutcomeGroup it should not lead to clear any cache
> With FF improved_outcomes_management: ON
- On Rails console: call Outcomes::LearningOutcomeGroupChildren
methods for getting total subgroups and outcomes, queries to the
DB should be made (it will need the root context)
- Call again the same methods, it should return the values from
cache
- Create a new instance of the class and call the same methods,
it should return the values from cache
- Clear the cache with `Rails.cache.clear`
- On web (or through GraphiQL) get the total subgroups and total
outcomes multiple times; it should cache the data and should not
run additional queries
- On web: clear the cache by executing the following actions:
  - Add a Learning Outcome Group
  - Adopt a Learning Outcome Group
  - Copy a Learning Outcome Group from global
  - Remove a Learning Outcome Group
  - Add an Outcome
  - Remove an Outcome
- Get the total subgroups and total outcomes, it should run new
queries
- Run the same tests for global context, it should generate and
clear the cache in the same way

Change-Id: I9b0bfc68b84b3e36869d69a926ef84d9989ea96d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257257
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Chrystal Langston <chrystal.langston@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2021-03-17 16:49:37 +00:00
Rob Orton 5cffab2bd1 clean up stream items more efficiently
this consolidates four after saves into one and does it more efficiently

test plan
 - existing specs should pass

fixes VICE-1218
flag=none

Change-Id: I974b38711b0146e3f916dd5f48fa52bbfe26ae41
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260579
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-17 16:38:48 +00:00
Weston Dransfield 1ce0ad390b MSFT sync group create endpoint
Closes INTEROP-6561
flag=none

Test Plan:
- Identify a course with no MSFT sync group
  associated with it
- Make a request to create a MSFT sync group
  for that course
- Verify a MSFT sync group record is created
  and returned with the correct default values.
  Note the ID of the group
- Via a rails Console, update that group to
  have a workflow_state of 'errored', a
  last_error set, and a job state set
- Soft delete the group
- Attempt to create a group for the same
  course. Verify the ID of the returned group
  is the same as the group previously noted.
- Verify the returned group has a workflow state
  of "pending" and that both job_state and last_error
  have been set to nil
- Make the exact same request and verify Canvas
  responds with 409 Conflict
- Attempt to create a MSFT sync group via the
  new API as a student. Verify the request fails
  with 401
- Attept to create a MSFT sync group for a course
  that does not exist. Verify the request fails with
  404

Change-Id: Iaa8900575a189c4d5d1d25042a29a4a22ac9954a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260411
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2021-03-16 20:36:57 +00:00
Weston Dransfield ede23743d3 MSFT sync group delete endpoint
Also make MSFT sync group records
soft-deletable

Closes INTEROP-6562
flag=none

Test Plan:
- Create a MicrosoftSync::Group associated with a
  course
- Make a delete request to the new endpoint providing
  the course ID of the course associated to the group
- Verify Canvas responds with "no content"
- Verify the group associated with the course is now
  in a deleted state
- Make the group "pending" again via a Rails console
- As a user who does not have the manage users course
  permission, attempt the same delete request
- Verify Canvas responds with unauthorized
- Experiment with making the delete request for
  courses that do not exist or do not have msft
  groups. Verify Canvas responds with "not found"

Change-Id: I642f5df659abc1b045339318e2c108c4df285e93
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260310
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
2021-03-16 20:23:54 +00:00
Alex Slaughter ec1e6384fa Remove ability to look user up by id - hash is now needed
Test plan:
 - Specs pass
 - Test emails
 - Test discussion boards
 - Test LTI integration urls
 - Test conversations
 - Test different hosts, 127.0.0.1, localhost, canvas.docker, etc.

flag=none

Change-Id: I827c94501c9174ff8ca44aa362c686e198a9869b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258290
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-03-16 20:16:16 +00:00
Kai Bjorkman 3f73f40f67 Revert "create user observer link when enrolling observer"
closes EVAL-1525
flag=none

This reverts commit 906d11bc2a.

Change-Id: I9316faf753748e6c29ae43b3afc543ec3737f011
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260797
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jody Sailor
2021-03-16 18:25:21 +00:00
Jeremy Stanley 31a0b60b67 delay course progress live event dispatch
the ContextModuleProgression may be saved more than once while
requirements are evaluated, and these saves may generate spurious
course completion live events based on incomplete data. evaluating
an item requirement may also trigger delayed re-evaluation of other
requirements.

give these changes time to settle before sending any course progress
live events. queue a singleton job to do so, so multiple changes
in close succession do not result in multiple live events. the
delay is configurable as the "course_progress_live_event_delay_seconds"
Setting (default 120, two minutes).

test plan:
 - enable live events in a production-like environment
 - have a set of modules with requirements
 - as a student, complete some of them in rapid succession
 - wait two minutes, and a course progress live event should be
   created and up-to-date when received (counting the right
   number of completed requirements)
 - as the student, finish the requirements
 - two minutes later, a course completion live event should be
   received

alternatively you could modify the Setting and customize the
expected delay

closes LS-1967

Change-Id: I5c5ab01e75c48cc9916d9299ee1be55d360d1ee7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260416
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-15 23:14:08 +00:00
Charley Kline 2fde47d3cb Add course template permissions
Closes FOO-1684
flag = course_templates

Creates the permissions for controlling access to the new
course template feature.

Test plan:
* With the :course_templates FF on
* Visit the Permissions page, Account Roles tab
* The Courses - Course Templates permission group should
  be there, with the three granulars beneath it

Change-Id: I90f865d0895d463562b2f6c5fe543305e1411ef7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260697
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-15 21:13:51 +00:00
Mysti Lilla 4b2a300e87 Don't cache due dates on non-save
refs INTEROP-6554
flag=none

Test plan
- Have an assignment in a course
- Ensure due date cacher jobs
  have already run
- Do a put to the assignment from
  the API that changes nothing
- Ensure due date cacher doesn't
  run anyway

Change-Id: Ie3e39ef546c0fb9f0db52e10cdb7ead46b36c023
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260594
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
2021-03-15 16:56:11 +00:00
Weston Dransfield 67cbc6c448 Add collaboration DL extension with support for1.3 IDs
Closes INTEROP-6601
flag=none

Test Plan:
1. Install the 1.3 example tool in a course
   with the collaborations placement configured
2. Launch the tool from the collaborations
   placement and return an LTI Resource Link.
   In the test tool UI, also specify a combination
   of user `lti_ids` and group `lti_context_ids`
   from the course
3. Verify a collaboration is created in Canvas that,
   when clicked on, launches the tool.
4. Verify the collaboration is only available to
   users who were explicitly specified or part of
   a group from step 2

Change-Id: Icdd4a1363940a27397b93b9405d2b8878eb784c0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260573
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Wagner Goncalves <wagner.goncalves@instructure.com>
QA-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2021-03-15 15:36:02 +00:00
juanpablo.montoya 2b25f188ff Sync changes to already-published quizzes
When a quiz in an associated course was published, new changes from a blueprint course quiz were not updated in quiz_data.
This fix generates data for new changes to be imported in the associated course

Fixes LS-1931
flag=none

Test plan
- Create a course and make it available as a blueprint course
- Create a new course and associate it to the blueprint course
- Create a quiz in the blueprint course but don't publish it
- Sync the changes
- Go to the associated course and publish the quiz
- Go again to the blueprint course quiz and add new questions or modify the content
- Sync changes
- Students at the associated course should be able to see new changes

Change-Id: I73914dd54f766eefe1fc9baa7779eddcd2052d58
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260495
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: JuanPablo Montoya <juanpablo.montoya@instructure.com>
2021-03-15 14:43:41 +00:00
Nate Armstrong 7fc5013bd6 Handle rounding errors for min_score requirements
refs LS-1916
flag=none

Uses BigDecimal when comparing scores for min_score completion
requirements.

test plan: automated :)

The best way to test this locally is to:
- Create a course with a student
- Create a module and add an assignment to that module
- Make the assignment worth 10 points
- Add a module completion requirement for the assignment to
  score at least 1
- Publish the module and the assignment
- In the UI, give the student a grade of 0 for the assignment
- As the student, see that the item is incomplete
- From the rails console, find the submission and give it
  a score of 0.3 + 0.3 + 0.3 + 0.1

```
submission = Submission.last
submission.score = 0.3 + 0.3 + 0.3 + 0.1 # 0.9999999999
submission.save
```

- As the student, refresh the modules page
- See that the module item is marked as complete
- View the module item in the api and verify it is marked as complete
  there too `/api/v1/modules/:module_id`

Change-Id: I428fef5eb73e07ed64b5e43509159b9317d4645d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260593
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>
Product-Review: Nate Armstrong <narmstrong@instructure.com>
2021-03-12 23:44:26 +00:00
Ethan Vizitei ef86b153f3 don't keep bouncing the same channels repeatedly
also store a fast flag to prevent
many jobs for trying to hit the same address
right on the heels of each other.

Change-Id: I8dfbcbf7a5b0a3ff3445840bc031d1e4ea3cf79f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260575
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-03-12 20:40:20 +00:00
Rob Orton e1a2f30ece don't expect context for feature_enabled?
test plan
 - have a public course
 - try to view files in public course
 - it should not error

fixes VICE-1217
flag=granular_permissions_course_files

Change-Id: Icdc2e4646e5aaaeabe0b08c1494800aeee22180e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260578
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-12 20:04:39 +00:00
Michael Ziwisky d2e5c41180 Set up replica identity index for AssetUserAccess
refs FOO-1171
flag=none

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

Change-Id: I9db3afcd14042cd997fa042b1ddd12b2cf0a3a5a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260521
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>
2021-03-12 17:24:48 +00:00
Jeremy Stanley 54794963c2 remove unused Enrollment#type_with_indefinite_article
this is bad I18n and is also dead code after g/258425

flag = none
refs LS-1824

Change-Id: I4ced8d0b45017703a151f2ddf9820a4195533cdb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260494
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>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-11 22:33:49 +00:00
August Thornton 533f3010cc remove dead Course#groups_visible_to code
Grepping the usage of Course#groups_visible_to in canvas-lms
codebase as well as our livegrep instance turned up with no
app code usage; only usage was in tests.

fixes FOO-1695
flag = none

test plan:
 • builds should pass

Change-Id: I76ff1cfecc8025db9b81d0687df39db68a30d756
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260392
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>
2021-03-11 20:57:53 +00:00
Simon Williams 8b4066e994 update manage_students label and description for granular split
refs FOO-1641
flag = granular_permissions_manage_users

test plan: label and descrption for manage_students are updated when the
granular_permissions_manage_users flag is enabled.

Change-Id: Ibd0b5d746b39a41a74590f47945c1de5eb3421a1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260382
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2021-03-11 20:25:04 +00:00
Jeremy Stanley e9271f8886 revert overridden_requirements_met in course completion live events
this was kind of a shot in the dark and it didn't fix the problem.
we have decided to take a different approach.

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

this reverts commits 0b113807a7
and 60c6abb547

flag=none
refs LS-1967

Change-Id: Icee1eff0ddb94b8e7cd9c1edfbfffea867e2d419
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260141
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-10 23:20:49 +00:00
Gary Mei 70cad93c82 add canvadocs_annotation_context
closes EVAL-1457
flag=annotated_document_submissions

Test Plan
- In a rails console, create 2 CanvadocsAnnotationContexts.
  ```
  CanvadocsAnnotationContext.create!(
    attachment_id: #{the_assignment_attachment_id},
    submission_id: #{submission_id},
    submission_attempt: #{1 and then 2}
  )
  ```
- Act as a student for the following steps.
- POST to
  api/v1/canvadoc_session?
    submission_attempt=1&submission_id=#{submission_id}
- With the returned url, open a Canvadocs session and make annotations.

- Repeat the previous two steps, with submission_attempt=2.
- Verify that annotations are persisted separately for each
  submission_attempt.

- Repeat, with submission_attempt=draft.
- Verify that annotations from the previous attempts do not cross over.

Change-Id: Id2e876e232fe4f5a5c1de91ad27c40314a4a7946
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258876
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-10 21:05:34 +00:00
Eduardo Escobar a45cbe8800 fix gradebook version switching bug
gradebook_version now uses the model UserPreferenceValue
instead of the serialized hash in the user model

fixes EVAL-1259
flag=none

test plan:
- Go to Gradebook in a course.
- Click on Gradebook on the upper left,
  then Individual View. Notice the page refresh.
- In individual view, do the same process to go back
  to the Gradebook, and notice the behavior
  from that side as well. (without this fix, sometimes
  when you try to switch between individual and default
  it stays in the same page without switching the version).

Change-Id: Ic13e863750422d5cefa3b44ec68a4cc86469ef4b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260051
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-10 20:34:35 +00:00
Rob Orton bca1354147 remove feature flag for reduce_push_notifications
test plan
 - specs should pass

fixes VICE-1004
flag = reduce_push_notifications

Change-Id: If227c3be628ac4a225f56dd91acc09d12c45a07c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260087
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2021-03-10 19:08:29 +00:00
Mysti Lilla 3d384fc05d Check TurnItIn permission against actls too
fixes INTEROP-6394
flag=none

Test plan
- Set up a submission with turnitin_data like
  {provider: 'vericite'} and an originality
  report to take you somewhere like www.google.com
- Add an Assignment Configuration Tool Lookup
  for tool_product_code 'turnitin-lti' or other
  on the assignment for the submission
- Ensure you can still see the report

Change-Id: Ib747f58c550ac17449fcc98007b1300c41c7e00a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259797
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2021-03-10 17:51:16 +00:00
Ethan Vizitei 985136e053 auditors extraction: stage 2
refs FOO-1644
[fsc-timeout=30]

 - declare dependency on dynamic_settings
 - move Auditors code over to Audits module
 - declare dependency on canvas_cassandra
 - declare dependency on event_stream
 - get tests on Auditors module from parent app to pass locally
 - shim Auditors to point to Engine
 - update in-repo callsites to use module from engine

Change-Id: I78aaf27c236bcb3a4cd32b3773ec7acddc30cd39
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259222
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2021-03-10 17:25:32 +00:00
Weston Dransfield 1f2b54e3aa MSFT sync group show endpoint
Closes INTEROP-6560
flag=none

Test Plan:
- Create a course with a MicrosoftSync::Group
  record associated to it
- As a user with the manage_students permission
  for that course, make a request to the new endponit
- Verify a JSON representation of the group is returned
- As a user without the manage_students permisson, attempt
  to make the same request
- Verify a 401 is received
- Delete the MicrosoftSync::Group
- Make the same request and verify a 404 is returned
- Make the same request to a course that does not exist
- Verify a 404 is received

Change-Id: I32f7068fc97bd803045ed35f7f3df2efce1d9b4e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260077
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
2021-03-10 16:27:50 +00:00
Adrian Packel 38874dc5d0 Don't show draft comments to observers
fixes EVAL-1389
flag=none

Test plan:
- Have a course with:
  - A student
  - An observer observing said student
  - Two instructors
- As one of the instructors:
  - Grade the student (or post their submission by whatever means)
  - Type a comment on the student's submission in SpeedGrader, but then
    save it as a draft (by switching to a different student before
    submitting the comment)
- View the submission details page for that student and check that the
  following hold:
  - As the student, the draft comment should not appear
  - As the observer, the draft comment should not appear
  - As either instructor, the draft comment SHOULD appear

Change-Id: Ibbeeb3b9fc48fcfd2382745c20a0fe6994905f4d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259838
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-03-10 15:52:04 +00:00
Evan Battaglia 01e87e81a3 Add MicrosoftSync::Group table and model
Does not contain UPN->AAD cache or member/admin aads, those will come
later if needed.

Test plan:
- rake db:migrate
- Check that root account id is non-nullable and there is an index on
  (root_account_id, id) (e.g. `\d+ microsoft_sync_groups`)
- check there is unique index on course_id
- Verify the replica identity for developer_key_account_bindings
  has been set to index (SELECT relname, relreplident
  FROM pg_class WHERE relname = 'microsoft_sync_groups';)
- Check that root_account_id is automatically added when you create a
  MicrosoftSync::Group
- Rollback migration (rake db:migrate:down VERSION=20210301174622) and
  check that table is gone

closes INTEROP-6558

Change-Id: I3250659e4e06c285ecf1b121b2078fb1051ae7be
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259734
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-03-09 22:08:09 +00:00
Jeremy Stanley 7e8915e7fd don't turn <iframe></iframe> into <iframe/> on import
apparently this tag isn't allowed to self-close

test plan:
 - record a video in course content and new RCE
 - add some text below the video
 - export the course to a package and import the package
 - the text in the copy of the item should still be there
   (specifically, it should still be outside the iframe,
    not inside it where it's invisible)

flag = none
fixes LS-1968

Change-Id: I1e189e850fa261059e8b6976947dc18320b49a25
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260210
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-03-09 19:43:45 +00:00
Michael Jasper 53c7bacf6b Account setting for enabling push notifications (default on)
refs SAS-1852

NOTE this is not yet implemented in the notification service.
We're adding the setting and feature flag to enable accounts
to opt in/out before it takes affect

Change-Id: I72bd7dde3d6b5b8528133e69017f465bb3bb712b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259948
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Michael Jasper <mjasper@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
2021-03-09 19:14:37 +00:00
Chawn Neal 20d1ca7f63 Prevent duplicate Integration Id.
fixes VICE-1172
flag=none

Add model validation to prevent duplicate integration_id.
Add spec for didplicate sis_source_id.

Test Plan:
 1) rspec spec/apis/v1/sections_api_spec.rb:593  -fd
    rspec spec/apis/v1/sections_api_spec.rb:600  -fd
 2)
 Go to Canvas console.
  rails c
 Create a course and assign it to a variable.
  c1 = Course.create(name: "Sample Test Course")
 create a course section for that course and give it
 an integration_id and make sure you save.
  c1.course_sections.create!(name: "Test Section", integration_id: 'taken')
 Create a second course_section for the same course
 and assign it to a variable.
  c1.course_sections.create!(name: "Test Section 2")
 After the second one saves, assign its integration_id
 to the same value as the previous course section.
  cs1 = c1.course_sections.last
  cs1.integration_id = "taken"
  cs1.save
 It should fail. You can check the errors and it will say:
 Integration ID already in Use.
  cs1.errors.first
 You can repeat these steps using the field "sis_source_id".

Change-Id: Icc0f124c6b34bf5cf12109c744c4343deb955cbf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260250
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-09 17:47:33 +00:00
Rob Orton 2a72e95076 remove unused method and used once method
test plan
 - specs should pass

flag=none
fixes VICE-921

Change-Id: I119bd04efe170dd40f648cc487b1ca41305a4a6e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260088
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-08 23:00:04 +00:00
Davis Hyer 118f68fb8b encode author avatar urls in messages
fixes VICE-1173
flag=none

encoding wasn't enforced at the db level to prevent
the propagation of errors up to consumers

test plan:
  - create a user, set their avatar url however you'd like
    - rails console:
      > User.find(...).update(avatar_image_url: 'bad data.png')
  - as that user, send a message via the inbox to another user
    - manually trigger the message to be "sent" with:
      > ConversationMessage.find(...).after_participants_created_broadcast
  - visit /error_reports and confirm the avatar url wasn't the cause
    of any new errors (config may result in failure to deliver errors)

qa risk: low

Change-Id: Iefa006c39e30cff45ba34d2a2baa1299063f845d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259961
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>
2021-03-08 17:25:15 +00:00
Jackson Howe 720932ec88 Make k5 mode an account setting
This adds a boolean, inheritable account setting to specify whether
the (sub)account should be a k5 account. Default is false. Once an
account enables this setting, it is locked as ON for all accounts
down the inheritance chain.

Still to come in other tickets: make this setting do something (it's
just there right now and doesn't do anything)

flag=canvas_for_elementary
closes LS-1917
closes LS-1918

Test plan:
 - Enable the canvas_for_elementary FF
 - Enable this Canvas for Elementary setting in an account
 - Go to a subaccount of that account, expect the setting to be on
   and locked in that subaccount

Change-Id: If5f43851d6ed17997d2c865708a39aa9139d3ea8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259170
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2021-03-08 16:14:42 +00:00
Jeremy Stanley b3156ca81d prevent error when failing an already-failed export
test plan:
 - with jobs _not_ running (so the export won't just finish while
   we're testing),create a content export with the API, e.g.:
 
  POST /api/v1/courses/1/content_exports?export_type=common_cartridge
  
 - mark the export failed:
 
  PUT /api/v1/courses/1/content_exports/X/fail
  
 - you should see "workflow_state: 'failed'" in the response.
   now mark it failed again, and you shouldn't get a 500 error

flag = none

closes LS-1964

Change-Id: Iaa96ee3d2789f3bf60d91890b57bd311cbfeae89
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259971
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-05 19:04:42 +00:00