Commit Graph

1473 Commits

Author SHA1 Message Date
James Williams 32615c5823 add updated_at to enrollment_states
Change-Id: I5d66e52d993dc2d9692dbe1690a2060a3336220d
Reviewed-on: https://gerrit.instructure.com/202960
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-08-20 17:06:58 +00:00
Mysti Lilla 25b9eb099e Create model for direct share
closes ADMIN-2808
flag=direct_share

Test plan
- n/a

Change-Id: I1481e273b76bf969ce8e3a510702bfa1f11fb0d7
Reviewed-on: https://gerrit.instructure.com/204282
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: Mysti Lilla <mysti@instructure.com>
2019-08-20 15:50:18 +00:00
Jeremy Stanley 331bb4561d create view_feature_flags account permission
prior to this commit, only users with manage_feature_flags
permission can see the features tab in account settings.
this commit creates a new view_feature_flags permission
(granted to everyone who has manage_feature_flags) that allows
access to the page (which will be read-only if
manage_feature_flags is not also possessed).

test plan:
 - PRIOR TO APPLYING THIS PATCHSET, create a custom account
   role and give it "Feature Options - enable / disable"
   permission
 - apply the patch set, run migrations, and restart the server
 - ensure the "Feature Options - view" permission appears
   in Permissions and is granted to the custom role created
   in the first step
 - set up a role that contains "view" but not "enable / disable"
   and ensure a user in this role sees a read-only view
 - if you want to be fancy, give _both_ permissions to a role,
   and edit the role override in the console for manage_feature_flags
   to say "applies_to_self: false" in site admin in the console
   and confirm the user gets a read-only view in site admin
   and a writeable view in a normal root account

closes ADMIN-2802

Change-Id: I64da46d7d9efa587108acd0358cea5561f0e5376
Reviewed-on: https://gerrit.instructure.com/204208
Tested-by: Jenkins
Reviewed-by: Rex Fleischer <rfleischer@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: KC Naegle <knaegle@instructure.com>
2019-08-14 22:16:10 +00:00
Ethan Knapp caf1158b43 add sis_source_id to Assignments
Test Plan:
- Canvas Migrations should run successfully
- Attempting to save Assignments (within the same RootAccount) with the
    same sis_source_id should fail
- [API] Assignment GET should include sis_assignment_id field
- [API] Assignment POST should allow setting the sis_assignment_id
- [API] Queries involving an Assignment should support the `assignments/sis_assignment_id:BLAH` syntax

refs PFS-11978, PFS-12661

Change-Id: I37a8d396bb409e98f6372abdc5b08f25f1d8d0f7
Reviewed-on: https://gerrit.instructure.com/199025
Tested-by: Jenkins
Reviewed-by: Tyson Brown <tbrown@instructure.com>
QA-Review: Trevor Byington <tbyington@instructure.com>
Product-Review: Collin Anderson
2019-08-08 23:02:51 +00:00
Ryan Norton d790a76222 add body to submission draft in graphql
we need to add a 'body' field to the submission draft type
in graphql to allow us to store text entry drafts going forward.

Test Plan:
* run the db migration to add body to submission draft:
** bundle exec rake db:migrate:up VERSION=20190801215707

* create an assignment as a teacher
* add a student to that assignment
* run the following in the /graphiql endpoint to locate the
  submissions for that assignment

  ```query MyQuery {
  assignment(id: "1") {
    submissionsConnection(filter: {states: [unsubmitted, submitted, graded, pending_review]}) {
      nodes {
        _id
        submissionDraft {
          body
        }
      }
    }
  }
}```

** you should see a submission with a null submission draft

* in the rails console, you will need to add a submission
  draft with a body to that submission
** sub = Submission.find(1) // or whatever your submission ID is
** draft = SubmissionDraft.create!(submission: sub,
   submission_attempt = sub.attempt + 1)
** draft.body = 'some text'
** draft.save!
** sub.submission_drafts = [draft]
** sub.save!

* run the query in graphql again, and you should see something
  like:

```
{
  "data": {
    "assignment": {
      "submissionsConnection": {
        "nodes": [
          {
            "_id": "31",
            "submissionDraft": {
              "body": "some text"
            }
          }
        ]
      }
    }
  }
}
```

fixes COMMS-2263

