Commit Graph

375 Commits

Author SHA1 Message Date
Rob Orton a50a99fad6 fix sentry error
test plan
 - specs should pass

fixes VICE-1569
flag=none

Change-Id: Ibb8d7e656e80ce52a82f5445f0d611c39163a2ce
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266669
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-06-09 14:40:33 +00:00
Rob Orton db211a1ad0 don't 500 for invalid discussion topic
test plan
 - create a topic with a group set
 - try to subscribe as a student not in a group
 - specs should pass

fixes VICE-1503
flag=none

Change-Id: I6fcdf3431a7a14a35af4678d165a7c3d625acb6d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265649
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-05-26 15:09:07 +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
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 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
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
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
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
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
Ed Schiebel 43822e561a Remove "Reply" from announcements in homeroom courses
closes LS-1902
flag=canvas_for_elementary

this is an offshoot from LS-1883. Announcements shouldn't have responses,
even for the teacher.

test plan:
  - with the canvas_for_elementary flag on
  - create an announcement in a course and save
  - open the announcements
  > expect a Reply section below the text
  - in /courses/:id/settings, check "Enable homeroom" and update
  - view the announcement
  > expect nothing below the content
     no search bar
     no Reply button

Change-Id: I278324410ab7eaf916993b096e78ad48bc2eaac0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258957
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-02-19 17:24:30 +00:00
juanpablo.montoya 74d055de54 Discussion Topic Titles kept empty if not set in the UI
Discussion topic titles were kept empty when default values were set since the or equals operation works only if the value is nil, but it was an empty string.

Fixes LS-1688
flag=none

Test Plan:
- Create a course and add a module to the course
- Add a new module item and select discussion from the add dropdown
- Create a new discussion without setting a title/topic name
- The app should create a new discussion topic with "No Title" as its title

Change-Id: If9fd1863e8b3573ef449ca92fbc63c45219df2df
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255818
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: JuanPablo Montoya <juanpablo.montoya@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
2021-01-19 20:24:57 +00:00
Jeremy Stanley a652d7f283 fix blueprint sync for discussions locked in the past
test plan:
 - have a blueprint/associated course set up
 - create an ungraded discussion topic in the blueprint
   and set its "available until" date in the past
 - perform a sync
 - change the "available until" date in the blueprint to
   be in the future
 - perform another sync
 - the discussion in the associated course should
   be updated (no sync exception)

extra credit:
 - do the above, but with an available-until date in the
   near future. perform the sync before the discussion
   locks. wait until after it locks, and note that the
   locking has happened in the associated course. do not
   manually edit the discussion in the associated course.
   change the date in the blueprint to be in the future,
   perform a sync, and the discussion in the associated
   course should be unlocked again

bonus:
 - manually edit the discussion in the associated course
   and change the availability dates
 - also change the blueprint dates and perform a sync
 - the changes in the associated course should _not_ be
   overwritten (sync exception)
 - lock availability dates in the blueprint discussion
   and make another edit to it
 - perform a sync and the changes _should_ be overwritten

flag = none
fixes LS-1641

Change-Id: Id105f6d7e526c11f984fb786e66491b4862e3cfb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254794
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-12-15 14:01:48 +00:00
Cody Cutrer 548a2a1732 update all invocations of send_later and friends to new syntax
Change-Id: I7f40ed058b50882121da69f0cb05966854b8e920
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250924
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-30 19:13:54 +00:00
Cody Cutrer f299f76b75 add # frozen_string_literal: true for models
Change-Id: I70825be7ec7e24458afe0c63dc48c5a76158f520
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251150
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 22:08:12 +00:00
Cody Cutrer f2a9c756f1 update to inst-jobs 1.0 via shims
Change-Id: Id39b1e8d3bebcc0f9b7ded920b450f275565f708
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250923
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 13:46:49 +00:00
Cody Cutrer c5227d3f1b shackles was renamed to guardrail
closes FOO-989, FOO-990

Change-Id: I49dfa130cb74c34dd0eb25952790176ae4951058
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249365
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-06 19:23:08 +00:00
James Williams 85c73f1488 fix podcast feeds for media objects on user context
test plan:
* create a discussion with podcast feed enabled
 and student posts added to feed
