Forum OpenACS Development: Supporting General Comment notifications

Here is a proposal for a simple way to support notifying on addition of comments.

We need a callback that looks like this

ad_proc -callback general_comments::notify_objects {
} {
What object_ids should have notifications triggered when
a comment is added?

@return list of object_ids to send notifications on
} -

So when a comment is added this callback is called. Implementations should be named after the object_type of the object_id that is being commented on.

General comments will then call notification::new for each of those object_ids.

In this case the text of the email is in the general comments package.

----

An alternative would be to delegate the sending of notificaitons to the callback itself. In this case:

ad_proc -callback genearl_comments::object_notifications -object_id
} {
@param object_id Object id of object receving comment
}

The implementation will still be named after the object type of the object_id that is being commented on.

In this case the text of the notification and what objects will be notified is determined in the callback. The callback is also responsible to call notification::new.

Any other ideas?

Collapse
Posted by Malte Sussdorff on
We are having exactly the same issue with incoming emails. Should we have a callback implementation within each package that recieves e-mail or have one call with the object_id and then the procedure called will find out the object_type and call only the callback's implementation for the object_type.

I think we are going to follow you first approach (call the implementation directly).