Change-Id: I62877ac43727f02191c84a98e2609bd8f9987733
Reviewed-on: https://gerrit.instructure.com/203674
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Ryan Norton <rnorton@instructure.com>
2019-08-06 17:37:15 +00:00
Steven Burnett ab630c4836 add viewed submission comments table
fixes COMMS-1943
Test Plan:
- Keep in mind this has no visual or graphql portions to it yet
  this is only getting the infrastructure around it.
- Create a submission
- Create a submission comment on the submission
- notice you can mark the comment as read by calling comment.mark_read!(@user)
- notice you can also mark the comment as read by marking its submission
  as read.  Do this by calling @submission.mark_read(@user)
- you can check the comments read status by calling comment.read?
- the end

Change-Id: If1d11f04d4db0b318582a59eb4454b1225d3eb2b
Reviewed-on: https://gerrit.instructure.com/202950
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-08-01 17:04:17 +00:00
Cody Cutrer a127528a6f drop rails 5.1
add flags for 6.0, even though it doesn't actually do anything yet

Change-Id: If8aba4d9f92e8a8ec890deadba7a94e21e01a804
Reviewed-on: https://gerrit.instructure.com/202686
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-08-01 14:09:31 +00:00
James Williams e30f505827 fix file deletion and replacement for inst-fs
test plan:
* with inst-fs enabled, should be able to
 run `attachment.destroy_content_and_replace` in a
 rails console successfully
* it should replace the file with the tumbleweed doc
* should be able to run `attachment.resurrect_from_purgatory`
 in a rails console
* the file should be restored

closes #CORE-3166

Change-Id: If12f4e3d7db0ef5a019bcd251c45b91579857521
Reviewed-on: https://gerrit.instructure.com/200098
Tested-by: Jenkins
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2019-08-01 12:30:48 +00:00
Cody Cutrer 60f26262fa bump inst-jobs
fixes rails 5.2 regression

Change-Id: Ibfcd98882bc3266b28ec20ae1190b88ea649e274
Reviewed-on: https://gerrit.instructure.com/202832
Tested-by: Jenkins
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-07-31 23:20:25 +00:00
James Williams 2b82831efe drop unused columns from submissions
Change-Id: I5f11f902ff7c7a155956b2cf4d6d8dcb275d3f7a
Reviewed-on: https://gerrit.instructure.com/202806
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-07-26 15:23:59 +00:00
Cody Cutrer 58a199e50f split cache_quiz_lti migration into add and backfill
Change-Id: Idf0241c52d83b2ea70c8ca5df448a3c8fc47e5b3
Reviewed-on: https://gerrit.instructure.com/202325
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Tested-by: Jenkins
2019-07-23 20:04:19 +00:00
Ryan Shaw 148d1c009f add mobile-global-nav logo brand variable
This will be used by the mobile responsive nav stuff but I made it’s
Own commit so the brand_config migrations can be dealt with in a small
Change.


Test plan:
* go to the theme editor, 
* there should be a new spot to upload a logo for 
  “mobile-global-nav-logo”
* upload something to it
* when the page reloads the new image you uploaded should show up
  In that square where the “Canvas” logo default was.

Change-Id: I28a98e16b14ef9d0711543de7326650e5a47251e
Reviewed-on: https://gerrit.instructure.com/201427
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-07-17 19:06:06 +00:00
Rob Orton 700333ca7a add grade_passback_setting to course
fixes CORE-3156

test plan
 - specs should pass

Change-Id: I3e90d4c8ad9aa022c6fa2257c85d9b656e005010
Reviewed-on: https://gerrit.instructure.com/200364
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-07-16 15:11:34 +00:00
Rob Orton 1ac9efb872 make calendar feeds work after user_merge
Fixes CORE-3184

test plan
 - copy the calendar feed on a user
 - merge the user into other user
 - use the copied feed to hit the calendar api
 - it should work

Change-Id: Iafa1a23bc6cf253ae7f00e78b9e8ee2cc0cfd78f
Reviewed-on: https://gerrit.instructure.com/200899
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2019-07-11 23:12:54 +00:00
Adrian Packel c589d975c7 Don't murder database with post policies
closes GRADE-2274

Test plan:
- specs pass, migration runs

