Commit Graph

107 Commits

Author SHA1 Message Date
Joel Hough 7a6ccef2b9 do discussion topic locking with a flag
fixes CNVS-6592

test plan
- ensure discussion topic locking works as before
- delete and undelete a topic
- ensure that undeleted topic remembers whether it was locked

Change-Id: I389dc68ac181283b77fd23e5ca9b71b8bf6a0b55
Reviewed-on: https://gerrit.instructure.com/21923
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-07-03 19:08:46 +00:00
James Williams fac904c654 initialize last_reply_at to posted_at for imported topics
test plan:
* copy a course with an announcement
* should keep the same date

refs #CNVS-5916

Change-Id: Idb9f5d49563ac2321b5207b2e18d525cb94b7dbc
Reviewed-on: https://gerrit.instructure.com/21765
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2013-06-27 17:53:59 +00:00
Joel Hough 65986cfaac discussion topic subscription flag and api
fixes CNVS-6238

test plan
using the api:
- view a discussion topic as a user that did not author it
- ensure that subscribed: false

- view a discussion topic as the authoring user
- ensure that subscribed: true

- unsubscribe from a discussion topic that the user authored
- ensure that subscribed: false

- subscribe to a discussion topic
- ensure subscribed: true

- subscribe to a topic that requires an initial post with a user
 that hasn't posted yet
- ensure that it is an invalid request

- subscribe to a topic that requires an initial post with a user
 that has posted
- ensure subscribed: true

Change-Id: Ie76a046bb6e9b5253088c371ffdc4dc6ddf08231
Reviewed-on: https://gerrit.instructure.com/21402
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-06-14 21:40:50 +00:00
Mark Severson 5f9fcb977c change APIs to return consistent locking information
affected apis:
 * assignments
 * discussions
 * files
 * pages
 * quizzes

test plan:
 * verify returned attributes:
   * locked - manually locked state of the item
   * locked_for_user - user's access to the item
     (false will always be returned for a teacher)
   * lock_explanation - explanation of the reason for the lock
     (if locked_for_user)
   * lock_info - detailed information about the reason for the lock
     (if locked_for_user)

fixes #CNVS-5837

Change-Id: I0c397a218180d58da7a2f710d9977d9ddb7745fc
Reviewed-on: https://gerrit.instructure.com/21212
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-06-07 21:41:31 +00:00
Mark Severson df82a1efc4 change available_for? and locked_for? to be more consistent
test plan: no functional change

refs #CNVS-5837

Change-Id: I07d942840e30df15883d484fcc4c6d0f86ff477d
Reviewed-on: https://gerrit.instructure.com/21156
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-06-07 21:41:21 +00:00
Zach Pendleton 1a1c2d294b add "pinned" discussions to index view.
fixes CNVS-5708

discussion topics can now be pinned to preserve their
position at the top of the discussion topics index page.
pinned discussions can be manually sorted, while all
other topics remain sorted by most recent activity.

test plan:
  * in a course with existing discussion topics, attempt
    to drag a topic into the pinned area and verify that
    it properly moves to that group and persists on page
    refresh;
  * move multiple topics into the pinned area and verify
    that they can be manually sorted and that the sort
    persists on page refresh;
  * drag a pinned topic to the open discussion area and
    verify that it properly moves there and persists on
    page refresh;
  * verify that pinned and open topics cannot be dragged
    into the locked area;
  * verify that open topics offer a pin option in their
    gear menus and that pinned topics offer an unpin
    option. verify that these options work as expected.

Change-Id: I65dccba5eed11dd8b0996ecd930b93a1d61dbebc
Reviewed-on: https://gerrit.instructure.com/21260
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Zach Pendleton <zachp@instructure.com>
2013-06-07 20:00:26 +00:00
Joel Hough 7f0b863d88 add alias for delayed posting from old delayed jobs
fixes CNVS-6143

test plan
- have some old delayed jobs that try to post a discussion using
 DiscussionTopic#try_posting_delayed
- ensure that they do indeed post the discussion

Change-Id: Ie3c2fa1e0ec65a031d4da258ce2d66be3a1cb7e1
Reviewed-on: https://gerrit.instructure.com/21248
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-06-06 19:33:21 +00:00
Simon Williams d96ba9c601 finish removing course.publish_grades_immediately
this was removed from the UI in Mar 2011 but was never completely ripped out.
we'd like to remove it now since it was adding extra complexity for no benefit.

