Commit Graph

375 Commits

Author SHA1 Message Date
Dan Minkevitch 1f4132e1ba Planner API
Closes FALCOR-183
Closes FALCOR-184
Closes FALCOR-255
Closes FALCOR-186
Closes FALCOR-187
Closes FALCOR-188
Closes FALCOR-189
Closes FALCOR-147
Closes FALCOR-148

Test Plan:
* As a student in an account with the Student Planner
  feature flag enabled
* In a course with multiple upcoming due assignments
  in the current and following weeks
* Test that the following API endpoints provide you
  with the data described:

  get '/api/v1/planner/items'
    * Should return a list matching that of the todo
      list endpoint, while adding an additional key
      named `visible_in_planner`
  get '/api/v1/planner/overrides'
    * Should return a list of previously created
      PlannerOverrides
  get '/api/v1/planner/overrides/:override_id'
    * Should return the specific override for the
      passed in id
  put '/api/v1/planner/overrides/:override_id'
    * Should update an existing override's `visible`
      value to match what was passed in the request. No
      other values should be updated
  post '/api/v1/planner/overrides'
    * Should create a new PlannerOverride with the specified
      `plannable_type`, `plannable_id`, and `visible` values.
      `user_id` should match that of the user making the request
  delete '/api/v1/planner/overrides/:override_id'
    * Should set the PlannerOverride's `deleted_at` to when
      the request was made, as well as updating the `workflow_state`
      to `deleted`

Change-Id: I03890a525f8201a8df1d2f1290cdcd549ba548d7
Reviewed-on: https://gerrit.instructure.com/107495
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-05-15 19:18:47 +00:00
Jeremy Stanley ef85123d31 allow observers to see replies after a linked student posts
test plan:
 - have some discussion topics that require students to post before
   reading other replies
 - have an observer linked to multiple students
 - ensure that the observer can view replies on a discussion topic
   after a linked student posts.  test a different student with
   each topic.  (this feature used to work for at most 1 linked
   student.)

fixes CNVS-36504

Change-Id: If8ac47038d64ef1d8c9ebfe4d71a60d6990383d2
Reviewed-on: https://gerrit.instructure.com/110743
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-05-05 17:54:46 +00:00
Landon Wilkins 91a87b3834 da licença part 10
add consistent license headers to all source files

Change-Id: I4c479c0c4b9d6d9d1d567f3bcb35ea376794bc14
Reviewed-on: https://gerrit.instructure.com/110030
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-28 17:30:08 +00:00
James Williams e40f3f1ba9 allow course admins to see concluded group discussion posts
test plan:
* create a group discussion with "Users must post before
 seeing replies" enabled and add a reply to a subtopic
* conclude the course
* teachers should still be able to see the reply

closes #CNVS-36199

Change-Id: I7e21441d0789446fe4a798b9e560903045534231
Reviewed-on: https://gerrit.instructure.com/109335
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-04-24 18:55:55 +00:00
Spencer Olson b219df063b set boolean values to false before saving if nil
closes CNVS-35932
closes CNVS-35931

test plan:

1. Create an announcement.
2. Go to the announcements index page at
   /courses/:course_id/announcements.
3. Click the settings cog and select 'Close for Comments'.
4. Verify there is no error.
5. Refresh the page and verify the announcement has been closed for
   comments (there should be a lock icon to the left of the settings
   cog).

Change-Id: Ide9559622460e59dc089291345b4c1da8f0e12d2
Reviewed-on: https://gerrit.instructure.com/106609
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2017-03-28 19:51:46 +00:00
Cody Cutrer ce21af8ecf rails 5: find and fix lots of deprecation warnings [ci verbose]
refs CNVS-34843

Change-Id: Idd523c2a7c37325381d590f1ee70c406ace2a459
Reviewed-on: https://gerrit.instructure.com/105033
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-16 16:03:51 +00:00
James Williams 4aea55f36e don't sent group announcement notifications to rejected admins
also include date based logic for funsies

test plan:
* invite a teacher to a course
* decline the enrollment
* have a group in the course and create an announcement
* it shouldn't sent to the rejected teacher

closes #CNVS-35561

Change-Id: I597ca8c641a3cbb38b292818add9a1991572d617
Reviewed-on: https://gerrit.instructure.com/104889
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-03-14 19:00:01 +00:00
Cody Cutrer 6751891617 rails 5: fix lots of deprecation warnings
mostly s/uniq/distinct/, and choosing a content type for render :text

Change-Id: I53a2e77d23ecc43162f70b4fd88303cc1539c20b
Reviewed-on: https://gerrit.instructure.com/104762
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-13 19:07:11 +00:00
Cody Cutrer ae0c85da6e rails 5: api specs s-u
Change-Id: I440c4b0fdc7a6a850b9c264835ea1a85f65c4363
Reviewed-on: https://gerrit.instructure.com/104401
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-08 06:00:13 +00:00
Jeremy Stanley fe535f92c0 allow more fine-grained locking for blueprint assignments
extract :points, :due_dates, and :availability_dates
from :settings

also allow {:all => true} shorthand in restrictions

test plan: specs (fine-grained locking is not supported in the
user-interface yet)

closes MC-99

Change-Id: I885192e6828b6628e73fcf4a532dda19143dd20a
Reviewed-on: https://gerrit.instructure.com/104163
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2017-03-07 21:48:36 +00:00
Spencer Olson fb9049324e set default values for booleans on various tables
This commit adds default values of false and not null constraints for
all boolean columns on the assignments, discussion_topics, and quizzes
tables. This commit also has a data fixup to backfill default values on
the boolean columns.

closes CNVS-34536

Test Plan:
* Do the following in a course with at least one closed grading period:
1. On the Assignments page, create an assignment with a due date in a
   closed grading period using the "+" button on an assignment group.
2. As a teacher, try to toggle the "Post to SIS" setting for the
   assignment from the Assignments page. Verify the setting changes.
3. Create a new assignment with a due date in a closed grading period
   using the "+Assignment" button.
4. As a teacher, try to toggle the post to SIS setting for the
   assignment from the Assignments page. Verify you can edit the
   setting as you toggle the button.

Change-Id: I7c799bb3b194363836d900287be90ca13805508e
Reviewed-on: https://gerrit.instructure.com/101315
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-22 18:17:59 +00:00
Jeremy Stanley d9adefa45c fix discussion permissions for student-view student
test plan:
 - ensure in a course with "allow students to create discussion
   topics" unchecked, the student-view student does not have
   permission to create discussion topics

fixes CNVS-34855

Change-Id: I94f26290f0e9673cb372f6819daa7e6c94e39709
Reviewed-on: https://gerrit.instructure.com/101734
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-02-14 16:19:39 +00:00
James Williams 4051ef99fe re-evaluate discussion entries when adding module requirement
test plan:
* have a discussion topic
* post to the discussion as a student
* add the topic as a module item and require
 students to contribute to it
* it should count the previous entry as a contribution

closes #CNVS-22214

Change-Id: Ie755f248285d685611b2d042605ece2ef128c24c
Reviewed-on: https://gerrit.instructure.com/100735
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-02-07 13:43:33 +00:00
James Williams 9f0ca801c4 don't copy "posted_at" dates for discussions on course copy
test plan:
* have a discussion topic
* copy it
* the new discussion topic shouldn't have the old topic's
 "posted at" date

closes #CNVS-34464

Change-Id: Ia886cc9f1522fbaf46b519c3da390568974a5442
Reviewed-on: https://gerrit.instructure.com/100795
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2017-02-07 13:14:12 +00:00
James Williams 8a7c786607 use generated course method for discussion comment locking
inherited settings rely on the generated method to
calculate whether the setting has been locked on the
account level

i should know, i wrote the code

test plan:
* have a course, make sure "disable comments on announcements"
is unchecked (in "more options")
* have a discussion topic in the course
* go to the account and check "disable comments on announcements"
 and "lock this setting"
* go to the discussion topic's index
* it should not show the "Open for Comments" cog menu option

closes #CNVS-34433

Change-Id: I2aabd7de749cc8b9fce941753578ab3e2f4725b6
Reviewed-on: https://gerrit.instructure.com/100954
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-02-06 20:13:30 +00:00
James Williams 15f61ce2dc use user-specific enrollment dates for discussion participation
test plan:
* create a course with a discussion
* soft-conclude the course (i.e. set the end date
 in the past and restrict enrollments to the dates)
* create a new course section and edit it so
 it ends on a future date and restrict enrollments
 to the dates
* ensure that a student in this section
is still able to reply to discussions

closes #CNVS-34351

Change-Id: I31927a4e7a78758e18101e639a0d44638e6bea9f
Reviewed-on: https://gerrit.instructure.com/100648
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-01-27 19:58:56 +00:00
James Williams 8e01d17e03 master courses: link graded discussions/quizzes with assignments
should use the same migration_id + master/child content tags
so they'll be restricted/unlinked together

closes #MC-63

Change-Id: I815c76d79b7407ecbcb2bff88dea9c90188800eb
Reviewed-on: https://gerrit.instructure.com/99887
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-01-19 17:25:46 +00:00
James Williams 89370c5f11 remove protected_attributes
refs #CNVS-32574

Change-Id: I3ba018a7110a7530c9af4a59c97422f626a749b6
Reviewed-on: https://gerrit.instructure.com/99260
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-12 17:46:18 +00:00
Dan Minkevitch 78f5641ee3 Refactor comment locking algorithm to properly reflect course setting
Fixes CNVS-34215

Test Plan:
* Create an announcement
* As a student, see that the announcement is available to comments
* As an admin, enable the account setting to disable comments on announcements
* As a student, see that announcements have a locked icon and cannot have replies
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option doesn't appear in the menu
* View (not edit) one specific announcement and click the settings icon
* See that an "Open for Comments" option doesn't appear in the menu
* As an admin, disable the account setting to disable comments on announcements
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option appears in the menu and unlocks the announcement when clicked
* View (not edit) one specific announcement and click the settings icon
* See that an "Open for Comments" option appears in the menu