Change-Id: I2484ead5edef82cc0046ecdf09ab6e90c70b467f
Reviewed-on: https://gerrit.instructure.com/199358
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2019-06-27 20:24:37 +00:00
Keith T. Garner 536a72f2f8 cache quiz_lti on submissions
This caches/denormalizes the quiz_lti? information from assignments
onto submissions. This makes queries for missing/late Quizzes.Next
quizzes to be easier without having to join three tables. (Future
ticket coming to make this happen.)

closes GRADE-2231

test plan:
 - Have a course with a student and a Quizzes.Next assignment and
   another non-Q.N assignment. (You can fake the quizzes next assignment
   via the rails console)
 - On the rails console check the submission object for each
   assignment. Confirm that the quizzes.next assignment has
   cached_quiz_lti set to true and that the other assignment has it
   set to false
 - Create another assignment with on paper. Save.
 - Switch it to a Quizzes.Next assignment.
 - On the rails console check the submission object for each
   assignment. Confirm that the new quizzes.next assignment has
   cached_quiz_lti set to true
 - For the new assignment, in the rails console, find the ContentTag
   and .destroy it
-  On the rails console check the submission object for each
   assignment. Confirm that the new quizzes.next assignment has
   cached_quiz_lti set to false

Change-Id: I4bfc1d3a282863dde9de9658b335b9a24b2341e5
Reviewed-on: https://gerrit.instructure.com/197811
QA-Review: James Butters <jbutters@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-06-27 14:28:42 +00:00
Marc Phillips f0089b2346 Add line_item extensions to line_item json
refs PLAT-4486

Test Plan:
 - create a line_item with the extension defined, should show up
   in the retrieval of that line_item

Change-Id: Ia379329dc3509c4d91b81d6e218afb9add7d9dc7
Reviewed-on: https://gerrit.instructure.com/198547
Tested-by: Jenkins
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2019-06-21 19:26:43 +00:00
Clint Furse 4e2c4c6572 Add Submission URL when creating submission via AGS
closes PLAT-4486

Test Plan:
- Update a Score on a LineItem via an LTI tool
  and include a submissionUrl
- make sure both the Submission and Result reflect the new URL
- also try to submit URL without a grade

Change-Id: I4c92fc86bee28a9ffc2599108a417c46a20cf532
Reviewed-on: https://gerrit.instructure.com/198401
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-06-21 15:45:41 +00:00
Drake Harper 0df1e52bb0 dd public_jwk_url and is_lti_key fields to developer key model
refs PLAT-4493

Test Plan:
-Create a developer key and verify that it has the new fields
	(public-jwk_url and is_lti_key)

Change-Id: I72508ae26709ce5f7560de35d5ee0c03d4000b5d
Reviewed-on: https://gerrit.instructure.com/197314
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Drake Harper <dharper@instructure.com>
2019-06-18 14:33:50 +00:00
James Williams bb3f8a0c04 make failed_jobs.handler a text column
just like delayed_jobs.handler

test plan: existing specs

closes #CORE-3091

Change-Id: I8c073cd269e4b52acd1431924970cec18634356c
Reviewed-on: https://gerrit.instructure.com/198033
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2019-06-18 13:55:51 +00:00
Rob Orton 3436877d47 use created_at over updated_at for latest report
refs CORE-3010
refs CORE-3011

test plan
 - specs should pass

Change-Id: Ife4dc224f539a3072ce4607d1ffb8295a0295eef
Reviewed-on: https://gerrit.instructure.com/195561
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-06-13 14:39:50 +00:00
Adrian Packel 93fc19368b Set post policies for existing assignments
Set post policies on existing assignments and courses as appropriate,
and update the posted_at values of submissions belonging to the
asignments to match.

closes GRADE-1946

Test plan:

NOTE: This patchset will enable automatic creation of PostPolicy objects
for new assignments and courses. For your test data to be in the proper
form (i.e., with no PostPolicy objects attached), you should either
create it with a previous patchset or--if you use this patchset--delete
the resultant PostPolicy objects via the console.

(In the test plan below, a "manual post policy" refers to a PostPolicy
object for the specified course or assignment with post_manually set to
true, while an "automatic post policy" refers to one with post_manually
set to false.)

- Set up a course (C1) that:
  - Does *not* have a default_post_policy object (i.e., no PostPolicy
    object exists with course_id = C1 and assignment_id = nil)
  - Has the following assignments:
    - A non-moderated, non-anonymous assignment (A1)
    - A non-moderated, non-anonymous MUTED assignment (A2)
    - A moderated assignment (A3)
  - Assign grades for some (not all) submissions on each assignment
  - For A3, have the moderator do some moderating and then post
    all grades
