User and site-wide default notification send intervals can get "orphaned"

David_Rothstein - June 6, 2009 - 01:46
Project:Notifications
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I came across an interesting bug which occurs in both the D5 and D6 versions of the module. In D5 it's particularly bad because it can cause users to unknowingly set their default send interval to "never" and thereby not actually be subscribed to posts they intended to subscribe to...

The bug occurs when you configure the possible send intervals at ?q=admin/messaging/notifications/intervals. You have total freedom to change/remove intervals, etc., and this includes removing or changing values that may have already been saved elsewhere in the database. Example: You once had a "once per hour" send interval which some users saved as their personal preference on their account page, leading '3600' to be stored with their user account. Later, you go and delete or edit that send interval, so '3600' is no longer an option. When this happens, the select box for the default notification interval on the user edit page or on ?q=admin/messaging/notifications will not get its default value of '3600' correctly set, so it will default to the first selection. If the user then saves their "my account" page, this incorrect selection will (unknowingly, unless they are paying very careful attention) get saved to the database.

In D5 it's especially bad because "Never" is the first send interval in the list, so users wind up accidentally configuring their account to never actually be able to subscribe to posts.

I'm not entirely sure the best way to fix this bug, unfortunately - it's a tricky problem... Possibly there should be code that catches this possibility and warns the user that their chosen send interval is no longer allowed and they have to choose a new one? (Perhaps also a warning message on the administrator screen so that site admins know about this possibility and are careful editing the allowed intervals when the module is already being used.)

#1

David_Rothstein - June 6, 2009 - 01:54

The patch I posted at #483490: Move the "Never" send interval option to the bottom of the select list is a way to mitigate the effects of this bug in D5, although it's really a separate issue and not an actual solution to the bug, just a workaround. But I think it qualifies as a usability improvement anyway :)

#2

David_Rothstein - June 10, 2009 - 18:56

At the other issue, Jose Reyero suggested what might be a simpler workaround for people experiencing the worst effects of this bug, especially on an existing D5 site:

I'd advise to just drop the "Never" send interval. Then do some table update in your subscriptions

UPDATE notifications SET send_interval = 0 WHERE send_interval = -1;

This will transform all existing subscriptions with a "Never" interval to "Immediately", and then since Never is no longer an option it prevents the worst part of the bug from occurring again. (It does assume that all historical "Never" subscriptions for users on the site were set accidentally, though - since it removes all of them, even intentionally-set ones.)

#3

Jose Reyero - November 12, 2009 - 19:25
Status:active» fixed

Orphaned subscriptions now updated to 'default' interval. Not perfect but certainly an improvement.

Hope you like it :-)

Btw, that 'useful queries' could be added to the handbook.

And before you ask, nope, it won't be backported to 5.x

#4

System Message - November 26, 2009 - 19:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.