Change-Id: I99482c05a5d710095287108925cca969c76ec160
Reviewed-on: https://gerrit.instructure.com/99150
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2017-01-10 20:14:39 +00:00
James Williams 04f0d46b08 strong params part D
refs #CNVS-32574

Change-Id: Iaac099efac4162bd060e2b8d5a9e6bc5170ce02d
Reviewed-on: https://gerrit.instructure.com/94593
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-01-10 19:30:34 +00:00
Dan Minkevitch 21b00a76a7 Refactor policy check for discussion topics & course conclusion
Fixes CNVS-34218

Test Plan:
* Create a course; do NOT publish it
* Create a new Discussion in the course and save
* As a teacher, see that you have a Reply button for the Discussion
* See that you are able to add replies to the Discussion
* Enter Student View mode from the course Settings page
* Navigate to the Discussion
* The reply button should be visible and interactive
* Exit Student View mode
* Publish the course
* Enter Student View mode again and navigate to the Discussion
* The reply button should still be visible and interactive

Change-Id: I001088747776d2534c090b1d26b7593115af8fad
Reviewed-on: https://gerrit.instructure.com/99086
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-01-10 02:52:18 +00:00
Jeremy Stanley 8c6b01a8c3 restrict discussion topics
closes MC-27

Change-Id: I06b81999b1f3113f8ece9fb9b34a4a0ea705d746
Reviewed-on: https://gerrit.instructure.com/98556
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2017-01-06 15:19:44 +00:00
Dan Minkevitch 4322f02c60 Order recent announcements widget by `posted_at`
Additionally, remove default time limit from recent
announcements posting so that all announcements are shown.

Fixes CNVS-34030

Test Plan:
* As a teacher, go to a Course's settings page
* Enable "Show recent announcments on homepage"
* Make sure you have the course homepage set to
  the wiki front page
* Create multiple announcements
* Post them in a different order than you created them,
  e.g. by using the `Delay Posting` setting
* Make sure that the announcements `posted_at` ranges
  from longer than two weeks ago to further out than
  two weeks from now
* View the homepage
* The recent announcement list should be ordered
  by the date/time that you posted the announcement
  and not in the order that they were created,
  in order from most recent to least
* It should display all the relevant announcements,
  even if they were posted longer that two weeks ago
  or further out than two weeks from now
* Students should not see announcements that have
  not yet been posted or that they don't otherwise
  have access to

Change-Id: Ie575f8561614529b7fd6245a24ffe9fdad5d8111
Reviewed-on: https://gerrit.instructure.com/98610
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2017-01-03 19:37:43 +00:00
Dan Minkevitch 507ea63cab Hide "Open to Comments" button on locked announcements
Fixes CNVS-33938

Test Plan:
* Create an announcement
* As a student, see that the announcement is available to comments
* As an admin, enable the account setting to disable comments on announcements
* As a student, see that announcements have a locked icon and cannot have replies
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option doesn't appear in the menu
* As an admin, disable the account setting to disable comments on announcements
* As an instructor, view the announcements page and click the settings icon for an announcement
* See that an "Open to Comments" option appears in the menu and unlocks the announcement when clicked

Change-Id: Ibc837d2f1d76ec85790a9f00e74b21e18971c738
Reviewed-on: https://gerrit.instructure.com/98418
Tested-by: Jenkins
Reviewed-by: Frederick Polgardy <fpolgardy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2016-12-29 23:16:55 +00:00
Steven Burnett 0d45dad391 fix students participation in group discussions
fixes CNVS-32308

Test Plan:
- Have a course with Student enrollments, Group Set and Student Groups
- Create a Group Discussion and attach Group Set from step #1
- Hard or soft concluded a course
- As a student, navigate to the Group Discussion and notice
  you can't leave a reply

Change-Id: Ic45cd71a21d6b667c407fd0250b2df2bfb3e1f98
Reviewed-on: https://gerrit.instructure.com/95970
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2016-11-28 18:23:18 +00:00
James Williams 58896ac928 improve performance for discussion/announcement publishing
particularly for large roster courses

don't make permissions checks for each user

test plan:
* publishing a discussion topic should work like before

closes #CNVS-32618

Change-Id: I7efbcfff5fecd78f0bf7d7fb848e95a5145682eb
Reviewed-on: https://gerrit.instructure.com/93240
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
2016-11-15 19:34:41 +00:00
Mark Valentine 8590845a7c add instructor / ta to group announcement
test plan:

1.  Create course with a teacher, three students (a,b,c),
a ta, a designer, a role inherited from teacher, and
a role inherited from ta.

2.  Create a group in the course that includes students
a and b.

3.  As student a, post an announcement in the group.

4.  Verify that the following receive the announcement:
  b, ta, teacher, role inherited from teacher, and
  role inherited from ta all receive the announcement.

5.  Verify that the following do not receive the
announcement:  c, and designer.

Additionally, verify that when a teacher has selected
to never receive announcement notifications that they
do not receive them from group announcements.

Change-Id: Idf23cb942f79002d778aaa6ae51526e3b18c1731
Fixes: PFS-5748
Reviewed-on: https://gerrit.instructure.com/94187
Reviewed-by: Tyson Brown <tbrown@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
Tested-by: Jenkins
2016-11-11 17:58:41 +00:00
James Williams 8e1da3cf67 fix discussion submission attachments when switching group sets
child_topic_for was grabbing the old deleted child topics

test plan:
* create a course with two groups sets with one group each
* enroll a student in both groups
* have a graded discussion topic set for one group set
* then switch the topic to the other group set
* post to the discussion topic as a student with an attachment
* the attachment should show up properly in the speedgrader
 sidebar

closes #CNVS-32912

Change-Id: Iac4a44751413be1a33d3d1abdb730655daa71712
Reviewed-on: https://gerrit.instructure.com/93945
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: David Tan <dtan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-11-09 16:12:23 +00:00
Jon Willesen c51b101e98 don't show module locked discussion on index page
fixes CNVS-31042

test plan:
- create and publish some discussion topics
- lock some of the discussion topics via a module various ways
- students should not see the topics that are locked for them on the
  discussions index page
- teachers should still see all the topic in the discussions index page

Change-Id: Ie6cc27c2539e5a915ce9243318f5505a04fb1e82
Reviewed-on: https://gerrit.instructure.com/91922
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: David Tan <dtan@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
2016-10-24 14:56:18 +00:00
James Williams 1751d9599a use enrollment states for participating_X_by_date
test plan:
* should not send scheduler notificiations to students
 with future enrollments (by date)

refs #CNVS-30884 #CNVS-31292

Change-Id: I1e543daab097f0bbbaad2d2d1e9de5afdaf2e46b
Reviewed-on: https://gerrit.instructure.com/88737
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-09-20 17:03:10 +00:00
Christian Prescott 4a7227c050 Fix modules ignoring page assignment override behavior
Filters pages from set of assignments rendered in modal
Filters pages from displayed content tags according to differentiated
assignments behavior

refs CYOE-263

Test Plan:
1. Create a wiki page, via pages index or modules + button
2. Ensure page can be added to module and is visible to students
3. Check edit page, "mastery paths content"
4. Ensure the page is no longer visible to students in modules, until
   they are assigned it via an override.
5. Open the "add item to module" modal. Ensure the page does not appear
   in the assignments section, only under pages.

Change-Id: I822d53dc562476ef422f4a3ee6004e0d1e132246
Reviewed-on: https://gerrit.instructure.com/87418
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-08-17 16:26:45 +00:00
James Williams e8e6b335e8 show unread indicator for graded discussion topic stream items
test plan:
* create a course with a student
* create and publish a graded discussion topic
* the topic should show in the student's "Recent Activity" stream
 with an unread indicator (blue dot)

closes #CNVS-30538

Change-Id: Id295c3f67ead51938f9b7a48bfb0db1c4e67b920
Reviewed-on: https://gerrit.instructure.com/87647
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-17 12:52:03 +00:00
Jeremy Stanley 93dee27904 fix discussion topic permissions for unauthenticated users
test plan:
 - in a public course, unauthenticated users should have the
   same restricted access as logged-in users who aren't enrolled
   in the course, namely:
   - the discussion topic index should not be accessible
     (/courses/X/discussion_topics redirects to a login page)
   - graded discussion topic descriptions are visible on the
     assignments page, but posts are not shown

fixes CNVS-30262

Change-Id: I8a4351c6bab5ca06a3c0c89a51b38e3d8bed3d24
Reviewed-on: https://gerrit.instructure.com/84164
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-07-11 18:42:51 +00:00
Joel Hough 1432f586f2 hide discussion messages when non-viewably locked
fixes CNVS-28942

also fixes DiscussionTopic#visible_for? caching and cleans up
the :read permission

test plan
- regression test announcement and discussion topic visibility
- create a discussion topic in a module
- lock the topic via the module
- attempt to view the discussion topic as a student
- ensure that the discussion topic is not visible

Change-Id: I08b229e5a38803fced57afa25780b11a1dc2773e
Reviewed-on: https://gerrit.instructure.com/78152
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2016-05-20 21:31:42 +00:00
Christian Prescott eaa52716da Add WikiPage assignment type
refs CYOE-67

Test Plan
0. `rake db:migrate` and compile assets. Enable the conditional release
   feature flag in course settings.
1. Create a published WikiPage, assignment-free. Ensure it is visible
   to errybody.
2. With the API, create an assignment with submission type 'wiki_page'.
   A new page will be created for the assignment.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment": {"name": "Page Asg", "published":true, \
"submission_types":["wiki_page"]}}'
```
3. Ensure the assignment is assigned to "Everyone" and the page is
   visible to all.
4. Assign the assignment to a specific student or section. Ensure the
   page is visible only to the assigned set.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X PUT -d '{"assignment": {"only_visible_to_overrides": true }}'
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13/overrides" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment_override": {"student_ids":[126]}}'
```
5. Ensure the DA behavior also applies to WikiPage#show and update and edit.
6. Ensure API behavior matches docs for Assignment and Page endpoints.
7. Ensure no regressions in non-page assignments, with and without CR
   feature flag. Ensure no regressions in discussion topics and
   announcements, including assigned discussions.