- Set up a course (C2) that *does* have a default_post_policy
- Run the migration, and then check the following
  - For C1:
    - The course itself should have an automatic post policy created
    - For A1:
      - An automatic post policy should be created
      - The posted_at date of *graded* submissions should be set to
        their graded_at date
      - The posted_at date of ungraded submissions should be nil
    - For A2:
      - A manual post policy should be created
      - The posted_at date on all submissions should be nil
    - For A3:
      - A manual post policy should be created
      - The posted_at date on all submissions should be set to their
        graded_at time (which should be when grades were published)
  - C2, since it has a post policy already, should be ignored entirely,
    and all assignments within it should be ignored
- On further runs, C1 should be ignored since it has a post policy now

Testing new behavior:
- With the post policies flag NOT enabled, check that:
  - Muting an assignment assigns it a manual post policy
  - Unmuting an assignment assigns it an automatic post policy
    - ...UNLESS it is anonymous
  - Creating a new assignment should create a post policy for it
    - If anonymous/moderated, the policy should be manual
    - Otherwise it should default to the course's post policy
      (or to automatic if the course inexplicably has none)
  - Creating a new course should always create an automatic
    post policy for the course
- Check that the same behavior holds with the flag enabled

Change-Id: Ib2fbfc2342a1282c1a6942cc68b2aeccbbc73b70
Reviewed-on: https://gerrit.instructure.com/196237
Tested-by: Jenkins
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-06-10 18:25:32 +00:00
wdransfield 41a7fe98ef Add submission_time to originality report
Refs PLAT-4296

Test Plan:
Verify the submission version is set when
creating an originality report

Change-Id: Ic855a6381cc4c36d2c6b2cb65b56448e1052ce82
Reviewed-on: https://gerrit.instructure.com/196340
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-06-05 20:05:46 +00:00
wdransfield 577018bff3 Change originality report attachment id index to not unique
Closes PLAT-4498

Test Plan:
Verify you can create multiple originality reports with the same
originality_report_attachment_id

Change-Id: I9f0de46c79534c86da864fd218ee8c3ec59608bb
Reviewed-on: https://gerrit.instructure.com/195802
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
2019-06-05 16:18:09 +00:00
Jacob Burroughs b1f537ef6a Update logos for new branding; remove dead unused ones
fixes UIDEV-262

Change-Id: Ie3b1935c67218b57adfe8b0576e3185bc1f58205
Reviewed-on: https://gerrit.instructure.com/196156
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Jenkins
Reviewed-by: Pam Hiett <phiett@instructure.com>
Product-Review: Pam Hiett <phiett@instructure.com>
2019-06-04 17:09:33 +00:00
Marc Phillips 564768db50 Add null:false default active to lineitem
refs PLAT-4502

Test Plan:
 tests pass

Change-Id: I553dc68c9103a16e22deb62b4265404844ed9fe6
Reviewed-on: https://gerrit.instructure.com/195908
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2019-05-31 12:25:55 +00:00
Marc Phillips d376235a22 Add soft delete to LTI Advantage models
Some tests will still fail, but I wanted to
check on thing

fixes PLAT-4502

Test Plan:
 - delete an assignment from a tool that has results, its line_items shouldn't
   show up in an ags line_items call for a course
   - the results should also not be found for the lineitems
   - you shouldn't be able to post a score to the line item
 - check the database to see that the line_item has been deleted softly

Change-Id: I2a55f1abe8f852c1df6000baadcfdce7c70109f9
Reviewed-on: https://gerrit.instructure.com/195509
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-05-30 18:01:23 +00:00
wdransfield 44bcb7a849 Add root account association to external tools
Refs PLAT-4483

Test Plan:
Run migrations and verify you can set the
root_account association of a context external
tool

