Forum OpenACS Development: Notifications reply Loop problems

Collapse
Posted by Eduardo Santos on
Hi everybody,

For a long time we have been living with the automatic replies problem in forums. A lot of users have them and, even with the procmail filters for the messages, we just can't find out everything they put in their messages. It generated a loop problem in this way:

1 - The user receives a forum notification in its email;
2 - There's an auto reply message, wich gets inserted into forums;
3 - This auto reply message creates another forum message;
4 - This message generates another notification that goes to user email;
5 - The user email generates another auto reply;
6 - The auto reply goes to the forum again.

This loop problem already generated 1.613.000 messages in my system. In order to fix this, we had one idea: don't send the notification to the user that created the object. In that way, even if the auto reply is not filtered by procmail, it'll happen only once. From this, we've created the following patch:

Index: trunk/packages/notifications/tcl/sweep-procs-postgresql.xql
===================================================================
--- trunk/packages/notifications/tcl/sweep-procs-postgresql.xql (revision 667)
+++ trunk/packages/notifications/tcl/sweep-procs-postgresql.xql (revision 769)
@@ -11,7 +11,8 @@
            select distinct notification_id
            from notifications inner join notification_requests using (type_id, object_id)
-            inner join acs_objects on (notification_requests.request_id = acs_objects.object_id)
+              inner join acs_objects o1 on (notification_requests.request_id = o1.object_id)
+              inner join acs_objects o2 on (notifications.response_id = o2.object_id and o2.creation_user <> notification_requests.user_id)
              left outer join notification_user_map using (notification_id, user_id)
-          where sent_date is null and creation_date <= notif_date
+          where sent_date is null and o1.creation_date <= notif_date
        </querytext>
    </fullquery>
@@ -27,12 +28,13 @@
                    type_id,
                    delivery_method_id,
-          response_id,
-          notif_date,
+                  response_id,
+                  notif_date,
                    notif_user
            from notifications inner join notification_requests using (type_id, object_id)
-              inner join acs_objects on (notification_requests.request_id = acs_objects.object_id)
+              inner join acs_objects o1 on (notification_requests.request_id = o1.object_id)
+              inner join acs_objects o2 on (notifications.response_id = o2.object_id and o2.creation_user <> notification_requests.user_id)
              left outer join notification_user_map using (notification_id, user_id)
            where sent_date is null
-              and creation_date <= notif_date
+              and o1.creation_date <= notif_date
              and notif_date < current_timestamp
              and interval_id = :interval_id

I guess it's going to be usefull if somebody has the same problem.

Collapse
Posted by Dave Bauer on
Has anyone else reviewed this? It looks like it should work ok.

One questions is if user is expecting to see the email for a normal message that is not an auto reply, they will be confused when it does not appear and may ask questions or cause support issues.