closes CNVS-5929
refs #3974

test plan:
- create/update/delete an assignment from the index page, and the show page
- grade an assignment (with and without muting)
- test assignment notifications (with and without muting)
  - creating an assignment
  - editing an assignment
  - changing a due date (after 3 hours of being edited)
  - grading an assignment

Change-Id: Ie455bed41154018b5bd2c9c0e69e1e3285a0ac09
Reviewed-on: https://gerrit.instructure.com/20778
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2013-06-04 18:11:08 +00:00
Bracken Mosbacker 87eac4a7ae save selective import options for new migration api
The chosen options are now saved, and the import code was
updated to check for the new names and still work for the
old names.

Test Plan:
 * Selecting/deselecting specific areas in the new UI should work
 * Selecting/deselecting specific areas in the old UI should work

refs CNVS-4742

Change-Id: I2fd0bd9ffdb7d1d70ddb01a6b7be6f7ef708a5b5
Reviewed-on: https://gerrit.instructure.com/21043
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-05-31 22:49:50 +00:00
Jon Willesen 3d9d13d17c add api parameter to fetch discussion topics in a specific order
adds a parameter to fetch discussion topics ordered by
`last_reply_at` instead of by `position`. Defaults to position
for backwards compatibility. Added a database index to make
fetching this order from the database more efficient.

fixes CNVS-5707

test plan:
 - see api documentation for "list discussion topics" and see
   the new `order_by` parameter:
   - <canvas-url>/doc/api/discussion_topics.html
 - create a bunch of discussion topics and modify their order.
 - post some replies to some of the topics.
 - call api to fetch the list of discussion topics
   - fetched topics should be ordered by position, as they
     appear on the index page.
 - call api to fetch the list of discussion topics and specify
   `order_by=recent_activity`
 - the fetched topics should be ordered by how recently they
   have receieved replies. The most recent should be first.

Change-Id: I4b576677ecf56133c98186171a11dfeb5f987a34
Reviewed-on: https://gerrit.instructure.com/20987
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-05-29 21:15:48 +00:00
Jon Willesen a65f2acb7a add forced_read_state to DiscussionEntryParticipant and APIs
Don't automatically mark a discussion entry as read if the user
manually marks the entry as unread.

fixes CNVS-5705

test plan:
 - As one user, create a discussion with lots of posts.
 - As a different user, go to the discussion, see the entries
   are automatically marked as read. Don't scroll all the way
   to the bottom of the discussion so there are still some
   unread posts.
 - Click the gray circle to manually mark some of the read
   entries as unread.
 - Refresh the page. The manually marked entries should show
   as unread and should not be automatically marked as read.
 - Scroll down. Unread entries that were not manually marked as
   unread should still be automatically marked as read.

Change-Id: I963d1dea9fc961a28a0a5c488399d4e3964c8d10
Reviewed-on: https://gerrit.instructure.com/20414
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-05-10 21:45:23 +00:00
Eric Berry ac76eaf598 added auto lock discussions on specified date
fixes CNVS-4106

test steps:
- go to create a discussion topic and ensure that you can toggle between
  the 'Graded' and non-graded availability dates. If the Graded is not
  checked, you should see the Available From/Until.
- create a discussion topic with a past from and past until. ensure that
  the discussion is locked for a student
- create a discussion topic with a future from and future until. ensure
  the discussion cannot be seen by the student
- update the above created discussion topic and switch it to be graded
  and set a future due, from, until date. ensure that the student cannot
  see the discussion.
- edit the discussion and ensure that the graded checkbox is checked and
  the group assignment fields are showing
- update the assignment with a past due, from, until and make sure the
  discussion is locked for the student.
- do all above with current dates (from in past, until in future) and
  make sure the student can see and reply to them.
- create an announcement and ensure that the functionality and forms are
  the same as before
- verify that you are able to lock and unlock discussion topics on the
  show view by using the gear drop-down

Change-Id: I99c9d54763fe3a74aa8a4bb37c22f09d4765d41e
Reviewed-on: https://gerrit.instructure.com/20339
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
2013-05-08 17:49:11 +00:00
Mark Ericksen 51eea02fcb adjust discussion unread and total counts when deleting
fixes CNVS-5480

testing direction:
==================
using both threaded and unthreaded discussions:
* create a discussion using two different users
* create discussion replies (entries) and verify
  the "unread" count correctly changes
* delete an "unread" entry before the other
  user has seen it. verify the unread count is
  correctly updated.