Change-Id: I77ead138f7e589f8a590536807e730140dfdebf9
Reviewed-on: https://gerrit.instructure.com/193854
Reviewed-by: Marc Phillips <mphillips@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Drake Harper <dharper@instructure.com>
Tested-by: Jenkins
Product-Review: Marc Phillips <mphillips@instructure.com>
QA-Review: Marc Phillips <mphillips@instructure.com>
2019-05-21 15:51:05 +00:00
Cody Cutrer 6b6cb86ca5 limit lots more stuff to non_shadow root accounts
Change-Id: I99f8edb00d912b31ca29cba32f724ac33330e4ab
Reviewed-on: https://gerrit.instructure.com/194426
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2019-05-20 22:49:36 +00:00
Landon Gilbert-Bland 7c59c834b5 SubmissionDraft model initial commit
This is the first part of submission drafts that only account for file
uploads. Other types (body, media comments, etc) will be coming in
future commits.

Fixes COMMS-2050

Test Plan:
  - Migrate your database with this patchset checked out
    `bundle exec rake db:migrate:up VERSION=20190503151652`
  - Have some attachments in your database
  - Have a course with a studnet in it
  - Create and publish a new assignment in this course
  - Open the rails console, and notice that the submission for the
    student does not have any submission drafts associated with it

    ```
    s = Submission.last
    s.submission_drafts.empty?  # Should be true
    ```

  - Create a new submission draft with some attachments in the console,
    and notice that you can see the draft and attachmetns from the
    submission

    ```
    draft = SubmissionDraft.new(submission_attempt: 0)
    submission = Submission.last
    submission.submission_drafts << draft
    attachments = Attachment.limit 3
    draft.attachments = attachments

    submission.submission_drafts # Should show the new draft
    submission.submission_drafts.first.attachments # The attachments
    ```

  - From the web ui, submit the assignment as the student.

  - Back in the rails console, and notice that the submission draft
    has now been deleted

    ```
    submission.reload
    submission.submission_drafts # Should now be []
    SubmissionDraft.count # Should be 0
    SubmissionDraftAttachment.count # Should be 0
    ```

  - Notice that the attachments in the rails console have not been
    deleted.

    ```
    attachments.each(&:reload)
    attachments.map(&:persisted?) # Should all be true
    ```

  - Make sure you cannot create a draft that has a higher attempt then
    the  root submission:

    ```
    SubmissionDraft.create!(
      submisison: submission,
      submission_attempt: 0
    )  # Should raise a RecordInvalid error
    ```

  - Undo the database migration until this gets merged.
    `bundle exec rake db:migrate:down VERSION=20190503151652`

Change-Id: Ibedda3719e582b3aa67f049699603f3fc7cbc145
Reviewed-on: https://gerrit.instructure.com/192212
Tested-by: Jenkins
QA-Review: Matthew Lemon <mlemon@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Landon Gilbert-Bland <lbland@instructure.com>
2019-05-17 14:42:08 +00:00
Cameron Matheson 510f50090e log graphql mutations
closes GQL-57

Test plan:
  * run some mutations
  * without a config/dynamodb.yml, graphql queries/mutations should work
    as usual
  * set up a 'auditors' category in config/dynamodb.yml:
    * information about mutations should be recorded to the
      '#{auditors-prefix}-graphql_mutations' table

Change-Id: Ide0e3707f74488dfa896ddb97820956e5bdc8e27
Reviewed-on: https://gerrit.instructure.com/188460
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-05-15 18:43:24 +00:00
Nate Collings b4bcc95d07 update HelpLinks to run in the context of an account
Updates the HelpLinks class to run in the
context of an account, and changes the methods
to instance methods. This allows us to add dynamic
links in multiple_root_accounts that need access
to the Account object in order to generate their
links.

Test Plan:

- Validate that you can still open the Help Links
  panel like normal
- This will be tested in conjunction with the change
  and test plan on
https://gerrit.instructure.com/#/c/multiple_root_accounts/+/191725/

refs PFS-12548

Change-Id: I6dbc283d20db325cc06a9898b899f424ea8532fb
Reviewed-on: https://gerrit.instructure.com/190897
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
Product-Review: Jim Harris <jharris@instructure.com>
QA-Review: Petra Ashment <pashment@instructure.com>
2019-05-09 16:08:36 +00:00
wdransfield 41f65a19cf Allow setting error message on originality reports
Closes PLAT-4404

Test Plan:
- Create an originality report via API and specify
  the "error_message" attribute in the request.
- Verify an originality report is created with
  the correct "error_message."
- Attempt to update an existing originality
  report via API and specify an error_message.
- Verify the originality report is updated
  with the specified error message.

