Open jonjmz opened 10 years ago
We might use a subscription
table with the following fields:
unsigned bigint id
, because Cake conventions.unsigned bigint user_id
, references ID of user who hasMany subscription.unsigned bigint project_id
, references ID of project who hasMany subscription.boolean receive_update_email
, if the user should receive emails when the project is updated.boolean receive_update_sms
, if the user should receive sms messages when the project is updated.boolean receive_comment_email
, if the user should receive emails when there is a new comment on the project.boolean receive_comment_sms
, if the user should receive sms messages when there is a new comment on the project.However, we do already have a join table that creates a hasAndBelongsToMany relationship between users and projects. That is already technically sufficient for "subscribing" (actually "joining", and then just sending update messages to all users who have joined the project).
The benefit that a subscriptions
table offers is the ability to control whether you receive certain types of messages for certain projects. The disadvantage is that it offers an extra level of complexity to the application; users "join" a project, but does that mean they are automatically "subscribed" to it as well? (I'd say that initially they are, but they can unsubscribe after they join it.)
Users could also subscribe to a project that they have not joined.
Because adding a subscriptions
table adds an extra level of complexity to the application, it might be better to first implement a "Join Project" button, and then email updates to any joined users if they have receiveemail
or receivesms
set to true; then later (maybe very soon) we can implement actual subscriptions.
Ability to subscribe and unsubscribe implemented; needs a place to set preferences for subscriptions, and an ability to send subscription messages when updating a project page.
UsersController
.