* as a student, use rce enhancements to upload a media
 object (to the student's own context directly) and
 add it to a discussion entry post
* it should show up in the podcast feed

closes #LS-1411

Change-Id: I17c8944921a5170be2d47c30062c0361e896fb25
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247247
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2020-09-11 19:41:10 +00:00
Jeremy Stanley 7c2fcc3542 use squiggly heredocs for SQL
to avoid sending unnecessary whitespace to the database

test plan: specs

closes LS-1422

Change-Id: Iaaa73059b46964d4c51e920fd469b876256ec632
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246811
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-09-04 19:11:47 +00:00
James Williams f07ae35e84 bulk insert discussion_entry_participants with root account id
refs #LS-1366

Change-Id: Ie91314963dd018a480d31781233b5556cfc00a7b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246673
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-09-01 17:56:28 +00:00
Matthew Lemon 0091da3594 stop adding cc notifications on locked modules
Published discussions in locked modules would cause course card
notifications despite being unavailable to the student

fixes VICE-644
flag=none

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

- Have a published course with at least one student enrolled
- Create an unpublished discussion
- Create a published module with an unlock date in the future
- Add the discussion to the locked module
- Publish the discussion
- Act as a student on the Dashboard, note there is no course card
  notification for the discussion

Change-Id: I57ec318c350b28109e91ced2e1e5b4b6eafbea74
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244278
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-08-11 16:18:01 +00:00
James Williams 9a00067013 include new rce media comments in discussion podcast feed
test plan:
* with rce enhancements, create a discussion and enable podcast
* add a reply with media
* the podcast feed should include the media

closes #LS-1137

Change-Id: I06ac6b1550f09c0b63a3883c06d792d13e9887e3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243667
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-07-31 13:41:56 +00:00
Drake Harper 40c6d4513a Fix notification sending in unpublished module
Test Plan:
-specs pass
-create an unpublished module
-publish a discussion topic in the module
-notification should not appear on dashboard course card

-publish module
-add discussion topic
-dashboard card should have notification

Fixes KNO-489

flag=none

Change-Id: I6a24073a2c586a568cd91695a25997fb3edb1be7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239234
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-06-09 16:23:59 +00:00
Clint Furse 39af37e101 set root_account_id on discussion_topic create
closes LA-787
flag = none

Test Plan:
- verify that a discussion topic can still be created
- verify the new records contain the correct root_account_id

Change-Id: I42ea07aed880860af119c0ec475c3a35c955de6a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238573
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: Jeremy Stanley <jeremy@instructure.com>
2020-05-29 21:54:08 +00:00
James Williams 91f037966c check only_graders_can_rate permission against course
test plan:
* a group discussion with "only graders can like"
 enabled should let course teachers like entries

closes #LA-999

Change-Id: I797d76e7dbda0a0b7d020fa16026d0f1adf0e4e0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238033
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: Jeremy Stanley <jeremy@instructure.com>
2020-05-28 23:31:23 +00:00
Matthew Lemon 35c4386844 add stream item clearing to job if production
This was causing problems when there were too many stream item instances
that needed to be dealt with inside the transaction.

fixes LA-923
fixes LA-922
flag=none

Change-Id: Idccffb6206aaa3c8a28dd7b1be713018a5ee388e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234220
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-04-17 15:55:38 +00:00
Matthew Lemon 879effef95 fix logic error when clearing stream items
fixes KNO-404
flag=none

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

- Create and publish a course with at least 2 students in different
  groups or sections in the course
- As a teacher, create a new announcement or discussion and publish it
- As a student, view your dashboard and note that there is an unread
  indicator on the course card
- As a teacher, edit the announcement or discussion and change it to be
  for a section that the student is not in
- As the same student, view your dashboard again and note that the
  unread indicator no longer appears on the course card

Change-Id: Idc3d2d3071f8595a0e79e4b3fe1371a5b23be1f6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234218
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2020-04-15 23:11:33 +00:00
Matthew Lemon d538dfa787 fix unread badge bug for delayed posts
If an instructor would post an announcement and then change it to a
delayed announcement students would see an undismissable dashboard badge
for the hidden announcement

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

- Create a course and add a teacher and a student to it
- As the teacher create an announcement
- As the student navigate to your dashboard and note the unread badge
  for the announcement on the course card
- As the teacher edit the announcement and enabled "Delay Posting" and
  set it for a future date
- As the student refresh your dashboard and note that the unread badge
  is no longer displayed on the course card
- As the teacher edit the announcement again and update the future date
  to be something like a minute in the future
- As the student after the minute has elapsed refresh your dashboard and
  note the unread badge has returned
- Click the icon and note that you are taken to the now available
  announcement

fixes KNO-310
flag=none

Change-Id: I740702100ffce87bdd422880fb1d1b43cb3e2e83
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228761
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>
2020-03-04 15:35:37 +00:00
Rob Orton b0763ff3ec set course and account id in broadcast_policy
when calling set policy for items that are in a course we need the ids
populated so we can properly ignore messages when users have disabled
notifications for a specific course, or have changed the notification
preference for a course

test plan
 - send an announcement from a course that has notifications disabled
 - the user should not get the announcement

flag=mute_notifications_by_course
qa risk: medium, it touches every broadcast policy relating to
courses and there are many types, but there is a lot of test coverage on
each model

closes KNO-311

Change-Id: Icda6bd143c3b20b13e441f5d779da1a78a0275e1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228312
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Johnny Le <jle@instructure.com>
QA-Review: Johnny Le <jle@instructure.com>
Product-Review: Johnny Le <jle@instructure.com>
2020-02-29 00:22:55 +00:00
Matthew Lemon be5e0cc824 fix unread discussion topic badge bug
If a user accessed their dashboard after a new announcement or
discussion was created that was available to them, but they didn't view
it (thus making it unread), the course card notification would persist
if the discussion/announcement was changed to no longer be available to
their section or group.

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

- Create and publish a course with at least 2 students in different
  groups or sections in the course
- As a teacher, create a new announcement or discussion and publish it
- As a student, view your dashboard and note that there is an unread
  indicator on the course card
- As a teacher, edit the announcement or discussion and change it to be
  for a section that the student is not in
- As the same student, view your dashboard again and note that the
  unread indicator no longer appears on the course card

fixes KNO-235
flag=none

Change-Id: Idcea315c0abab7e7e493f53151d994f1e471d3d7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/227259
QA-Review: Johnny Le <jle@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Johnny Le <jle@instructure.com>
Product-Review: Johnny Le <jle@instructure.com>
2020-02-27 20:45:35 +00:00
James Williams 8cf7dade27 fall back to root topic for submission time calculation
apparently students can submit by posting to the root
 if they aren't in any of the groups

closes #LA-553

Change-Id: Ie2266feb5757324cc774044c0a3d2399982050ef
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/225149
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2020-02-11 13:22:16 +00:00
James Williams c3ff5cc5e1 unset topic group setting if possible after blueprint sync
test plan:
* have a blueprint course with a group discussion topic
* sync to an associated course
* unset the group setting in the blueprint topic
* re-sync
* should unset the group setting in the associated topic
 unless the topic was posted to by a student in a group

closes #LA-203

Change-Id: I7b96af0a4a5cfeda7064268d2d065fee3649dd05
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/216843
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-11-15 16:12:15 +00:00
Jeremy Stanley 57df5ad34f fix discussion_topic :create permission for unenrolled admins
test plan:
 - create a discussion topic that unlocks in the future
 - uncheck "let students create discussion topics" in course settings
 - as an admin who is not enrolled in the course, attempt to duplicate
   the discussion topic from the discussion topics index
 - it should work and not give you a 401

fixes LA-66

Change-Id: I227cedc570e5c3e89450d3c277a638ea9ab38ae9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/215894
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2019-11-08 21:25:16 +00:00
Landon Gilbert-Bland 6317bb670e Fix module cache on discussion section change
Test Plan:
  - Change `config.action_controller.perform_caching` from false to true
    in config/environments/development.rb
  - Create a course with two sections
  - Create a student in the course that belongs to one of the sections
  - Create a non-graded discussion in the course, that can be viewed by
    all sections
  - Create a module in the course, then add the discussion to that
    module
  - As the student, visit the module, and verify you can see the
    discussion
  - As a teacher, modify the discussion so that it is restricted to the
    section that the student is not in
  - Refresh the module page as the student, and notice that you no
    longer see the discussion
  - Change `config.action_controller.perform_caching` in step 1 back to
    false

fixes COMMS-2045

flag = none

Change-Id: I230444533c3f446cf996a632275f60f3bab301a8
Reviewed-on: https://gerrit.instructure.com/211575
Tested-by: Jenkins
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Reviewed-by: Ryan Norton <rnorton@instructure.com>
Product-Review: Landon Gilbert-Bland <lbland@instructure.com>
2019-10-01 22:06:02 +00:00
James Williams 79c1b5602d fix tag creation when removing assignment from discussion topic
breaks if there are old deleted subscriptions,
due to a uniqueness index
we should only create the tag for the subscription
the discussion is associated with

test plan:
* create two blueprint courses
* associate the first with a child course, then
 remove the association
* associate the second with the child course
* add a graded discussion to the blueprint
* sync to child course
* should be able to modify the child course
 copy to make it ungraded without an error

closes #COMMS-2125

Change-Id: I255740ff870b8b7f055be7be6b0e24bedae95f90
Reviewed-on: https://gerrit.instructure.com/197394
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-06-13 13:10:16 +00:00
James Williams 85a0aeb3a2 don't run multiple refresh_subtopics for same topic at once
closes #CORE-3029

Change-Id: Ic3e74aca8712b0b64ea3ceb967c8d31ab6169289
Reviewed-on: https://gerrit.instructure.com/196181
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-03 17:28:24 +00:00
James Williams 02a2726035 improve caching around assignment overrides and module info
add assignment.cache_key(:availability) to cache
around overrides/due date data

once that's more reliable we can get more safely discard the
highly unreliable (and time-dependant) locked_for caches

refs #CORE-2851

Change-Id: I4be5fd666ca65a377e4daa3f2da1b718e862de47
Reviewed-on: https://gerrit.instructure.com/192393
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-05-10 15:15:04 +00:00
James Williams 2cefbd0d8f unpublish/publish attachment for delayed announcements
test plan:
* have a delayed announcement set to post in the near future
* add an attachment
* it should not be visible by students
* it should be visible by students after the announcement
 is posted

closes #COMMS-1996

Change-Id: I82d3be21c7a694665e120b99a9388d50a9651c79
Reviewed-on: https://gerrit.instructure.com/189705
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Aaron Hsu <ahsu@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-04-19 19:11:20 +00:00
James Williams 50dc0c265f exclude deleted discussion visibilities in course-level scope
specificially visible_to_student_sections, which is used
for context module item sequences and the dashboard

test plan:
* add a student to a section
* create a topic that's assigned to the section
* edit the topic so the section is no longer assigned to the topic
* add the topic to a module
* as the student, should not receive an error trying to reach the
 inaccessible topic by clicking the "next" and "previous" buttons
 in the module sequence

closes #COMMS-1963

Change-Id: I0071fcf12135f73edad6db6c249c5a6df72be0bb
Reviewed-on: https://gerrit.instructure.com/186868
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-03-28 19:30:22 +00:00
James Williams 3c3824d830 calculate submitted_at from entries when changing to graded topic
test plan:
* have an ungraded discussion topic
* post to it as a student
* change it to a graded topic
* the submission should say it was turned in
 at the time the entry was made, not when the topic was
 changed to graded

closes #COMMS-1902

Change-Id: If29b65657f4795b1f5ae6d7936af2d486e2af102
Reviewed-on: https://gerrit.instructure.com/183247
Tested-by: Jenkins
Reviewed-by: Ryan Norton <rnorton@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2019-03-04 19:49:29 +00:00
Jeremy Stanley 3d14ca2c24 let associated course make discussion non-graded
test plan:
 - create a graded discussion in a blueprint course
   (not locked)
 - sync to an associated course
 - in the associated course, edit the discussion and make it
   non-graded
 - in the blueprint course, edit the discussion body and perform
   a new sync
 - the discussion in the associated course should remain ungraded

fixes ADMIN-2419

Change-Id: Id92285962e3082fe4a10910ad5aca36639f9ff52
Reviewed-on: https://gerrit.instructure.com/183176
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2019-02-28 16:34:39 +00:00
James Williams f1ae4a42d6 unassociate deleted discussion entry attachments immediately
the previous code to unassociate submission attachments for
deleted discussion entries was only being triggered after the user
would make another post

test plan:
* create a graded discussion
* post to the discussion as a student with an attached file
* delete the post
* the submission should not list the attachment in speedgrader
 immediately

closes #COMMS-1873

Change-Id: I57f9b24f16186f322d368b2eae333fd89a4c00ea
Reviewed-on: https://gerrit.instructure.com/181111
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Tested-by: Jenkins
QA-Review: Aaron Hsu <ahsu@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-02-08 22:04:35 +00:00
James Williams 61d771b12c recalculate module progression after topic section changes
test plan:
* create a discussion topic in a course with
 multiple sections
* add it to a module and require it
* add that module as a prerequisite to another one
* view the module as a student
* they should be locked out of the second module

* edit the topic so it's only assigned
 to a section the student is not in
* view the module again as a student
* the second module should be unlocked now

closes #COMMS-1808

Change-Id: I2df8a7e0a37e1bf486523c9a3cec00907bd345ff
Reviewed-on: https://gerrit.instructure.com/175355
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2018-12-17 16:54:47 +00:00
Clay Diffrient a094bbde42 Disable RCE files tab in courses with files disabled
closes CORE-1644

Test Plan:
  - Go to a course and disable the files section
  - As a student, go to a page with an RCS sidebar
  - You should not see a files tab

Change-Id: I3291cc90a363404a33e5b07077bcea3a031f9dcc
Reviewed-on: https://gerrit.instructure.com/159626
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2018-10-05 22:43:12 +00:00
James Williams 88185f308d limit discussions/announcements on todo list to user sections
test plan:
* have an announcement limited to a section
* have a student enrolled in a different section
* the announcement should not appear on the student's
 todo list and planner

closes #ADMIN-1212

Change-Id: I44e39f232bfd9147b60876d240f43e21ee3a3d68
Reviewed-on: https://gerrit.instructure.com/162721
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2018-09-05 22:56:01 +00:00
James Williams 6ee5809bc8 Add new permission for creating discussions
Test plan
- Create a course with at least one teacher and apply a closed term
- As the teacher, check that you do not have a create discussion
  button
- go to courses/{course_id}/discussion_topics/new
- Verify that if you try to create a discussion, it returns an appropriate
  error message
- Create a discussion in a group to make sure the restriction only
  applies to courses
- Create a course end date that is active and overrides the term date
- Check that discussions can be created in this context

and don't grant it to concluded teachers
(unlike post_to_forum)

Change-Id: I5f16d535652e52917e2b5f2038b0a78f015cc688
Reviewed-on: https://gerrit.instructure.com/159732
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2018-08-08 19:03:36 +00:00
Cody Cutrer d39c0b6fd2 moar preloads
found by API specs

refs CORE-1541

Change-Id: I6a4cf04a121a5cd41673561fc57f0f55e5001440
Reviewed-on: https://gerrit.instructure.com/159903
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-08-08 05:22:30 +00:00
KC Naegle ac06c769d9 Revert "Stop teachers from creating discussions after term ends"
This reverts commit 21d795b565.

Change-Id: Ib16abf69ce0eb4c9dc913a4c26c93a570195aa3e
Reviewed-on: https://gerrit.instructure.com/159844
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: KC Naegle <knaegle@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Tested-by: Jenkins
2018-08-06 22:35:35 +00:00
Cody Cutrer 9cd45df86e fix several N+1 found by Bullet
Change-Id: I086b6a2265014ff5327f1ab6f60430b155150df7
Reviewed-on: https://gerrit.instructure.com/158980
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-08-02 21:24:00 +00:00
Cody Cutrer dfd60138ae Rails 5.2: Arel.sql
Change-Id: I62b5054d46148679bbf650e2cac495df6c37d8d4
Reviewed-on: https://gerrit.instructure.com/158979
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-07-30 19:13:06 +00:00