* after deleting entries, verify the "total"
  count is correct on the index and show pages.
* verify that the discussion's list page counts
  match a specific discussion's show page counts

Change-Id: Id29ee1d03a60c6a78565661ee214bf9031fae69c
Reviewed-on: https://gerrit.instructure.com/20201
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-05-02 21:05:39 +00:00
Eric Berry 48ca088666 Locked graded discussions are now visible to students
fixes CNVS-5309

test steps:
- as a teacher, create a few discussion topics with graded
  checked and due, begin and until dates are in the future, past
  and current.
- as a student, view the discussions list and ensure that the
  present and past topics are visible but the future is not.
- click the past discussion topic and make sure you are able to
  view the discussion but not reply to it.
- click the present discussion and make sure that you can reply
  to it.
- as the student and teacher, ensure that the visible discussion
  topics appear in the stream items (dashboard) and the future
  do not (for the student).

Change-Id: Ibb0a3d05ae830e764c8068a6c9d4ead804e91139
Reviewed-on: https://gerrit.instructure.com/20082
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2013-05-02 17:21:31 +00:00
James Williams a2b3c60902 copy discussion_type in course copy
test plan:
* create a discussion topic in a course, checking
 "allow threaded replies"
* copy the course
* the new discussion topic should retain the option

fixes #CNVS-1589

Change-Id: I0a37babac340c1f6ee869e4805217553d954e165
Reviewed-on: https://gerrit.instructure.com/20152
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-04-30 16:33:31 +00:00
Jon Willesen d8efd3e805 improve robustness of incoming message processor
replaced the mailman gem with custom code with more error
handling. this will allow the incoming message processor to
continue processing messages after encountering a message with
an encoding or parsing error. the broken messages will be moved
aside to a separate folder for later inspection.

fixes CNVS-4970

test plan:
 - read up on the new incoming_mail.yml configuration settings.
 - configure incoming_mail.yml with the test imap accounts
   using legacy settings and check for regressions.
 - reconfigure incoming_mail.yml to read from a directory.
 - copy some testing email files into the configured directory.
   test files should be a mix of:
   - emails with encoding errors
   - emails with syntax errors
   - normal emails
 - all of the normal emails should be processed normally
 - all of the error emails should be moved into the error
   subdirectory

Change-Id: I0f946a56b41492f007db2775aa6da3cdfa4fdd3f
Reviewed-on: https://gerrit.instructure.com/19729
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-04-29 14:47:09 +00:00
James Williams 6b3bde6df3 fix and refactor content migration issue messages
test plan:
* import a package containing an item that is
 invalid so it will create a
 "Couldn't import the" item warning, but also
have an extremely long title (~250 characters)
(an example is attached to the ticket)
* confirm that when trying to import,
 the entire migration does not fail silently,
 and thus hang in the import phase,
 but instead creates a proper migration issue
 for the invalid item and continues the import
 normally

fixes #CNVS-5467

Change-Id: I2659ac0c5531ad609f3f58abc1fc0960e9d85c51
Reviewed-on: https://gerrit.instructure.com/19961
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-04-26 21:33:24 +00:00
James Williams 21d1788f22 add migration warnings for missing references in html content
adds migration warnings when links and other references point
to missing or unknown internal content

test plan:
* upload a content migration with missing relative links
 (an example is attached in the ticket)
* import all the content
* view previous migrations for the course
 (at "/courses/:id/imports/list")
* confirm that warning messages are shown
* the ui in in progress, but the warnings should
 have links associated with them that point to the
 content with missing links. to see them, use the
 migration issues API

closes #CNVS-134

Change-Id: I1d0a9217fe0c1678968410be8b2eba5b990b8305
Reviewed-on: https://gerrit.instructure.com/19367
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-04-11 18:28:59 +00:00
Jon Willesen 97e02359b1 When restoring a discussion topic, restore its child topics
fixes CNVS-4954

test plan:
 - create a group discussion topic assignment
 - delete the group discussion topic
 - go to /courses/:id/undelete and restore the topic
 - go back to the topic and verify the linked child topics were
   also restored.

Change-Id: Ia01ce855ff92110c3fb6b227234a42ba8edad5bf
Reviewed-on: https://gerrit.instructure.com/19285
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-04-09 15:05:25 +00:00
Cody Cutrer 8c94e53dc7 arel-ify scopes
s/named_scope/scope/g

refs CNVS-4707