Change-Id: Id455fb395232687b814d6a7fe7ea1c27a98e8fa5
Reviewed-on: https://gerrit.instructure.com/191200
Tested-by: Jenkins
Product-Review: Jesse Poulos <jpoulos@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2019-04-30 18:39:18 +00:00
James Williams 9e12bd1789 create endpoint to retrieve a unique uploaded media folder
test plan:
* refer to the api docs for the "Get uploaded media folder
 for user" endpoint to create/retrieve a designated folder
 either in the course/group (if the user has file
 management rights) or the user's own context otherwise

* should be able to rename it from the default and
 still have files go to it
* should create a new one if the folder is deleted

closes #CORE-2812

Change-Id: I6832bd86c2e08ee6e88fcb9caa319bf7187e6ff5
Reviewed-on: https://gerrit.instructure.com/190049
Tested-by: Jenkins
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-04-24 13:48:01 +00:00
Ryan Shaw 73a50b8f1d Make the brand_config migrations have to run again
Fixes: CORE-2822

The primary purpose of this commit was to make it so that beta and
Prod are forced into running `BrandConfig.find_each(&:save_all_files!)`
again. This is necessary because we need to create the brotli encoded
versions of each of those files on the CDN.

For backstory on why that’s the case:
Recently, there was a change (g/188866) that will serve everything 
from the cdn from a root /br/ folder for browsers that support brotli.
All the rest of the CDN files got a brotli version uploaded to /br when
rake canvas:cdn:upload_to_s3 was ran as part of the deploy but because
these brand_config files are not there on the deploy box, we need
to upload them too). Otherwise people will get 404s for these files.

The way I actually accomplished this was that I ran some images through
a lossless png compressor so that their binary contents would change
and thus we’d get a new md5. So a nice side effect of this commit is
that these images will be smaller.


Test plan:
* check out master
* if you try to run rails server it should give you an error that you
  Need to run db migrations if you have not yet
* run db migrations
* now everything should work like normal


Change-Id: I806805c2ccbe75a0cf3a6cf6c664721380b802fc
Reviewed-on: https://gerrit.instructure.com/190330
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2019-04-23 14:37:34 +00:00
James Williams 97fbbcaad3 allow cross-shard course copy
test plan:
* before checking this commit out, copy some
 content into a course
* after checking it out, make sure re-copying
 the course overwrites the content from
 the earlier copy (tl;dr migration identifiers
 are being changed but not for old exported/copied courses)
* make sure course copies/imports/exports still work

closes #CORE-2718 #CORE-2720

Change-Id: I7515c7ec2943afaaf502432f1510d3e580f13ced
Reviewed-on: https://gerrit.instructure.com/188371
Tested-by: Jenkins
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
2019-04-22 12:25:06 +00:00
Rex Fleischer 04ca6ab6dd separate feature flag definitions from code
fixes: ADMIN-2539

this moves and loads feature flags from yaml files. there should be
absolutely no changes to functionality of anything in the system.

Test-Plan:
change things with feature flags and different feature options, and make
sure they work the same way as before.

Change-Id: Id096e6c9975f86224c1ee07304cef79a0d4c7755
Reviewed-on: https://gerrit.instructure.com/187804
Reviewed-by: Carl Kibler <ckibler@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Rex Fleischer <rfleischer@instructure.com>
2019-04-18 15:56:54 +00:00
Rob Orton e5291c04db rename user_past_lti_ids to user_past_lti_id
Change-Id: If7801aa4af6e39af0f885eba78e354ec7096db29
Reviewed-on: https://gerrit.instructure.com/189636
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-04-17 19:11:29 +00:00
Steven Burnett f37ef09f1e convert SRT content to WBVTT
fixes COMMS-1971

Test Plan:
** DO THESE BEFORE CHECKING OUT THE PS
- With notorious running create a bunch of videos with
  the rce or submission contents
- while watching the video click on the cc button
  on the video
- add a bunch of closed captions of SRT type (or media tracks
  as they are stored in the db)
- notice that the cc play on the video
CHECK OUT THE PS
- migrate your db
- notice the column on MediaTracks that you added called
  webvtt_content is now populated
- upload another srt file to a video
- notice it still plays

