Commit Graph

2 Commits

Author SHA1 Message Date
Brian Palmer 8a7098b260 discussion topics materialized view api, refs #7567
This is a specialized, optimized view of the entire discussion,
including a nested view on all the entries and participants, and the
current user's unread entry list.

An upcoming commit will cache these views to the database, and generate
them asynchronously, rather than in-request.

test plan: No UI yet. GET /api/v1/courses/X/discussion_topics/Y/view ,
and verify the formatting of the response, including the nesting of
arbitrarily nested discussion entires (also only creatable via the api,
right now). verify that deleted entries are returned, but without a
user_id or summary and with a deleted flag.

Change-Id: Ib7332743f92cca40cc2a861973bf492b1f294a02
Reviewed-on: https://gerrit.instructure.com/9305
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-03-22 12:49:49 -06:00
Simon Williams 258e6b36f3 read/unread state + counts for discussions; closes #7173
the backend for tracking read/unread state of discussion entries/topics and
unread counts for discussion topics. the strategy is to assume that an entry is
unread unless there is an an entry in the join table indicating otherwise.

interface:
- DiscussionEntry has #read_state, #read?, and #unread?. You can use these
  either by passing in a user directly, or by setting the current_user
  attribute on the object before calling the method (useful for json). This
  should already be handled for existing controllers.
- DiscussionTopic read_state functionality as above, plus #unread_count. Same
  general idea with current_user as above.
- routes are setup through the api, use PUT to mark read, DELETE to mark
  unread, or rails helpers like course_discussion_topic_mark_read_path

test plan:
- click through discussion pages, and make sure they all still work (no visible
  changes though, this is backend only)
- manually call some of the above methods from the console
- make sure sql for updates is reasonable

Change-Id: I655ab6a69a8cbdf1c7c99a5548b8ed0d7eadba02
Reviewed-on: https://gerrit.instructure.com/8671
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-02-24 13:34:54 -07:00