Change-Id: Ie53c6ffa4e4533cedd54f10aee3ba0b8a27aa4d5
Reviewed-on: https://gerrit.instructure.com/75139
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-04-21 17:25:15 +00:00
James Williams 882a71c0ef fixes for :read_forum and :read_announcements permissions
test plan:
* create a course role with the ability to
manage course content, but "View announcements" is disabled
* a user with that role should not see the Announcements tab

* having "Moderate forum" rights should not grant read
rights to read discussions and announcements (if those are
disabled)

* having "View announcements" or "View discussions" turned
 off should prevent new announcements and new discussions
 from showing in the dashboard or from sending
 notifications to the restricted users

closes #CNVS-28438 #CNVS-28469 #CNVS-28541

Change-Id: I9178d30edb33a6e83c492189f4a6fd1e496c42fa
Reviewed-on: https://gerrit.instructure.com/76294
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2016-04-12 15:08:13 +00:00
James Williams df6b6232cd fix discussion topic refreshing for groups/topics with long names
test plan:
* create a group category with a group with a long name
 (~200 characters)
* create a discussion topic with a short and set it
 as a group discussion for the category
* the group discussion should have been created

* edit the discussion topic to have a long name (>100 characters)
* the group discussion should have been updated to reflect
 the new topic's name (and truncated)

closes #CNVS-28244

Change-Id: Id996f975b7137cca9284c4b3a3022f2a1243cbff
Reviewed-on: https://gerrit.instructure.com/75252
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-24 19:25:46 +00:00
James Williams 698286ed96 fix DiscussionTopic#ensure_submission
test plan:
* create a group ungraded discussion topic
* post to it as a admin user not in a group
* change it to be a graded discussion
* it should save successfully

closes #CNVS-27993

Change-Id: I5ddc34f4053df0ffb6c819a121873c102e74b5c0
Reviewed-on: https://gerrit.instructure.com/74429
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-16 15:08:53 +00:00
James Williams 41aabf6dae fix restoring discussion topics with posts
test plan:
* create a discussion topic for a course
* reply to the topic as a student
* delete the topic
* should be able to restore the discussion topic
 (to an active state) using the "undelete" endpoint

e.g. /courses/:id/undelete/discussion_topic_(:topic_id)

closes #CNVS-27924

Change-Id: I146930c6e8cc55c93698cd4df72471247e895642
Reviewed-on: https://gerrit.instructure.com/74325
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-14 17:06:40 +00:00
James Williams 716b284b13 don't change child discussion topic names in controller
test plan:
* create a course with a group set and group
* create a group discussion topic for the set
* visit the discussion topic from the course
 topics index
* click on the link in the alert box to go
 to the group discussion topic
* the group topic should have a name including the
 group name

closes #CNVS-13287

Change-Id: Icdba11c9545e7b029fdacb95d2d9ffdd1b3f1283
Reviewed-on: https://gerrit.instructure.com/73973
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-09 20:43:56 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
Cody Cutrer fb64908614 expand "native" polymorphic associations to most polymorphics
Change-Id: I0b2ada85ae6d7b32d2940f5c7db6596b27c3bf84
Reviewed-on: https://gerrit.instructure.com/72282
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-22 19:14:31 +00:00
Michael Nomitch 7dc3c90aaf DA - support student groups
fixes CNVS-22360

Test Plan:
  - create a course with multiple course
    sections, multiple group sets (each with
    many groups), and students in these
  - create an assignment with overrides
    for groups
    - they work as expected
    - adhoc and section overrides continue
      to work as expected
  - ditto for graded discussions
    - check that discussion
      alerts go out properly
    - check that individually graded
      group discussions work as intended
      as well
    - note: child discussions will still
      be made for groups that dont have
      overrides (this is unfortunate
      but known)
  - note: quizzes not included
    in this PS

  - when editing an assignment try to
    assign a due date to a group not
    in the assigned group set
    - you cannot
  - when editing an assignment that
    is not a group assignment
    - confirm that you cannot
      assign a group override

  - if an assignment override for a group
    exists (and nobody else is assigned)
    - check that a student not in that group
      - does not have a spot in the GB
      - gets redirected away from that assignment
        if they go to the show page
      - does not have that assignment factored
        into their individual grade
      - does not have that assignment show
        up on their assignment index
    - if the student is then added to that group
      - all of the above conditions are reversed
    NOTE: if a student has a grade already, they
    will not 'lose visibility' until their grade is
    taken away (so removing a student from a group
    will reverse the above conditions only if they
    are gradeless)

  - check that the calendar accurately
    reflects the due dates for group
    overrides

  - with MGP on
    - test that group overrides act in the
      same way as course_section overrides
      in regards to grading period

Change-Id: Ia32f57feabbc719568901e0763130b3c2304c7ce
Reviewed-on: https://gerrit.instructure.com/69060
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-02-10 19:20:52 +00:00
James Williams 6274d438c8 don't count student attachments in graded discussions for quota
test plan:
* create and publish a course with a graded discussion topic
* enroll a student in the course
* as the student, post a reply to the topic and attach a file
* it should not count toward the quota

closes #CNVS-27114

Change-Id: I6fb847a61a7a10a69dc035d5f5e1f15dda107a04
Reviewed-on: https://gerrit.instructure.com/71691
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2016-02-10 15:39:52 +00:00
James Williams b1f3daf044 rails 4.2: misc spec fixes
refs #CNVS-26056

Change-Id: Ia94ee2fcfded1ec66cb77a19085b005c81304800
Reviewed-on: https://gerrit.instructure.com/70251
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-18 21:45:39 +00:00
Michael Nomitch 757d9202d8 remove unused constants from canvas models
fixes CNVS-26220

test plan:
  - none

Change-Id: I40e675550e25a8c88795a4ddcd0d05e8470ada69
Reviewed-on: https://gerrit.instructure.com/69752
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Mike Nomitch <mnomitch@instructure.com>
2016-01-12 17:39:22 +00:00
James Williams 3e1481aa6e rails 4.2: s/destroy!/destroy_permanently!
destroy! is now a method in rails

refs #CNVS-26056

Change-Id: I66e512265ff5cda6a12d7820e3cf69c77ef9e746
Reviewed-on: https://gerrit.instructure.com/69721
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-07 14:00:13 +00:00
Joel Hough bffab4b61b link to specific discussion entries in notification links
fixes CNVS-22766

test plan
- cause a discussion reply notification to be sent (by replying to
 a discussion)
- follow the link in the notification
- ensure that the specific reply is scrolled into view
- do the same for announcements

Change-Id: I6a6f9fee7c9acd1e637486d607f71471f4664d6b
Reviewed-on: https://gerrit.instructure.com/69166
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2016-01-06 20:21:48 +00:00
James Williams d2833299d7 remove rails 3 support
also add initial rails 4.2 scaffold

refs #CNVS-25988

Change-Id: Ifd7aecaffb6cfc8a3e41bc3fb011fb6ce0664ea6
Reviewed-on: https://gerrit.instructure.com/69129
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-23 21:36:43 +00:00
Matthew Wheeler 55aa02922e Do not lock row to read unread_count
Fixes CNVS-25632

Test Plan:
Regression test discussions, especially unread
counts. We expect no behavior change.

Change-Id: I282a92491d3f15ecaacd3375e00e23acfda5eb7b
Reviewed-on: https://gerrit.instructure.com/69076
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
2015-12-22 17:27:09 +00:00
Cody Cutrer 71e5504568 re-work discussion entries query for major optimization
fixes CNVS-25948

Change-Id: I456a823f78778fff2b0e7e3f7625a8f869e73f6a
Reviewed-on: https://gerrit.instructure.com/69039
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-12-18 15:27:37 +00:00
Joel Hough 084e6e6540 don't dispatch discussion notification before creating linked assignment
fixes CNVS-25321

test plan
- create a graded discussion that is invisible due to
 differentiated assignments (see ticket for repro steps)
- ensure that students who cannot see the discussion do not
 receive a notification about the new discussion

Change-Id: I309b221b3641910809f9f073c8820e8331664f6f
Reviewed-on: https://gerrit.instructure.com/68526
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-12-14 21:51:21 +00:00
James Williams 10e8318cbc allow visible but locked course content to count for must_view
test plan:
* create an assignment, a quiz and a graded discussion topic,
 all with "available to" set to a date in the past
