Added `SubscriptionModule` to handle subscriptions views: * Inject a (disabled) button into `changeset`, `browser`, and `attachment` pages. * Handle `GET`, `POST`, and `PUT` requests for subscriptions, accepting and returning only JSON content Added `Subscription.for_request()` to get or create a subscription from a request. Added Backbone `Subscription` model and `SubscriptionView` view to handle UI interaction. Modified email template to let users know how to unsubscribe.
If they’re at the top and somebody goes to the page just to look at the file and not at the comments, a huge discussion at the top can be very distracting. We assume that people will go to pages more often to see the files/diffs/commits than to look at comments.
Re-capitalise SQL keywords. Improve `Subscription.select()` to handle `unicode` values. Add `Susbcription.__str__()` to provide a string represention of a subscription. Refactor `Subscription._from_dict()` method to use `select()` as a single source for select queries and `__str__()` to improve logging.
Added a `for_comment` query helper. Changed the notification scheme so that resource authors **always** receive a "to" notification. Changed the `notify` column to be a boolean. Changed the `for_*` signatures to accept an optional `notify` flag. Changed the `select` signature to accept an optional `notify` flag, and the method to include the flag in the query. Changed the `select` method to handle `dict`, `list, and `bool` query arguments.
Added `select`, `update`, and `delete` methods to `Subscription` to handle all CRUD operations. Changed the signatures on `from_attachment`, `from_changeset`, and `from_comment` to let the `user`, `role`, and `notify` values be overridden. Added `for_attachment` and `for_changeset` methods to shortcut queries for those resource types. Added `attachment_deleted`, `attachment_reparented`, and `changeset_modified` event handlers.
Circular dependencies prevented the database upgrade from _nicely_ handling the creation of subscriptions for existing resources, so all logic and code has been moved to a new `subscription` module. Various routines for creating subscriptions have been extracted into standalone methods, and the code refactored to use objects instead of direct database queries.
No more swapping around of config values.