blob: 5f893ea6c587314b1f8cddade54c344808c554a3 [file]
#summary 'Sandworm' Newsfeed Module
#labels Importance-Useful,Phase-Requirements,Contents-Draft
[http://github.com/jamslevy/Melange/tree/master Source Code Repository]
= Introduction =
A framework for customizable news feeds for various entity kinds that can be formatted on various site pages. Each newsfeed includes a subscription link, and through a 'subscribe' url pattern is used to render XML feeds.
Because of the relatively simple nature of the initial project, some of the post-midterm development will include an auxiliary open source pubsub component meant to be deployed separately, and act as a hub allowing Melange instances to host chat, Google Wave updates, and other real-time activity.
= Model =
An individual FeedItem entity is created for each news feed update. A garbage collection task will delete old feed items, so they don't take over the datastore.
The FeedItem model contains the following properties:
* *sender* (db.Key)
* *receivers* (db.KeyList)
* *update_type* (created, deleted, modified)
* *created* (datetime)
The sender is the entity that was updated, and the receiver is the owner of the news feed that is being updated.
= Logic =
Newsfeed logic consists of two methods:
* *addToFeed* takes a sender entity, a list of receiver entities, an update type, and an optional payload (like a text preview of a document). It adds all the receivers to a FeedItem with the specified payload.
* *retrieveFeed* takes a receiever entity, and retrieves it's latest news feed updates, with an optional count kwarg. This method is cached, with a cache handler in the /cache folder.
= Views =
The newsfeed view is very simple at the moment, although the placement of the newsfeed template component in multiple templates seems to violate DRY. The newsfeed template itself is simply a table modeled after the blog template that lists each news feed update, which is added to the context dict through the retrieveFeed method.
= Subscription =
I've added a new url_path 'subscribe', so that a URL for requesting an ATOM feed would look like this:
http://melange.appspot.com/site/subscribe/somesite
This address is added to pages with a meta tag:
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ feed_url }}"/>
There is also a graphic subscribe icon on the corner of the newsfeed GUI module.
The 'subscribe' path will also be the interface for any PubSub interactions, but those will only be activated on POST requests with a callback URL, otherwise the ATOM feed will be returned as normal.
= Requirements =
** Before I continue to develop detailed specs and continue coding, I'd like to get some feedback about what Melange users would like to see from a news feed. Specifically, the following types of feedback:
* Which entity types would you most like to have a newsfeed (for instance, programs, organizations, clubs, users, etc.)
* What's more important to you - having the news feed contain detailed information about updates, or having an easy way to export the newsfeed to an external feed reader?
* Are there any things you'd like to see in a news feed aside from updates about recently updated entities?
= TODO Items =
* Feed Items should be created through Task API.
Update: working fix in my latest changeset.
* A better way or UI to program news feed rules.
There are two ways that This can either be done from the publishing end, such as the org admin deciding top-down that only featured documents will be added to the news feed, or it can be done from the subscription end and unique feeds could be generated. This unique feed would require an addition model and datastore hits.
* E-mail notifications (news feed subscription via e-mail)
This should be fairly straightforward to accomplish using the mail API.
* Limitations to Feed Item Senders
Right now, News Feed logic only applies to entities subclassed from the Work model. This is just so they can properly formatted in the news feed template. Investigate and implement to make the template more generic.