* add each one as a module item with a "Must view" requirement
* as a student, should be able to view each item
 (but unable to participate, since it's locked), and fulfill
 the requirements

closes #CNVS-25428

Change-Id: I00c222556bdb56f5ae4f95bbf547d06f1fb3ae0c
Reviewed-on: https://gerrit.instructure.com/68106
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
2015-12-08 13:11:18 +00:00
Cody Cutrer 7ea94c5ba8 rails 4 style associations
Change-Id: I0f80aa18ecfb73823368b7abb536d61cc0975c38
Reviewed-on: https://gerrit.instructure.com/67543
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-12-01 20:01:34 +00:00
Joel Hough 768eea62bc mark locked but visible discussion topics as read when viewed
fixes CNVS-22157
fixes CNVS-20681
refs CNVS-11976

test plan
- follow repro steps on the tickets

Change-Id: I4a4ed6666d094a0ce23324364f83d1ec9f7a4577
Reviewed-on: https://gerrit.instructure.com/67545
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-12-01 16:03:41 +00:00
James Williams 9b2a3e1619 restore announcements to active state
turns out they can't be unpublished

test plan:
* create an announcement and delete it
* use the course undelete page
 (/courses/X/undelete) to restore the announcement

closes #CNVS-25334

Change-Id: I6508e9b1b126c3384d0dde8c9cb94db262b9d435
Reviewed-on: https://gerrit.instructure.com/67905
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-11-30 17:47:34 +00:00
James Williams 7203873a6c remove child topics in groups when group category is removed
test plan:
* create a course with a group set and group
* create a group discussion topic
* it should create a subtopic in the group
* edit the original topic and unset
 "This is a group discussion"
* the topic should no longer show up in the list
 of group topics

closes #CNVS-1777

Change-Id: I1ceac3435c0c74edeea947baf8a0153dcb3a199c
Reviewed-on: https://gerrit.instructure.com/67328
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-11-19 13:13:06 +00:00
Chris Wang ea9e89c5ac Add cross-sharding support for discussion topics index endpoint
- Refactors related scopes for Switchman support.
- Adds an explicit shard context around the ScopedToUser call.
- Works around Rails loading with ActiveRecord descendants:
  https://github.com/rails/rails/issues/3364

fixes CNVS-24104

test plan:
- Enroll a student in two different institutions on different shards
- Merge the student if necessary
- Enroll the student in course 1 on institution 1
- Add a discussion topic for course 1 from the student.
- Access the API discussion endpoint from institution 2
- Verify that you get results.

The cross-sharded API endpoint should look something like:

institution_2.instructure.com/api/v1/courses/{global_course_id}/discussion_topics

eg

institution_2.instructure.com/api/v1/courses/10000000000001/discussion_topics

The non-sharded API endpoint should look something like:

instiution_1.instructure.com/api/v1/courses/1/discussion_topics

Both should work.

Change-Id: I54da2f5e012924c10923a8894ad8263a67fcdb06
Reviewed-on: https://gerrit.instructure.com/66599
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Chris Wang <cwang@instructure.com>
2015-11-16 18:39:02 +00:00
James Williams c01008b0ca reset discussion topics to post_delayed state
test plan:
* create an announcement set to post 1 minute in the future
* wait 2 minutes and make sure that it posts
* copy the course and shift dates to a future date
* make sure that the announcement has not posted to students yet

refs #CNVS-21078

Change-Id: I8253e6965ba777f90651d99c5f5fac8c26ff2f8f
Reviewed-on: https://gerrit.instructure.com/66677
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-11-12 17:56:40 +00:00
James Williams 3d642bb9f4 restore discussion topics to unpublished state
test plan:
* create a graded discussion topic
* delete it
* restore it through /courses/X/undelete
* it should be unpublished

closes #CNVS-24065

Change-Id: Ic00450074160b72a4ecabedd939f651dbaa1d4e5
Reviewed-on: https://gerrit.instructure.com/65275
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-22 12:33:08 +00:00
James Williams 97221956a8 don't send group discussion notifications in unpublished courses
test plan:
* create an unpublished course with a group
* add a user to a group
* create a discussion topic in the group
* it should not notify the group user

closes #CNVS-24074

Change-Id: Ic22900035dac06b103fee6819164de916bcc7e8f
Reviewed-on: https://gerrit.instructure.com/65272
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-19 18:29:30 +00:00
Davis McClellan eeb024eb28 Fixed reply option permissions
fixes CNVS-22078

test plan:
- Make sure "Let students edit or delete their own discussion posts"
  is enabled
- As a student reply to a discussion
- Conclude the students enrollment
- As the same student go to your reply and clicking the gear you
  still have the ability to edit it
- Along the same vein test threaded discussions and side comments

Change-Id: I8e1fc84b097cb96b2fa28654eb299d3276c045d7
Reviewed-on: https://gerrit.instructure.com/62389
Reviewed-by: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2015-09-22 23:20:39 +00:00
Cody Cutrer 2e5d300041 some optimizations for DiscussionTopics#index
avoid an unnecssary join, and an unnecessary round-trip through ruby

test plan:
  * load discussions page for a course

Change-Id: I22f7cecb9a83e2112bddb9ed0f1e4fa0e17f83b1
Reviewed-on: https://gerrit.instructure.com/63419
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-09-17 16:15:56 +00:00
Cody Cutrer 9bf7304917 use preload instead of include on associations
refs CNVS-21901

also got rid of some useless associations

Change-Id: I13e012e0ec755443fbed12ca0629c53a9c693f43
Reviewed-on: https://gerrit.instructure.com/62217
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-09-08 20:32:41 +00:00
James Williams a60bd5ffe4 add more caching + performance improvements
refs #CNVS-21317

Change-Id: Id9bbb04a92abd835af69ba5ec0c21ef758a8a324
Reviewed-on: https://gerrit.instructure.com/61146
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2015-08-18 16:01:33 +00:00
Steven Burnett 3aeb8bac97 fixed permissions with deleted discussion
fixes CNVS-21495

test plan:
- Participate in a discussion as student 1
- Reply to student 1 as student 2
- Delete the discussion
- Reply to discussion notification email as student 1
- notice no recieving of new notification as student 2
- Optional: repeat ad infinitum

Change-Id: I4e0405af5d56a827834ac96aa3a9ccb7b2f97d73
Reviewed-on: https://gerrit.instructure.com/59782
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2015-08-10 20:37:49 +00:00
James Williams 600165e7b2 rails4: deprecate Relation#all in favor of Relation#to_a
refs #CNVS-21596

Change-Id: I5dedaab90a2abe6bf288ff30401c9b31629b45b2
Reviewed-on: https://gerrit.instructure.com/59220
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-24 21:28:14 +00:00
James Williams 85dac3b3fb preload "can_unpublish" values for modules
should improve performance when viewing as a course admin

test plan:
* modules index should work as before

refs #CNVS-21476 #CNVS-21317

Change-Id: I00ee7602a48bc78538e8034d562781059f6fabb8
Reviewed-on: https://gerrit.instructure.com/57276
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-07-15 22:08:06 +00:00
James Williams f9e93f99f5 fix imported discussion topic locking by date
test plan:
* create a discussion topic locked by date in the past
 (i.e. now "closed for comments")
* copy the discussion topic to a new course, using the
 "Remove Dates" option
* the new topic should not be locked

closes #CNVS-21707

Change-Id: I9e8adcaa5f8694da23172bcc1938a029f6cd0d9a
Reviewed-on: https://gerrit.instructure.com/57811
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-07-08 12:58:01 +00:00
Steven Burnett b766ee9d45 fixes permissions with discussion page
fixes the permissions of editing the discussions page
after you have been concluded in a course

fixes CNVS-20705

test plan:
- create a student
- create a discussion with that student
- as a teacher conclude his enrollment (but keep course active)
- as the student go back in and try to edit the discussion notice you can't

Change-Id: I9a29e923714783e618a8c5f4120ae4277cd6dab1
Reviewed-on: https://gerrit.instructure.com/55359
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-06-03 17:24:31 +00:00
Simon Williams ae0fc774d6 don't rely on broadcast_policy for discussion send_to_stream
changed_state is defined by broadcast_policy, and uses an internal
broadcast policy variable called prior_version that isn't created if
save_without_broadcasting is called.  send to stream blocks shouldn't
rely on it.

fixes CNVS-20556

test plan:
- with sentry enabled,
- import a discussion topic
- it shouldn't create an error report

Change-Id: Iea8a7b240b547d52d26daf7a6390bc8c3a1de976
Reviewed-on: https://gerrit.instructure.com/54471
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-06-01 23:31:54 +00:00
Michael Nomitch 05b6409bb4 sort announcements by post date
fixes CNVS-7271

test plan:
  - make three announcments
    - one created first but delayed post last
    - one created second but immediately posts
    - one created third but delayed post before
      the first message
    - when you go to the announcement index as a
      student or teacher, announcements are sorted
      by their post time, not by their created at
      time

Change-Id: I455b686e08934a11282756d146ee4ba21816e58b
Reviewed-on: https://gerrit.instructure.com/53612
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-05-12 21:34:55 +00:00
Strand McCutchen d6597c107c fix Style/EmptyLineBetweenDefs issue
Change-Id: Ib7b824043a7ac9196f06020e2ca42fe983565f0d
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52919
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-29 16:28:39 +00:00
Braden Anderson f5276f7a78 discussion entry liking
fixes CNVS-16277

test plan:
  * create a discussion topic
  * open edit page
  * change Allow liking, Only graders can like, Sort by likes
  * verify that changes persist

  * open topic show page
  * verify that like buttons are present if Allow liking is enabled
      and Only graders can like is disabled or the user can grade

  * click on a Like button
  * verify that the button is activated
  * refresh the page
  * verify that the rating persists
  * verify that the number of likes on each entry is displayed

  * enable Sort by likes
  * wait a minute for the topic's cache to rebuild
  * refresh the page
  * verify that entries are sorted by number of likes

Change-Id: I8e329899c8b81832bdf9132438537bcd7a32e258
Reviewed-on: https://gerrit.instructure.com/42786
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins
2015-04-25 03:10:48 +00:00
Benjamin Porter 8d770844e2 Announcements Index page - Order by post post date not position
Ordering by position is normally identical to ordering by post date.
The notable exception is when announcements are imported into a course.
In this case, the order is by position which is wonky because positions
are duplicated.

This patch changes the index to explicitly order by posted_at, or
delayed_post_at

Fixes CNVS-13028

Test Plan:
    1. Create a course and add an announcement or two
    2. Create another course and add an announcement or two
    3. Return to the first course and add an announcement or two
    4. Return to the second course and add an announcement or two
    5. Return to the first course and import the announcement from the
    second course (Hint: You will need delayed jobs running to complete
    the import).
    6. Visit the announcements index page on the first course and ensure
    that the ordering of announcements is based on *creation time* or
    *posting time*, and not on position

Change-Id: Ib1d1b155da197c1147fa87594152a722234190dd
Reviewed-on: https://gerrit.instructure.com/51527
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
Tested-by: Jenkins
2015-04-23 23:52:18 +00:00
Simon Williams a702f03f56 add media extension to download redirect urls for podcast rss
iTunes requires that enclosure urls end with the media extension, even
if they are redirect urls

fixes CNVS-19718

test plan:
- in a course, upload a media file (like an mp3)
- create an announcement, link to the media file in the announcement,
  and check the setting to allow the podcast feed
- save the announcement
- load the podcast rss feed, it should list the media file you uploaded
  and the enclosure url should have .mp3 in it (end of url, before query
  params)
- load the podcast feed in itunes
- it should work

Change-Id: I398a2cc0462405e27bf4f189fa9a2905df3b29db
Reviewed-on: https://gerrit.instructure.com/52092
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-04-21 20:27:12 +00:00
Simon Williams dde9ee86ca announcements rss feed shows correct list of visible announcements
fixes CNVS-19529

test plan:
- in a course, create the following types of announcements:
  * a normal announcement that is visible
  * an announcement that is post_delayed for the future
  * an announcement that is closed for comments (create announcement, go
    to show page and close for comments in the cog menu)
  * an announcement that is deleted (create and the delete)
- view the announcement rss feed as a teacher and a student
- the teacher should see everything but the deleted discussion
- the student should just see the normal one and the closed for comments
  one

Change-Id: I46dd583c01cbd7817f3d599cb3816bf386cf3266
Reviewed-on: https://gerrit.instructure.com/51095
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-04-16 14:31:32 +00:00
Cody Cutrer 9834937c8c don't autorequire a bunch of gems that are rarely used
Change-Id: I09ed3686629b62849d392684d587f30cb2047013
Reviewed-on: https://gerrit.instructure.com/51853
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 18:47:50 +00:00
Michael Nomitch d1b4fdf978 DA - group discussion topic index works with DA on
fixes CNVS-19639

test plan:
  - in a course with DA on make a group discussion topic
    (without an attached assignment)
  - go to the group discussion topic index page
  - make sure it shows up
  - make sure that the courses assignment & discussion topic
    indeces are working like normal

Change-Id: Ibe5802a32e59e4ae0fab21707d66fb3bcba1a7fd
Reviewed-on: https://gerrit.instructure.com/51695
QA-Review: Adam Stone <astone@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
2015-04-09 04:57:38 +00:00
Matthew Berns 294512d0d4 fixes inability to edit assignments with submissions attached to a deleted group
fixes CNVS-16702

test plan:
- Create a course group, student, and group assignments associated to the group
  set. (create a graded discussion, ungraded discussion, and regular assignment)
- As the student in the course, submit to the assignment and discussion assignments
- Delete the group set that the assignments are associated to
- go to the edit pages for the assignment and discussion assignments
- both should show the name of the deleted group in a disabled select field
- you should be able to edit and save all other settings, aside from group settings
- the submissions made by the student should still be associated with the
  assignments in speedgrader (note: this should be true for online url and text
  submissions. File submissions will go to an error page due to an unrelated issue)
- assignments without submsissions with an active group select dropdown should
  not show the deleted group as an option
- assignments not associated with a group or associated with an active group
  should show all expected behaviors

Change-Id: Ia3fb168b7a671a7df309883a381bc62d282960b2
Reviewed-on: https://gerrit.instructure.com/46411
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-04-01 22:29:33 +00:00
Benjamin Porter 4cb68ec577 Don't show announcement comments to non-students
When the user is not logged in, or is not enrolled in the course, don't
show student comments on announcements.

Fixes CNVS-19270

Test Plan:
    - Create an announcement in a *public* course as a teacher
    - As a student, leave a reply on the announcement
    - Verify that the reply shows up for students in the course, as well
      as the teacher and account admins
    - Log out, and verify that the comments are not visible to
      a non-user
    - Create an announcement in a non-public course and ensure that
      student and teacher and admin can all see them properly

Change-Id: Ide381f6271a1de66ac85f6c7b0e2a2557190991d
Reviewed-on: https://gerrit.instructure.com/50595
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2015-03-31 23:28:18 +00:00
Simon Williams 8d159face9 always include student replies in group discussion topic podcast feed
fixes CNVS-9825

test plan:
- as a teacher, create a course discussion, with 'Enable podcast feed'
  checked
- reply (still as teacher), and include a link to an uploaded mp3 file
- as a student, reply with a link to another uploaded mp3
- if 'Include student replies in podcast feed' and the student access
  the podcast feed (link is on the discussion show page), it should
  include both mp3s. if that options is false, it should only include
  the mp3 from the teacher.
- repeat the process for a group discussion, but notice that for group
  discussions, 'Include student replies in podcast feed' is not an
  option.
- group discussions should always include student replies in the feed

Change-Id: I54b8b3498d0d428576b904526702814930ec9d55
Reviewed-on: https://gerrit.instructure.com/50658
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-30 22:29:02 +00:00
James Williams 40524e549c don't set last_reply_at for imported discussions
test plan:
* create a discussion
* note the "last post" date on the discussions index
* copy the course
* the new discussion should not have a "last post"

closes #CNVS-14623

Change-Id: I1ac54a9023a5e9a574e886b2b37bc945c74fe30f
Reviewed-on: https://gerrit.instructure.com/51212
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-03-30 21:15:20 +00:00
Simon Williams 5e16de49b8 add permission flag for announcements to group and course APIs
The APIs for groups and courses allow the caller to supply a
?include[]=permissions flag.  The call did not return permissions for
announcements, meaning that the mobile clients had to guess.  If they
guessed wrong, then students would find out AFTER composing the message
that they didn't have permissions.  With this change announcement
permissions are communicated as well.

fixes CNVS-18585

test plan:
- Setup a teacher who is part of a course
- call the show api, passing it include[]=permissions and see that
	create_announcement is true

- Setup a student who is part of a course
- call the show api, passing it include[]=permissions and see that
	create_announcement is false

- Setup a student who is part of a group
- call the show api, passing it include[]=permissions and see that
	create_announcement is true

Change-Id: I04ce17416405f8bdf0c9fe0d63f3f29bd7cb07b6
Reviewed-on: https://gerrit.instructure.com/34413
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-19 18:00:20 +00:00
Michael Nomitch 6f84469096 DA - fix participants with visibility for group discussions
fixes CNVS-18897

test plan:
  - turn DA on
  - make an active user with a verified email address
  - make a group assignment discussion & assign to a
    group this user is in & publish it
  - check  /users/:id/messages and the user
    should have been notified about the post
    - if they get 2 notifications that is okay
      (it is a different bug)
  - make an ungraded group discussion in a course
    - check that participating users get
      notifications as well

Change-Id: Ib83315bf109a72fc657f151182851eaa50e90983
Reviewed-on: https://gerrit.instructure.com/49618
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-05 16:24:26 +00:00
Steven Burnett 992d13ceee fixes podcast media links
fixes the rss page crashing when a media link
was added to a discussion page.

fixes CNVS-10547

test plan:
- create a discussion with podcast and podcast reply enabled
- post a video from the side wiki bar(any format)
- click to get the rss feed of the current discussion
  notice no crashing.

Change-Id: I02353a05ff10a3448f36693adca5893acfeef1c9
Reviewed-on: https://gerrit.instructure.com/49388
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-03-02 17:20:51 +00:00
Simon Williams e0e14be4f6 remove remnants of canvas collections
test plan:
- basic regression test of discussions

Change-Id: I36a8726f3c77c7197597de7e3ad67d0227e0cd1a
Reviewed-on: https://gerrit.instructure.com/48361
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2015-02-27 21:58:39 +00:00
Simon Williams da552c4f91 mirror group discussion message attachment
fixes CNVS-7687

test plan:
- create a group discussion topic with an attachment
- go to one of the group subtopics
- the attachment should be shown there
- you should be able to download it

Change-Id: I5ab5e72e30717b745ebb5e329325574d68e0085c
Reviewed-on: https://gerrit.instructure.com/49179
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-27 03:08:19 +00:00
Jeremy Stanley 2aad9da12a forward context module actions to root topic
test plan:
 * create a group discussion topic
 * put it in a module
 * set up a "must contribute" requirement
 * as a student who is a member of a group, reply to the
   discussion topic
 * confirm that the module completion requirement is fulfilled

fixes CNVS-1444

Change-Id: Ie76c2be03fbc1421528c3b917ea57caba9d99b7b
Reviewed-on: https://gerrit.instructure.com/49502
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-02-26 15:16:21 +00:00
Simon Williams e38b564d54 allow admins with :read_course_content to see unpublished discussions
previously, admins needed the :manage_courses permission, which felt too
heavy for this use case.

fixes CNVS-17996

test plan:
- create a custom account admin role
- give them the :read_course_content permission
- go to a course with unpublished discussions
- they should be able to see them

Change-Id: I5a572ed0c59f7f2d1100b49d9857dce969f510df
Reviewed-on: https://gerrit.instructure.com/48322
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-25 00:37:38 +00:00
James Williams 855933a81b don't allow students to reply to topics locked on date
test plan:
* create a group discussion
* set the "available from" date in the future
* visit the discussion as a student in the group
* should not be able to reply

* also should not be able to edit own replies as
 a student if the topic is locked

* general regression testing on discussion topics,
 specifically locking/unlocking and closing for comments

closes #CNVS-18320

Change-Id: Ib617df7e10f18978f7e0cc4912647de0eefb581f
Reviewed-on: https://gerrit.instructure.com/48396
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-02-23 13:17:37 +00:00
Michael Nomitch 57fa680652 DA - unions on content_tag and discussion_topic scopes
fixes CNVS-16816

test plan:
  - make sure that the following are properly filtered
    from modules with DA on/off
     - quizzes
     - assignments
     - graded discussions
     - ungraded discusisons
     - wiki pages
  - check for modules index & student progressions page
  - discussion topic index properly filters with DA
    ON and OFF

Change-Id: Id0e2e97d2d876dfb48968163bf140da42183a3c9
Reviewed-on: https://gerrit.instructure.com/45133
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-12-11 19:05:02 +00:00
James Williams 2c69f3966b remove non-draft-state everything
test plan:
* basic regression test on assignments, discussion topics
 gradebook, and modules (mostly make sure the basic
 index/show/edit views aren't broken)

closes #CNVS-15563

Change-Id: I3411bfb7645b3c4bf8a4663e3e052b4402f899ba
Reviewed-on: https://gerrit.instructure.com/43609
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2014-12-10 17:57:18 +00:00
James Williams d2d69d60b0 fix discussion topic submission creation for locked assignments
test plan:
* create a non-graded discussion topic
* reply to the topic as a student
* edit the discussion to make it a graded assignment
 that is locked (i.e. available until a past date)
* submissions for the student's entries should be
 visible in speedgrader

closes #CNVS-8768

Change-Id: I1e93cb4d34138b4b37ac43681ba6d08eea89ec9b
Reviewed-on: https://gerrit.instructure.com/45461
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-12-10 13:53:08 +00:00
James Williams 28e27c6341 allow teachers to seed replies for unpublished and locked topics
test plan:
* as a teacher, should be able to create replies for a topic
 even if it is unpublished or "closed for comments"
 (students should still not be allowed to)
* should be able to unpublish a discussion topic if no
 students have replied to it (instead of if anybody has replied)

closes #CNVS-10384

Change-Id: Ieefebdd3f41709eda6e593d597d08a57c364992d
Reviewed-on: https://gerrit.instructure.com/45048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2014-12-02 19:42:52 +00:00
Michael Nomitch 3347ca8df2 DA - avoid seq scans in scopes
test plan:
  - with DA on and OFF
  - assignments & discussions & quizzes & modules indices load
    and filter properly for students/teachers
  - assignments needing submitting/grading load and
    filter properly
  - grade summary page for students & teachers loads
    and filters assignments properly

Change-Id: Ibff8ff0357360a7e09d500c2475885f3dfb7f495
Reviewed-on: https://gerrit.instructure.com/44215
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-11-19 15:41:47 +00:00
Cody Cutrer 0c5e957e12 validate group_category_id in discussion topics
refs CNVS-16708

test plan:
 * post a new discussion topic for a group
 * it should work

Change-Id: I0e98b1000383297f21273fe66f2175af9a69d009
Reviewed-on: https://gerrit.instructure.com/43874
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-11-10 22:59:52 +00:00
Cody Cutrer a0ba7f7606 remove shims of migration to DiscussionTopic#group_category
Change-Id: I15e3224275c6aab911cae6c2a9e3aac167b61f71
Reviewed-on: https://gerrit.instructure.com/43875
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-11-06 22:35:59 +00:00
James Williams a4dda9a941 fix adding an attachment to discussion topics on create/edit
unpublished topics were not granting :attach rights even to
teachers/topic owners

also fix the selenium specs for draft state

test plan:
* as a teacher,

* create a discussion topic and add an attachment
* save the form
* should have added the attachment correctly

* edit a discussion topic
* should have an option to edit/add an attachment
* should save correctly

fixes #CNVS-14245

Change-Id: Iac4b48b304b4d7eb68c9518bddbf60da70831811
Reviewed-on: https://gerrit.instructure.com/43365
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-10-29 16:16:38 +00:00
Michael Nomitch 78571b40a5 DA - module evaluation efficiency
fixes CNVS-16367

test plan:
  - go to modules page and change stuff and save
    - things dont break
  - DA'd discussions/assignments/quizzes filter out
    of the modules page for students
  - the page for all student progressions works
    as it should

Change-Id: I8403e4c508169e7f3750f3ddc7494f4a4ed3f371
Reviewed-on: https://gerrit.instructure.com/43113
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-28 19:11:47 +00:00
James Williams 127ce61d87 prevent closing upcoming assignment discussions
test plan:
* create a course with a graded discussion with an
 upcoming due date
* confirm that the gear menu on the index no longer
 has an option to "Close for comments" (that didn't work)
* confirm that dragging the discussion into the
 "Closed for Comments" group does not let you
 drop it in

closes #CNVS-16029

Change-Id: I50c21fc528409c4d5e90344149d751ff25f86389
Reviewed-on: https://gerrit.instructure.com/42720
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Janelle Seegmiller <jseegmiller@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
2014-10-15 20:46:56 +00:00
Michael Nomitch 7ca8f592d2 DA - scope naming and filtering
fixes CNVS-15925

test plan:
  - quick regression test of DA
    - focus on assignments/quiz/discussion/modules index pages

Change-Id: I0c6fe67f14e0692d54727839ece993037fc4f6ca
Reviewed-on: https://gerrit.instructure.com/41958
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-10 18:27:31 +00:00
James Williams 9570095541 fix discussion topic permissions for draft state
when draft state is enabled, it shouldn't grant
reply rights when a topic is closed for comments

test plan:
* create and publish a discussion topic
* close it for comments
* as a student, should not be able to add a reply
 through the api

refs #CNVS-15563

Change-Id: I238f2e8956c9bd3136dfd69db5bb4d63c07102c0
Reviewed-on: https://gerrit.instructure.com/42282
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-10-09 19:29:09 +00:00
Cameron Sutter 4a80953544 DA - permissions
fixes CNVS-15852

test plan:
 * setup DA
 * for assignments
   - as a student, submit an assignment
   - as a teacher, remove visibility from that student
   - as a student, type in the url (/courses/:id/assignments/:id/submissions/:id)
     for your submission for that assignment
   > there should not be a link to resbumit the assignment
 * for discussions
   - as a student, using the API
   > you should not be able to reply to a discussion for which you do not have
     visibility

Change-Id: Ia4669626c745aac02ac9830865c5a5b2fd75cc37
Reviewed-on: https://gerrit.instructure.com/41947
Product-Review: Hilary Scharton <hilary@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
2014-10-07 20:36:51 +00:00
Cody Cutrer 7b4f9896b9 don't use write_attribute for user_has_posted in streams
refs CNVS-15830

test plan:
 * create a discussion topic that requires a user to post
 * query the stream for that course via the API - the user_has_posted
   field should be true or false, but not nil

Change-Id: I213f26951773301ef31668289eae2fc7f9001d49
Reviewed-on: https://gerrit.instructure.com/41975
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-06 20:45:28 +00:00
Michael Nomitch dfebb4972a DA - quiz/submission/discussion notifications
fixes CNVS-15156

test plan:
  - with DA on:
    - submission:
      - make a differentiated assignment
      - turn in a submission as a student
      - give the student a grade
        - as the student, ensure you have the notification, and then
          delete it
      - as a teacher, take away visibility and delete their grade
        - as the student, you should not have a new notification for grade
          changing
      - as a teacher, comment on this submission
        - as the student, you get notified about the comment
    - quiz:
      - as a teacher make a differentiated quiz
        - students without visibility dont get notified about it
    - discussion:
      - discussion notifications are broken so we cant QA
  - with DA off:
    - submission:
      - comment on a submission as a teacher and make sure the
        student is notified
      - grade a student as a teacher and make sure the student
        is notified
    - quiz:
      - making & assignment a quiz sends out notifications properly
    - discussion:
      - discussion notifications are broken so we cant QA

Change-Id: I891f9782b5ae70252e7949a6858896b73ac28871
Reviewed-on: https://gerrit.instructure.com/41025
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-10-03 22:08:27 +00:00
Cody Cutrer 102fdfc849 no more dynamic finders (models)
refs CNVS-15126

Change-Id: I2996e0e262c41274c34d0ea3bfde757074416b8c
Reviewed-on: https://gerrit.instructure.com/40973
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-24 20:51:48 +00:00
Clay Diffrient 6e8f80218c Modifies subscription_hold to return nil if user is nil
fixes CNVS-15356

Test Plan:
  - Add a discussion to a course that has the following options:
    * Group discussion
    * Allow threaded replies
    * Graded
    * Set a due date of sometime in the future
  - Make the course syllabus publicly available
  - In another window (incognito) go to the syllabus
  - The syllabus should load without problems.

Change-Id: I177555c6e0ac87554360361a95b1ff0a26d35883
Reviewed-on: https://gerrit.instructure.com/41176
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-09-16 19:54:17 +00:00
Alex Boyd 30ad015acf Don't create stream items for unpublished discussions
Fixes CNVS-13979

Test plan:
  - As a teacher with access to a given course, create, but do not publish,
    a new discussion topic in said course
  - As a student enrolled in said course, hit
    /api/v1/users/self/activity_stream and verify that the discussion
    does not appear in the list
  - As the teacher, publish the discussion
  - As the student, hit /api/v1/users/self/activity_stream and verify that
    the discussion now appears in the list
  - As the teacher, unpublish the discussion
  - As the student, hit /api/v1/users/self/activity_stream and verify that
    the discussion no longer appears in the list

Change-Id: I8f6a75d9b4946f92adf7a5e413ecca0c6b00d65b
Reviewed-on: https://gerrit.instructure.com/40603
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Janelle Seegmiller <jseegmiller@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-09-10 16:44:55 +00:00
Michael Nomitch 58c30e2078 DA - discussions
fixes CNVS-14093

test plan:
  - turn on DA, create a graded discussion only assigned
    to one group
  - as a teacher or a student with visibility
    - you can access the dicussion through the app or the api
    - students without visibility arent included in participants
  - as a student without visibility
    - the discussion index doesn't show the discussion
    - a direct link to the discussion will send you to the
      discussion index with a flash error
    - the API doesn't show the discussion
      (show page, entries page, or replies page)
    - cannot subscribe to the topic via the api
  - with DA off, the discussion shows up normally
  - a student in both sections has visibility

Change-Id: Icefef62695f73d38787d9af08ec26c595c2e4514
Reviewed-on: https://gerrit.instructure.com/39383
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-08-28 22:18:26 +00:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-06 18:16:19 +00:00
Cody Cutrer 1277aaae90 stabby lambda scopes for rails4
Change-Id: I34f2527471cdb4d8cab5cde426ba959baa26189e
Reviewed-on: https://gerrit.instructure.com/37151
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-04 02:11:56 +00:00
Nick Cloward eea4718d6b clean up calls to cached_context_grants_right?
refs: CNVS-11425

Change-Id: I0487d98b839d33a339592d312ed8ed2134c4b62e
Reviewed-on: https://gerrit.instructure.com/35528
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:51 +00:00
Nick Cloward e9595976c1 clean up permission calls for grants_rights?
refs: CNVS-11425

Change-Id: Ia0145e4b4d1da9e0f83a1845647ce203b3586057
Reviewed-on: https://gerrit.instructure.com/34280
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 18:10:30 +00:00
Cody Cutrer bb0b5687fa clean up permission blocks a little
don't take a session param if it's unused

Change-Id: Ic24a17311bd6353892310e309b70397567e36ef8
Reviewed-on: https://gerrit.instructure.com/36251
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-12 22:10:41 +00:00
Drew Bowman c14943380b prevent notifications when a course is soft concluded
fixes CNVS-4348

test plan:

- have a course that has an end date in the past

- create an announcment, it should not send a notification
- create an assignment, it should not send a notification
- create a discussion topic, it should not send a notification

Change-Id: Ic371d651ae00abe80c17e569f74e94e49c017708
Reviewed-on: https://gerrit.instructure.com/36229
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-06-11 19:36:34 +00:00
Braden Anderson 45d19f3003 validate types on polymorphic associations
fixes ALYT-26

test plan:
	* regression test

Change-Id: Ie93e89b842e354f1f76d75f3492145b86c79a035
Reviewed-on: https://gerrit.instructure.com/34560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-28 17:05:34 +00:00
James Williams 2ba4531f73 migration refactor: account question banks import
test plan:
* course migration regressions (canvas cc, course copy)

* in addition:
 use the content migrations api to queue a content migration
 for an account ("/accounts/:account_id/content_migrations")
 to import a qti/cc package.
* confirm that the question banks from the package
 that would have been normally imported into a course are now
 imported into the account

closes #CNVS-12529

Change-Id: I2ef306341d2f7defe03c63a981679a3987f1aaa0
Reviewed-on: https://gerrit.instructure.com/34303
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-05-12 16:30:10 +00:00
Braden Anderson 4fafdda484 discussions: separate group discussions from group assignments
fixes CNVS-4475

pre-checkout plan:
  * create a course
  * open people->groups
  * create a student group with multiple students
  * open discussions
  * create two topics
  * make one topic a group assignment

test plan:
  * open the topics you created
  * verify that a "group discussion" option replaced "group assignment"
  * verify that your group assignment is a group discussion
  * verify that your group discussion uses the same group set
  * verify that the old behavior of presenting child topics is retained
  * verify that your non-group topic is not a group discussion
  * verify that the "group discussion" flag cannot be changed for topics
      with replies

  * create a new discussion topic
  * verify that "group discussion" is available for ungraded topics
  * verify that changes to the field persist

  * create a new graded group discussion topic
  * post to one of the subtopics as a student in its group
  * open the gradebook as the teacher
  * verify that the student who posted has a submission but the other
      group members do not
  * verify that group members can be graded individually

Change-Id: Iada30628f0abdb7d7df4267d695553baf8b952d3
Reviewed-on: https://gerrit.instructure.com/33253
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-08 21:18:40 +00:00
Anthus Williams 828981e72c define exportable attributes/associations on models
instead of passing an :exportable option to
ActiveRecord::Associations, simply define a constant
on the class containing exportable associations and
attributes. This is due to :exportable breaking
ActiveRecord, and we can't simply monkey-patch in
config/initializers because models are included in
migrations before the initializers are run

Change-Id: I11f1a6b4570c397d8e01010c517bc6efdac7afca
Reviewed-on: https://gerrit.instructure.com/33235
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-05-06 23:54:24 +00:00
James Williams 7692af009a move all importing methods into models/importers
test plan:
* migration regressions

Change-Id: Ibed8d4820c05b9c69101b215932af32055c3e006
Reviewed-on: https://gerrit.instructure.com/33728
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-05-02 17:31:15 +00:00
Raphael Weiner 5553f62357 extract incoming mail into gem
fixes CNVS-12182

test plan
- regression test on incoming mail
- use script/process_incoming_emails to manually trigger the processing
  of incoming mail

Change-Id: Iccd74d8fe2b5af3d5eefe25a2736273e3bf559b0
Reviewed-on: https://gerrit.instructure.com/32794
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-04-25 23:06:02 +00:00
Joseph Rodriguez 8554d5c894 moving mail processor to module
fixes CNVS-12174

Test Plan:
Regression test on incoming mail.

Change-Id: I3f5d131ce4a1f4408bf95a5455ffc4baa6bdc85c
Reviewed-on: https://gerrit.instructure.com/32716
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-04-25 23:05:39 +00:00
Jason Madsen ec7751f341 move migration importers to app/models/importers
closes CNVS-12404

test plan:
  - verify that importing calendar event data continues to work
  - verify that importing with media tracks continues to work
  - verify that importing discussion topics continues to work

Change-Id: Ia5c88cc179e3cc8075270d0d423e618f80d61234
Reviewed-on: https://gerrit.instructure.com/33314
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
2014-04-22 15:35:09 +00:00
Braden Anderson a4d56a3bd0 discussions: add "move to" option
fixes CNVS-9044; fixes CNVS-12110

test plan:

  * open discussions as a user with moderation permissions
  * click the gear menu on a pinned discussion topic
  * click the "Move To" option
  * select a new position for the discussion topic
  * verify that the discussion topic is moved
  * refresh the page
  * verify that the change persists

Change-Id: If118e41066d224dbb3153113c67372ecdd2b3007
Reviewed-on: https://gerrit.instructure.com/32423
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-04-02 22:50:40 +00:00
Simon Williams 98f1648c3d fix url for undeleting quizzes
also fix undeleting practice quizzes

fixes CNVS-11955

test plan:
- in a course, delete a quiz
- go to /courses/:id/undelete
- click the button to undelete the quiz
- it should work

- quick regression on undeleting quizzes/discussion_topics both linked and not
  linked to assignments

Change-Id: I88d30d1baa5685e6c4f16280c9aa34c8965b31fe
Reviewed-on: https://gerrit.instructure.com/32217
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-03-21 21:53:08 +00:00
James Williams f3ef3816e5 fix discussion_topic importing into groups
test plan:
* create a course with a discussion topic
* export the course
* create a new course
* add a user group in the new course
* import the package into the course
* should not fail or import as a group topic

fixes #CNVS-11377

Change-Id: Ied4c80ed48d6495bdee60f79948445141997d5e8
Reviewed-on: https://gerrit.instructure.com/31087
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-03-04 12:47:09 +00:00
Mark Severson e1e466b69b fix content tag state synchronization
test plan (non-draft-state):
 - as a teacher
   * create each of the following:
     - assignment
     - discussion
     - page (hidden from students)
     - page (not hidden from students)
     - quiz (leaving it unpublished)
   * add each of the above items to a module
   * refresh the modules page
     - each of the above items should be listed
 - as a student
   * navigate to the modules page
     - the hidden page and quiz should not be listed
     - all other items should be listed
   * click on the first item in the module
   * click through each of the 'Next' buttons
     - only items listed in the module should be presented

test plan (draft-state):
 - as a teacher
   * create each of the following:
     - assignment
     - discussion
     - page
     - quiz
   * add each of the above items to a module
   * refresh the modules page
     - each of the above items should be listed
 - as a student
   * navigate to the modules page
     - only published items should be visible
   * click on the first item in the module
   * click through each of the 'Next' buttons
     - only published items should be presented

   * publishing items (as a teacher) should make them available to the
     student in the module progression as well as the modules page

closes CNVS-10831

Change-Id: Ia84e56f42438ff531a4e15784eefaec2ead8ecdd
Reviewed-on: https://gerrit.instructure.com/30312
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2014-02-19 20:36:59 +00:00
Raphael Weiner 5f52dce2d4 replace Array#once_per extension with #uniq
Change-Id: I49111316d6cbc1f4be111567ed7f5e670d1d948c
Reviewed-on: https://gerrit.instructure.com/30023
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Stephan Hagemann <stephan@pivotallabs.com>
2014-02-13 18:53:05 +00:00
Raphael Weiner 6ae716da73 extracted html text helper methods into gem
test plan:
  * run specs

Change-Id: I8bd463396aee14853bdcf552eef144a509ffb62a
Reviewed-on: https://gerrit.instructure.com/29613
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-02-07 20:11:19 +00:00
Cameron Matheson 3c434e8aff Remove unused collections stuff
This was a beta api that didn't work out.

Test plan:
  canvas should still work (sorry, this touches lots of stuff)

Change-Id: I31680b83f72f6d739ce74735ba40d7a760debb33
Reviewed-on: https://gerrit.instructure.com/29506
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-02-07 19:32:46 +00:00
James Williams e1f6eed752 update uses of .save(false) to rails 3 style
Change-Id: I9627b75a5473044f9902a5e171a79d4446772ed7
Reviewed-on: https://gerrit.instructure.com/29572
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-02-05 19:44:25 +00:00
Raphael Weiner 91944495c2 convert sanitize field plugin into proper gem: CanvasSanitize
Change-Id: I5562a318bb3f52c1374a3a69f288bfb2381f8ee7
Reviewed-on: https://gerrit.instructure.com/29405
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stephan Hagemann <stephan@pivotallabs.com>
Product-Review: Stephan Hagemann <stephan@pivotallabs.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-01-28 22:36:18 +00:00
Cody Cutrer 60cb7ae7c0 sort discussions by created_at and id
to handle no sub-second timestamps in mysql

refs CNVS-7032

Change-Id: I86ef91cd6fd6919accf2c2f90bc5482911f66292
Reviewed-on: https://gerrit.instructure.com/28781
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-17 19:38:32 +00:00
Braden Anderson 4b2c6771bb discussions: use strings for IDs in ENV and materialized view
fixes CNVS-10341

test plan:
  * before applying this commit, if possible:
    * create a discussion
    * add a reply as a student
  * after applying this commit:
    * open the discussion as the student
    * verify that you can edit the reply you added before, but not
        those from other users
    * add a new reply
    * without refreshing, verify that you can edit your new reply
    * refresh the page
    * verify that you can still edit your reply

  * test basic canvas functionality (sorry)

Change-Id: Ifa654f7d853fd167d5bfbaee6184657209d58272
Reviewed-on: https://gerrit.instructure.com/28413
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-16 17:31:32 +00:00
Zach Pendleton 58592fdcf0 refactor DiscussionTopic#change_all_read_state
fixes CNVS-10124

test plan:
  * run specs

Change-Id: I92509681a62358b25454aec948901f603893babf
Reviewed-on: https://gerrit.instructure.com/28256
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2014-01-10 23:19:10 +00:00
Zach Pendleton a5b2c12069 refactor DiscussionTopic#process_migration
fixes CNVS-10125

test plan:
  * run specs

Change-Id: I78dde6fe0c7e80ecf9d93914878bd9e1a4827298
Reviewed-on: https://gerrit.instructure.com/27812
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-31 15:30:06 +00:00
Zach Pendleton 862497d01f move discussion_topic import to a service object
fixes CNVS-10122

test plan:
  * run specs

Change-Id: Ic13a7f41cb86812d5f268c47677161a5bd3116d8
Reviewed-on: https://gerrit.instructure.com/27810
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-31 15:29:54 +00:00
Cody Cutrer 65da18174e improve acts_as_list
fixes CNVS-9622

basically, stop with the assumption that lists must be contiguous,
so that we don't have to keep compacting them all the time. allows
for far simpler queries adding things to lists.

test plan:
 * regression test on lists - files, context modules, assignments,
   etc.
 * basically make sure that adding new items puts them in the same
   spot as it did before (bottom of list?), and that reordering
   still works

Change-Id: I31c9ad4ed9b7db2b23e032617d4a01611c8e3c03
Reviewed-on: https://gerrit.instructure.com/26709
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-12-17 19:55:43 +00:00
Joel Hough e201063960 discussion draft state backend
fixes CNVS-9263

test plan
be sure to test ungraded discussions, graded discussions, graded
group discussions (root level and group topics), and announcements

with draft state disabled
- ensure publish icons do not appear on discussion index page
- ensure publish button does not appear on discussion show page
- ensure that discussions for delayed posting are not visible to
 students

with draft state enabled
- ensure that publish icons appear on the discussion index page and
 that clicking them toggles the discussion's publish state
- ensure that publish button appears on the discussion show page
 and that clicking it toggles the discusssion's publish state
- ensure that unpublished topics are not visible to students
- ensure that published topics are visible to students, even if
 the topic is for delayed posting
- ensure that topics for delayed posting show a 'This topic will
 open on' message on the topic show page
- ensure that [un]publishing the root topic of a graded group
 discussion changes the group level discussion and vice versa
- ensure that announcements are published when posted and cannot
 be unpublished

test plan for misc frontend fixes
- as a teacher, create a new discussion
- ensure it is unpublished
- as a student, create a new discussion
- ensure that it is published and that no publish button appears
 on the topic show page or the topic index page

- as a teacher, create a new graded group discussion
- navigate to the group level topic
- publish the topic using the button on the show page
- ensure that the button switches to the 'Published' state

- as a teacher, create an announcement
- ensure that it is published

Change-Id: If0c46d232bc25776770012654af23e5cf10bbb45
Reviewed-on: https://gerrit.instructure.com/26654
QA-Review: Joel Hough <joel@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
2013-12-10 18:10:57 +00:00
Jeremy Stanley e3487e6db0 restore items in unpublished state
test plan:
 in a course with draft state enabled,
  1. create an assignment, module, discussion, quiz, and wiki page.
  2. delete them all.
  3. restore them via /courses/X/undelete.
  4. they should come back unpublished.

note: once an item is "deleted", its published state is lost,
so we can't bring them back to their former state.

fixes CNVS-9838

Change-Id: Ie40ebc5123cf49dae2c6c1af380be954f9f80a75
Reviewed-on: https://gerrit.instructure.com/27036
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Sterling Cobb <sterling@instructure.com>
Product-Review: Jeff Fox
QA-Review: Myller de Araujo <myller@instructure.com>
2013-12-06 23:24:26 +00:00
Jacob Fugal 34893f80bd remove uses of memoize
fixes CNVS-9331

instead, as appropriate, use one of (or a combination of, if necessary):

 * instance variable caching
 * Rails.cache
 * query caching (implicit)

also:

 * remove the buggy cc.active_pseudonyms (didn't account for
   sharding) in favor of cc.user.all_active_pseudonyms
 * streamline assignments in the menu to not need to construct method
   names

test-plan: N/A

Change-Id: Id0dec60464a283985e39493b90711b32cb5cca82
Reviewed-on: https://gerrit.instructure.com/26936
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-12-06 22:03:24 +00:00
Jon Jensen 3d2b6d07d1 don't create 2 jobs for auto-locked delayed announcements
also make update_based_on_date more defensive (i.e. lock the row) for any
double jobs out in the wild. we don't delete jobs, so you could have dups
even without this bug, e.g. you set it for 1pm, then 2pm, then back to
1pm, et voilà, you now have 2 jobs at 1pm

fixes CNVS-9561

test plan:
1. under course settings, disable comments on announcements
2. create a new announcement w/ a delayed posting date
3. confirm that only one delayed job is created (you should not get
   double-emailed)
4. create another announcement w/ a delayed posting date
5. change the posting date
6. revert to the original date
7. while there will be multiple jobs, you should still not get double-
   emailed for the announcements

Change-Id: I86de7fc418599de86d9ef300ea7b3c2bf9f924b3
Reviewed-on: https://gerrit.instructure.com/26652
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
2013-11-26 20:58:10 +00:00
Joel Hough 1941d97d90 discussions: add publish icon to index and show pages
fixes CNVS-9265

test plan
- ensure that the publish icon is not visible when the account
 level draft state variable is unset
- ensure that the publish icon is visible when the account level
 draft state setting is set
- ensure that ungraded topics with no replies can be published/unpublished

Change-Id: Ia93b91aa54812610e5c07e063f512e605d6235f2
Reviewed-on: https://gerrit.instructure.com/23470
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2013-11-20 21:33:25 +00:00
Jacob Fugal a5d8bb8041 limit fake_arel caveats to rails2
refs CNVS-4704

fake_arel gets us most of the way to rails3's arel, but with some
caveats. the workarounds (mostly) work in both, but it'll be nice to not
have them crufting around when we're on rails3. so only use the
workarounds in CANVAS_RAILS2 branches.

Change-Id: Ia1f5cfa6b10f83cdb8d9a6e397b12401d180118d
Reviewed-on: https://gerrit.instructure.com/26331
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-11-19 19:46:30 +00:00
Ryan Florence 7c5d5da632 draft state modules
Change-Id: I7f1117d4a18652624ea6dcf9aae4740740796b90
Reviewed-on: https://gerrit.instructure.com/25420
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-11-12 16:31:46 +00:00
Rob Orton 9cae25c185 record when a quiz or user gets deleted
also force deleted_at to be utc

test plan
 - delete a user
 - the user should have deleted_at populated
 - delete a quiz
 - the quiz should have deleted_at populated

Change-Id: Ibf3442b832f648d754ac9959f053570bc8c06a19
Reviewed-on: https://gerrit.instructure.com/25585
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2013-10-29 23:07:12 +00:00
Landon Wilkins 2be1c54e0c fixes delayed announcements for content migrations
test plan:
* enroll a student in course B
* create a delayed announcement for 10 min in the future
**  on some course A
* perform a course migration from course A to course B
* wait 10 min
* verify that the student in course B receieved a notification
**  for that announcement

Change-Id: Id93c12601cdcfdd62f120127e271267f6e93ad6c
Reviewed-on: https://gerrit.instructure.com/25334
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-10-17 18:57:55 +00:00
James Williams f360597426 remove unnecessary clone_for methods
Change-Id: I8d80d36bde5dfdcff3de2f86aa3223e6c03a23aa
Reviewed-on: https://gerrit.instructure.com/24771
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-09 12:13:18 +00:00
Nick Cloward 14b5840ae3 Add a permission option in the api to return if the user can create topics.
closes CNVS-6824

This adds a permissions attribute to the returned json for discussion topic
contexts (Course, Group).

The permissions attribute contains an optional permission of
"create_discission_topic" which returns true or false depending on whether the
current user can create discussion topics for the course or group.  For
performance reasons this is only added to a single course/group json and not in
lists so the only call that will return it is /api/v1/<context>/<context_id>
where context is a course or group.  Since we did not want to include this on
every response its a custom permissions attribute for course and groups in the
course_json or group_json serialization methods.

Using the includes parameter for the API supplying a value of "permissions"
will include the permissions with "create_discussion_topic" for a group and
course.  When the object is serialized to json it checked to see if the model
implements a serialize_permissions method and calls that to render or override
permissions generated from the policies.

- Create a test Course. Make sure the course allows members to post topics.
- Add a student to the course.
- Make a call to /api/v1/courses/<id> where "<id>" is the id of the created
  course.
- The response should include a permissions attribute with a boolean value for
  "create_discission_topic" see the example below.

- Make a call to /api/v1/courses to return a list of course objects.
- The permissions attribute should not be included in the response.

- Create a test Group tied to the course created in the first step.
- Add a mamber to the group.
- Make a call to /api/v1/groups/<id> where "<id>" is the id of the created
  group.
- The response should include a permissions attribute with a boolean value for
  "create_discission_topic" see the example below.

- Make a call to /api/v1/groups to return a list of group objects.
- The permissions attribute should not be included in the response.

Example Response:
{
	id: 42,
	...
	permissions: {
		create_discission_topic: true
	}
}

Change-Id: Ia02d5aa67e345740a93dd0f63e357e7cb5e1efd6
Reviewed-on: https://gerrit.instructure.com/24478
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-09-30 14:32:48 +00:00