Change-Id: Iba0004ace0a248d8ed28ffe3015dbf5c5d3ddeee
Reviewed-on: https://gerrit.instructure.com/188126
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Tested-by: Jenkins
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-04-11 20:12:45 +00:00
Adrian Packel 65dd05a484 Convert FGO user prefs to course settings
closes GRADE-2035

Test plan:

Note that this test plan relies on the presence of the FGO gradebook
setting for individual instructors, which has been superseded in our
code by the course setting. See the APPENDIX at the bottom for
instructions on configuring the setting for users/courses.

Course/account setup:
Set up some accounts and courses with the following structure, setting the Final
Grade Override feature flag to the value.

- Your root account (feature flag ALLOW)
  - Course (feature flag ON) [C1]
    - An instructor with the GB setting enabled
  - Course (feature flag ON) [C2]
    - An instructor with the GB setting disabled
  - Course (feature flag ON) [C3]
    - An instructor, but do not set the GB setting
  - A subaccount (feature flag ON)
    - Course [C4]
      - An instructor with the GB setting enabled

Note that the instructors mentioned above can all be the same
instructor.

Actually testing:
- Run the migration
- Observe the following results:
  - Courses:
    - C1: course setting should be true
    - C2: course setting should be false
    - C3: course setting should not be set (i.e., nil)
    - C4: course setting should be true
  - Users:
    - The instructors you set up should have had the FGO setting
      removed from their gradebook settings for affected courses

APPENDIX: setting up the setting (as it were)

To check a user's Gradebook setting for a particular course:
  > user = <some instructor>
  > user.preferences.dig(
      :gradebook_settings,
      <course>.id,
      "show_final_grade_overrides"
    )

To set a user's Gradebook setting for a particular course:
  > user = <some instructor>
  > user.preferences.deep_merge!({
      gradebook_settings: {<course>.id => {
        "show_final_grade_overrides" => <"true" or "false">
      }}
    })

To check the course setting:
  > course = <some course>
  > course.allow_final_grade_override
(Note this is distinct from allow_final_grade_override?, which will
return the setting as a boolean and also check whether the feature is
enabled.)

To set or clear a course setting:
  > course = <some course>
  > course.update!(allow_final_grade_override: <true/false/nil>)

Change-Id: I76b5d5e13d075fd4e4835f67db8745f1173981f4
Reviewed-on: https://gerrit.instructure.com/185985
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Tested-by: Jenkins
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-04-02 18:52:30 +00:00
Rob Orton 3ff025385d handle user preferences and name
also use consistent users and just get them from
the class instead of passing them around

fixes CORE-271
fixes CORE-272

test plan
 - merge a user with prefs
 - they should come through

Change-Id: I1debabbffed1dba8b1c215aa676a51a5b5dc4c53
Reviewed-on: https://gerrit.instructure.com/187281
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-03-29 22:17:07 +00:00
Rob Orton c4de231b0e support past lti ids for users
when a user_a is merged into user_b, user_a is
deleted, but the enrollments lti_tools still point
to the old lti_id, so this allows us to store them
and serve them as the lti_id when a user is merged

fixes CORE-2565

test plan
 - merge a user that uses an lti tool in a course
 - the lti_id should not change for that course

Change-Id: Iac70957ed1fcb08111745a91d0c2e402dfad3002
Reviewed-on: https://gerrit.instructure.com/181905
Tested-by: Jenkins
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2019-03-28 22:03:07 +00:00
Marc Phillips 47cb8c3b03 Remove custom_fields from ToolConfig Model
This belongs in the settings hash.

refs PLAT-4248

Test Plan:
 n/a

Change-Id: I89ca516d9e00e8fe8048e8d419893b16efc0b76d
Reviewed-on: https://gerrit.instructure.com/187200
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-03-28 19:08:48 +00:00
Michael Guymon 59b04ee722 Add AttachmentUploadStatus to track upload errors.
Add model AttachmentProgressStatus that tracks if an upload fails.
This is used instead of the deprecated Attachment#workflow_status
field. The Rails.cache is used store a temporary pending status. If no
pending status or AttachmentProgressStatus for the upload, it is
considered a success

fixes GOOF-709

Test Plan:
* Verify that homework submission from Google works as expected.