Change-Id: I930d229fc9985c7c0096a0f4888933addd4f3aee
Reviewed-on: https://gerrit.instructure.com/18834
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 21:57:16 +00:00
Cody Cutrer d9111f5414 arel-ify models
closes CNVS-4707

Change-Id: I32c8ec5a53525f89cf232890eaac790fbc2b4744
Reviewed-on: https://gerrit.instructure.com/18745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 18:42:38 +00:00
Jon Jensen 7fe105b278 course setting to prevent students from editing/deleting own posts
fixes CNVS-3178

test plan:
1. as a student, create a discussion topic and a reply
2. as a teacher, uncheck "Let students edit or delete their own discussion
   posts" on the course settings page.
3. as the student, confirm you cannot edit or delete the topic or reply
   that you created
4. as a teacher, recheck the box and save
5. on the discussion index page, confirm the setting is checked in the menu
6. disable it via the menu
7. repeat step 3

Change-Id: Ib7d6ba3604370241de1145aac8e23d35f78591c4
Reviewed-on: https://gerrit.instructure.com/17535
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-02-08 16:11:23 -07:00
Ryan Florence fa3d291cd7 add allow_student_discussion_topics course setting
test plan:

1. log in as a student and go to:
   /courses/:id/discussion_topics/
   - the “start a discussion” button should work
2. open script/console
3. Find a course and change the setting, i.e.:
   c = Course.find(1)
   c.allow_student_discussion_topics = false
   c.save!
4. Log in as a student and go to:
   /courses/:id/discussion_topics/
   - The “start a discussion” button should not
     display

UI coming in a different commit

closes #CNVS-2613

Change-Id: I162b0356f1e23bee2bdb89f7797976bc3bab192d
Reviewed-on: https://gerrit.instructure.com/16674
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-01-11 15:47:21 -07:00
Ethan Vizitei bbda931a4a consider mooc performance
refs #CNVS-1292

Was unable to find any job-per-student
behavior (not to say that we won't ever discover
any), but I did find several instances of loading
full collections into memory
 of student objects or objects
that would be instantiated in the same order of
magnitude as students for a course, and was able
to tweak many of those.  There are undoubtably
more to find.

Change-Id: I044a1d92f90c830b4d1d07f0d4de17a718bcbe55
Reviewed-on: https://gerrit.instructure.com/16030
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2012-12-18 10:38:58 -07:00
Simon Williams dd62ef5805 new dashboard design
the new dashboard design categorizes recent activity into buckets that can be
expanded/collapsed, and inidividual messages can be dismissed.  the categories
are announcements, conversations, discussions and assignments.  this redesign
applies to the homepage dashboard, the group home page, and the course homepage
when "recent activity dashboard" is selected as the course home page type.o

the motiviation is that the dashboard should capture and present in one place
important information happening in all the user's courses or groups, and allow
for jumping into this information to see more details:

- announcements/discussions should show on the dashboard when they are created,
  or when there are root replies to recent announcements
- conversations should show on the dashboard when there is new activity
- assignments should show on the dashboard when they are created, or when
  changes are made at least a couple hours after being created

the presence of a dashboard item means there is activity for that item that may
be of interest to the user.  additionally, the dashboard items will show
read/unread state (excluding assignments) for items which the user has not yet
viewed.

additionally, global messages such as course inivitations, account level
announcements, and new user messages have been restyled, but will keep their
place above the recent activity widget on the dashboard.

test plan:
- visit many exising user's dashboards and make sure they are functional in the
  new style.
- visit canvas as a brand new user (no enrollments), a new user enrolled in
  a new course and make sure the dashboard is restyled and the messaging makes
  sense.
- make an account level announcement and make sure it shows up on user's
  dashboards.
- create all different types of conversations: single, group, bulk private,
  from submission comment, add user to convo, etc. and make sure the
  appropriate dashboard items appear and make sense
- create discussions and announcements, reply to them at the root level and at
  the sub entry level (sub entries will not make new dashboard items), test
  from both a read and unread user's perspective, making sure dashboard items are
  correct. (note that read/unread state will not be correct for existing items
  before this code is applied, but should be correct for future items moving
  forward)
- dismiss dashboard items and account announcements, make sure they stay
  dismissed.
- test creating assignments, waiting > 2 hours, and updating due dates or other
  assignment details. make sure items appear. note that unread state will not
  exist for assignment notifications.

closes #10783
refs #11038
refs #11039