Change-Id: I41273eb071ad92ed139e37c994def26065634134
Reviewed-on: https://gerrit.instructure.com/179109
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Joshua Orr <jgorr@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Nick Houle <nhoule@instructure.com>
Product-Review: Nick Houle <nhoule@instructure.com>
2019-03-19 18:31:28 +00:00
Landon Gilbert-Bland 53f8a3d2fb Save submission_comments to specific submission attempt
Test Plan:
  * Create an assignment
  * Submit the assignment
  * Leave some comments on the submission
  * Resubmit the assignment
  * Notice that all the comments show up doing a graphql query like

    ```
    {
      assignment(id: 34) {
        submissionsConnection {
          nodes {
            commentsConnection {
              nodes {
                _id
                attempt
                comment
              }
            }
          }
        }
      }
    }
    ```

  * Open a rails console and change the attempts of some comments. Once
    the mutation is in place for adding comments, this will be handled
    automatically on the assignments 2 page.

    ```
    s = Submission.last
    comments = s.submission_comments
    comments[0].update!(attempt: 1)
    comments[1].update!(attempt: 2)
    ```

  * Run the same graphql query as above and noticie that the attempts
    have been updated.
  * Notice that you can filter by attempts in the graphql query, and it
    works properly:

    ```
    {
      assignment(id: 34) {
        submissionsConnection {
          nodes {
            commentsConnection(filter: {attempts: [0]}): {
              nodes {
                _id
                attempt
                comment
              }
            }
          }
        }
      }
    }
    ```

Fixes COMMS-1916

Change-Id: I7bf4ee87eed0dc58c0e53c5d7567d0a1cc094a7c
Reviewed-on: https://gerrit.instructure.com/183642
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Aaron Hsu <ahsu@instructure.com>
Product-Review: Landon Gilbert-Bland <lbland@instructure.com>
Tested-by: Jenkins
2019-03-18 21:55:59 +00:00
James Williams 7b5cd50480 add not-null constraint to account notifications user_id
refs #CORE-2562

Change-Id: I4b01274abaf131d0fed550a735099d84588a7818
Reviewed-on: https://gerrit.instructure.com/184912
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-03-15 18:58:13 +00:00
Marc Phillips cf846152dd Update tool config to use oidc_initiation_url
Fix the confusing name of oidc_login_uri in the
tool configuration settings.

refs PLAT-4258

Test Plan:
 n/a

Change-Id: I7e5bf518c884cf6a324d671bdf67c5ba09110765
Reviewed-on: https://gerrit.instructure.com/184159
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-03-12 15:42:49 +00:00
James Williams b54a9b491d look for existing trust enrollments when adding an observer link
currently works for enrollments created after the link but
this will fix it so it looks across the trust for existing
enrollments when creating the link

also remove enrollments across trust when link is deleted

and require root account because why not

closes #CORE-2486

Change-Id: I861690eee819d14f9520084aa55cfa051a32aca1
Reviewed-on: https://gerrit.instructure.com/181448
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2019-03-04 13:19:24 +00:00
Mysti Sadler 1abdad37d6 Notification for failed link
closes ADMIN-2334

Test plan
- In a course with a student enrolled
- Set up an assignment, a quiz, a wiki page
  and a discussion topic
- In the body of the above, make sure to set
  up at least one notifiable bad link (a link
  to a course the student doesn't have access
  to, something that 404s like offline_web_exports
  if it's not turned on, something unpublished.
  deleted doesn't work, because it redirects
  right now)
- Set up an instructor with immediate, daily,
  weekly and no notifications for Content
  Link Errors
- As the student, visit the links
- Check /messages for the instructor(s) to ensure
  the notifications were received (or not) as
  expected and the notifications look right
  according to ADMIN-2334
- (If you need to send daily/weekly notifications
  you can do `DelayedMessage.where(workflow_state:
  'pending').update_all(send_at: 1.day.ago)` and
  then `SummaryMessageConsolidator.process` when
  jobs are running to kick them off

Change-Id: Ia324b1f5360dda91641f22ff1a6a2ba528aa4669
Reviewed-on: https://gerrit.instructure.com/179823
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Mysti Sadler <mysti@instructure.com>
Product-Review: Christi Wruck
2019-02-28 16:50:20 +00:00
Rob Orton 460f8ca929 add index to submission_versions
fixes CORE-2510

test plan
 - migrations should run

Change-Id: Ifb0061308ca207597de24f029c2d939335b0f696
Reviewed-on: https://gerrit.instructure.com/182991
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-02-27 03:41:16 +00:00