Change-Id: I276a8cb1fae4c8a46425d0a368455e15a0c470c5
Reviewed-on: https://gerrit.instructure.com/14540
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-11 21:56:16 -07:00
Simon Williams f984b9b26b remove announcement/discussion badges from left nav
closes #11452

they were confusing because they represented "never before seen",
but there was no way to filter for them on the discussion/announcement index
page.  grades badges still exist though.

test plan:
- make sure new discussions/announcement don't make badges for other course
  users in the left nav.
- make sure grade badges still work correctly.

Change-Id: I04a3c8d4a0c246be1660201b7e9f7f73c5065ffa
Reviewed-on: https://gerrit.instructure.com/14708
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2012-10-25 17:04:17 -06:00
Mark Ericksen ac9182cf56 Fix deleted admin enrollments enabling student to see discussion topics without a post. Fixes #11192
Fixed the DiscussionTopic#user_ids_who_have_posted_and_admins method to only
look at active admin enrollments. Was picking up the TA's deleted admin enrollment.

Testing Steps:
===========
* Create a course as a teacher and add a TA
* Create a Discussion Topic that requires a user to post before
   seeing other user's responses.
* As a student, add a response
* Verify that the TA can see the other student's response
   without having created a post themselves.
* Remove the TA's enrollment in the course and
   add the TA as a Student.
* As the TA-turned-student, visit the discussion
  and verify that you cannot see the replies
  without first making a post.

Change-Id: I35ed1a6b05128e8e3636574df3779449a5ee3c69
Reviewed-on: https://gerrit.instructure.com/14617
Reviewed-by: Joel Hough <joel@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-23 14:58:02 -06:00
Simon Williams 5ce9fb146e unread badges in left nav
refs #10541

add counts of how many unread discussions and announcements a user has in
a course or group in the left hand nav bar of the course or group, next to the
appropriate navigation link.

these counts are cached in a context/user/content_type join table.
unfortunately, there are situations that can change whether or not a discussion
or announcement is visible to the user (and thus unread) without triggering any
backend action. for example, a post delayed announcement, a locked discussion
assignment, or a discussion with prereqs in a module. because of these types of
situations, the count has to be re-queried every so often, and the time chosen
for this is if it's been stale for 10 minutes.

test plan:
- as a teacher, create some announcements and discussions
- as a student, you should have unread counts in the left nav
- read the announcements and discussions
- the counts should update appropriately
- (see explanation above for the following)
- try post delayed announcements
- try locked discussion assignments
- try discussions locked in a module
- make sure the count badge looks good in all browsers

Change-Id: Ia6428717e91ed389c63ca97a065232dac7121b7e
Reviewed-on: https://gerrit.instructure.com/13926
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-08 11:38:01 -06:00
Jon Willesen c508d0dab0 Email replies to locked topics should be ignored.
fixes #9594

test plan:
 - Configure Canvas to send emails to you.
 - Create a student account and set notifications for annoucements and discussions to "ASAP."
 - Create an annoucement and a discussion and make sure you get the notification emails.
 - Reply to the notification emails and see that the replies get posted as normal.
 - Lock the announcement and discussion.
 - Reply to the emails again and see the replies don't get posted.
 - See that you get an appropriate bounce message.

Change-Id: I4436c61a202d3285ee35a9f9002cefa0f18954fd
Reviewed-on: https://gerrit.instructure.com/13912
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-02 12:57:39 -06:00
Jeremy Stanley d511e04fee modules api, closes #10404
also modifies the discussion topic and assignment API
controllers to make sure "must_view" requirements are
fulfilled

test plan:
 * check the API documentation; ensure it looks okay
 * create a course with module items of each supported type
 * set completion criteria of each supported type
 * create another module, so you can set prerequisites
 * use the list modules API and verify its output matches
   the course and the documentation
   * as a teacher, "state" should be missing
   * as a student, "state" should be "locked", "unlocked",
     "started", or "completed"
 * use the show module API and verify the correct information
   is returned for a single module
 * use the list module items API and verify the output
   * as a teacher, the "completion_requirement" omits the
     "completed" flag
   * as a student, "completed" should be true or false,
     depending on whether the requirement was met
 * use the show module API and verify the correct information
   is returned for a single module item
 * last but not least, verify "must view" requirements can
   be fulfilled through the api_data_endpoints supplied
   for files, pages, discussions, and assignments
   * files are viewed when downloading their content
   * pages are viewed by the show action (where content
     is returned)
   * discussions are viewed when marked read via the
     mark_topic_read or mark_all_read actions
   * assignments are viewed by the show action
     (where description is returned).  they are not viewed
     if the assignment is locked and the user does not
     have access to the content yet.

Change-Id: I0cbbbc542f69215e7b396a501d4d86ff2f76c149
Reviewed-on: https://gerrit.instructure.com/13626
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-09-17 09:30:04 -06:00
Joe Tanner 035ac510bc fix permissions for group discussion attachments, fixes #10241
test plan:
- In a course where "Let Students attach files to Discussion Posts"
  check box is checked (under "more options" when editing course details)
- Create a group and add a student to the group
- Log in as the student and create a new discussion or reply to a discussion
- Click on the choose file button and attach something
- The attachment should be saved
- Also verify that the student doesn't have the option to attach
  a file when the above checkbox is not checked

Change-Id: I56f4e2e29a8350a50a85a926f8ca9493a1c3fd0c
Reviewed-on: https://gerrit.instructure.com/13365
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2012-08-31 17:12:34 -06:00
Joe Tanner 3d62223063 Fix reply count on discussion topics page, fixes #10137
test plan:
- Create a new discussion. Can be threaded or not.
- Post several replies on the discussion, some replying directly to the topic, some replying to the replies.
- Note the number of comments that are direct replies to the main topic.
- Go back to the discussion topics page.
- The number of replies listed should equal the total number of
  replies and sub-replies.

Change-Id: Ie960eb27c96fa319c7c2a914d9ba862e6055e2e9
Reviewed-on: https://gerrit.instructure.com/13263
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-08-30 21:37:24 -06:00
Ryan Shaw bd016f8f49 add order by clause so discussions show up in index page in right order
fixes: #10158

in g/13073 ( 1f4434ccd7 ) i changed the
relation used in discussions#index action
so it only showed discussions OR announcements

but that broke the order in which they show up because
this relation didn't have the order by clause.

test plan:

load discussion/announcement index page
make sure they show up in correct order and don't
see any announcements on the discussions page or
vice versa

Change-Id: Ie499530486df32142f3a41e36f5b3e38d363c77b
Reviewed-on: https://gerrit.instructure.com/13221
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-08-28 15:03:26 -06:00
Cody Cutrer 02d50f181d ignore incoming messages for deleted accounts
test plan:
 * get some notifications for discussions, conversations, etc.
 * delete the root account
 * reply to the notifications via e-mail
 * undelete the root account
 * the replies should not show up

Change-Id: I2afe5de256cbd55ca360a4327150871ea40d7493
Reviewed-on: https://gerrit.instructure.com/12902
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-08-20 14:08:52 -06:00
Jeremy Stanley 5b8524b14a Batch file notifications; closes #9012
Test plan:
(We need two users here because Canvas doesn't notify you about
files you upload yourself.  We'll call them Student and Teacher
here, but they don't actually have to be these things.)

 * As Student, enable notifications for new files in Profile.
 * As Teacher, upload a file.
 * Within an hour or so (everything about notifications occurs
   in low-priority background tasks), Student should receive
   a notification for the file.
 * As Teacher, upload multiple files.
 * Student should eventually receive a notification that
   X number of files were added.

Note that files are batched over a five-minute period; that is,
if a file is added to a course within five minutes of a previous
file, it will be counted in the same batch.

Change-Id: I09b5f497cae1d726b7aaf85824e98e69e45b0c1b
Reviewed-on: https://gerrit.instructure.com/12346
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-07-20 14:45:12 -06:00
Bracken Mosbacker 536b1fc80e better handle nil users on wikis and discussions
Users can validly be nil for wikis/discussions from content
imports. This makes the UI a little nicer for those cases

Test Plan:
 * Import content from a .zip that has wiki pages in it
 * The wiki page history should say Content Importer instead of having no name
 *  The individual revision page should say it was imported at a time

closes #8053

Change-Id: I5e382c3186d439b2e820c4b4c9103566792f4da3
Reviewed-on: https://gerrit.instructure.com/11897
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-07-11 11:06:21 -06:00
Simon Williams 9583fc2126 ensure single group topic for graded discussion; fixes #7834
In a group graded discussion assignment, when creating the child topics for
each group, the new discussion topics were touching their root topics, kicking
off a new job to refresh the subtopics.  This created a race condition where
duplicate subtopics for the group could get created, in addition to a lot of
unnecessary jobs.  This commit moves the touch to only happen when an entry in
a subtopic is updated, tightens up some conditions in the way soft-destroys
cascade between assignment and discussion, and adds a unique index on
context+root_topic to prevent this from happening in the future.

test plan:
- ensure that creating a group discussion assignment still creates all
  necessary sub-topics for the groups
- in a course with many student groups, create a new group discussion
  assignment.
- each group should only have one unique topic for this assignment
- delete a group discussion assignment, it should delete all associated topics
  at the course and group levels
- also try initiating the delete from the root topic. the assignment and sub
  topics should be deleted

Change-Id: I9b0fb79c2c2b3b9512802a781b8ea0f4364af541
Reviewed-on: https://gerrit.instructure.com/11712
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-07-09 10:47:01 -06:00
Brian Palmer 73380d2bc8 allow using an item in modules more than once
closes #8769

An item can be added to multiple modules, or even the same module more
than once. This is especially useful for attachment items, but is also
useful for allowing multiple paths through a course, with say an
assignment in two different modules and the user only has to complete
one of the two modules.

test plan:

For an item in only one module, verify that the module navigation still
appears if you go straight to that item's page, without going through
the modules page.

Add an item to more than one module. If you visit that item from the
modules page, you'll see the right nav depending on which instance of
the item you clicked on. If you visit the item directly without going
through the modules page, you'll see no nav.

Lock one instance of the item by adding a prerequisite, but leave the
other unlocked. You can still see the item as a student.

Lock all instances of the item with prerequisites. The item will now be
locked and you can't see it as a student.

Add completion requirements to the item, such as a minimum score on a
quiz. Make the requirements different -- 3 points in one instance and 5
in the other, for instance. Verify that if you get 3 points on the quiz,
one item is marked as completed but the other isn't, as expected.

Rename the item. Verify that all instances of it in modules get renamed.

Change-Id: I4f1b2f6f033062ec47ac34fe5eb973a950c17b0c
Reviewed-on: https://gerrit.instructure.com/11671
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-06-21 10:12:22 -06:00
Zach Wily 37953343cd add a DiscussionTopic to CollectionItems in the API
To allow commenting on CollectionItems, we are goign to leverage
DiscussionTopics. The topic will not be created until the first comment is
made, and is accessed via the normal DiscussionTopic API (using a special
endpoint).

This also adds a new "flat" DiscussionTopic type, which doesn't support any
nesting of replies.

test plan:
 * Create a collection and an item in that collection (via console or API)
 * Using the API, query the discussion topic for that item via the API
 * Using the APi, add a comment to that discussion topic
 * Using the API, fetch the discussion again and see that your comment appears

Change-Id: Ie7cc27a7bc1d7960040632015971e59f084d7e6f
Reviewed-on: https://gerrit.instructure.com/10960
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-29 13:58:42 -06:00
Jeremy Stanley 5fe80dc7f8 include DiscussionTopic#threaded in JSON sent to browser
fixes #8107

the change made here
https://gerrit.instructure.com/#/c/9647/6/app/views/shared/_topic.html.erb

did not handle the case where topics are loaded dynamically by
jquery.pageless (scrolling down).

test plan:
 - have more discussions than will fit on the page (> 10)
 - scroll down until new discussions load
 - edit one and check "this is a threaded discussion", then save
 - reload the discussion page
 - scroll down until the formerly edited discussion reloads
 - click "edit" and verify the threaded checkbox is still set

Change-Id: If22933f976820ebedbe979ed06a7ff96bdac3cb4
Reviewed-on: https://gerrit.instructure.com/10285
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-05-23 16:42:02 -06:00
Brian Palmer debf149439 create discussion topic api, closes #8151
Create a discussion topic with support for most of the options -- the
only thing missing is the ability to create an assignment discussion,
that will be added to the assignment create api.

You can also create an assignment linked to the discussion at the same
time you create the discussion. I refactored the assignment api
functionality to support this.

Added a topic delete API as well.

Also fix a bug where we weren't properly validating discussion_type

test plan: hit the api and exercise the various options, such as delayed
posting and require first posting.

Change-Id: I4afdd20313b5cea3ab7b05bf1c005c9f55debe7b
Reviewed-on: https://gerrit.instructure.com/10912
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2012-05-23 15:54:58 -06:00
Cody Cutrer 0c004fcf64 prepare for foreign keys refs #6895
* add the foreigner gem so plugins can begin adding foreign keys
   immediately
 * add an extension to do less locking when creating foreign keys
   on postgres 9.1+
 * fix a few pieces of code that either don't properly clean up
   foreign dependencies, or create objects in the wrong order
   to maintain referential integrity
 * change the specs to truncate all tables in a single command
   for postgres (to avoid referential integrity errors; also
   slightly faster)

test plan:
  * no user visible functionality should change

Change-Id: I185e478b99fbe598d408912053c34a064aa9c461
Reviewed-on: https://gerrit.instructure.com/10580
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-10 09:46:05 -06:00
Cody Cutrer b92c17f11d don't infer the current user for nil DiscussionTopic#user in the stream
fixes #8403

test plan:
 * import an external content package with discussion topics
 * make sure to find a discussion topic that has no author
 * on the dashboard of a user that has a stream item about that topic
   it should not show that the current user is the author

Change-Id: I681be31462a82591d60665dce967aa1548ef3a07
Reviewed-on: https://gerrit.instructure.com/10579
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-05-08 12:55:24 -06:00
Bracken Mosbacker ce12af199d undelete course objects on course copy
If you copied content into your course, then deleted an item
and copied it again it wouldn't be active. It is now.

Test Plan:
 * Create an assignment
 * Copy the course and delete the assignment in the new course
 * Copy the original course into the new one again
 * The assignment should be active

closes #8298

Change-Id: Ief8476d2befff999ed85a35039604d34253bfa1f
Reviewed-on: https://gerrit.instructure.com/10487
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-07 09:24:14 -06:00
Jeremy Stanley 69aefd22a2 don't rename assignment to match subtopic; fixes #7357
test plan:
 * create a discussion assignment
 * edit the assignment, changing its name and making it
   a group assignment
 * ensure, after saving the assignment, that its name is not
   appended with a group name

Change-Id: I87806eba91888680c153c551a21d3829b3fe26e8
Reviewed-on: https://gerrit.instructure.com/10388
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-01 16:06:15 -06:00
Simon Williams e4e34ca31d ensure atom feeds have absolute urls and authors; fixes #7047
named_context_url wasn't always giving back absolute urls where it needed to
for atom feeds. additionally, some atom entries did not author entries which
are needed when the main feed does not have an author entry.

test-plan:
- view a modified atom feed in the browser and make sure all links are absolute
  and all entries have an author.
- if the url is externally available, run it through http://feedvalidator.org/
  and check that it validates.

Change-Id: I9bc2b99cd15ed5677bfd9d2cb977a29568ae4016
Reviewed-on: https://gerrit.instructure.com/9833
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-09 09:02:56 -06:00
Bracken Mosbacker 961aad6d3b properly handle selective external migration imports
The selective imports mostly worked before, but if a
given section was completely unchecked the previous
code would import it anyway. This fixes that and makes all
the decision code in one place and easy to test.

Test Plan:
 * Import a content package and only choose certain items
 * Only the items you chose should be imported

closes #5528

Change-Id: Ia6c0c1f5f9a44497053733101140cc74d6239129
Reviewed-on: https://gerrit.instructure.com/9799
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-04 12:25:29 -06:00
Brian Palmer 9e93e80a1d update the topic materialized view after the entry save transaction commits
Fixes a race condition where the view might get generated by the job
without the new entry.

test plan: this is difficult to duplicate by hand, but you could put a
breakpoint in and verify the job doesn't get inserted before the
transaction commits.

Change-Id: I6c373553dfae409adab25dd9e3bafc7126169231
Reviewed-on: https://gerrit.instructure.com/9710
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-02 09:06:47 -06:00
Brian Palmer a2818dd9ea optionally include entries not in the view yet in /view response
consumers can use this to update the view client-side and ensure it's
always up-to-date even if the view is behind.

Change-Id: I1ff0cd80a758a113f8881ef74de78cc28e2fa16b
Reviewed-on: https://gerrit.instructure.com/9717
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-03-30 15:33:54 -06:00
Brian Palmer 409f78de9a return discussion_type in topics api response
We changed the threaded boolean to a discussion_type string, with
currently two types: 'side_comment' and 'threaded'

test plan: get the list of topics in the api, verify threaded is
returned appropriately.

Change-Id: Id5bfb867329d93fe8be6131e2e7c401f70ced290
Reviewed-on: https://gerrit.instructure.com/9647
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-28 14:13:09 -06:00