Summary | Change notifications are not sent to owner |
Queue | Kronolith |
Queue Version | 2.2 |
Type | Bug |
State | No Feedback |
Priority | 1. Low |
Owners | |
Requester | mail (at) pop2wap (dot) net |
Created | 04/28/2009 (5910 days ago) |
Due | |
Updated | 05/12/2010 (5531 days ago) |
Assigned | 04/29/2009 (5909 days ago) |
Resolved | 05/26/2009 (5882 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
corresponding feature in nag is working.
sendNotification() to "empty()" instead? This would continue to check
the different modes, even if an earlier mode returned false.
like you do, the user would get a notification if he is the owner of
a calendar even if he doesn't show the calendar and has set in his
preference that he only want to be notified about displayed calendars.
for 'display_cals' pref. However, one would need to pass the third
parameter to the method to make it actually work. It is easy to
confuse $mode with the 'event_notification' pref.
But let's go through all possible cases:
Case 1: $mode == 'owner'
The user $user is the owner of the current callendar.
We should send the owner a notification when his event_notification
pref is set to 'owner'. But also, when it is set to 'read' and we
should do the show check when it is set to 'show'. If we don't do it,
the first call with $mode == 'owner' will return false, resulting in
isset(recipients[$user]) later in sendNotification(). This means that
_notificationPref() will not be called for this user again and the
user won't get a notification for his own calendar he has read access
to.
Case 2: $mode == 'read'
In case the 'event_notification' pref is set to owner, we need to
return "false" because the owner of the calendar has been alread
handled with the first invocation of _notificationPref() and it is not
called for a user twice. Therefore, the user cannot be the owner. For
'event_notification' being equal to 'read' return $vals and for 'show'
do the check.
------
The easiest solution is to remove the check for $mode in case
'event_notification' is 'read' and return $vals unconditionally. Also
remove the check in the 'show' case, but of course leave the
display_cals check intact. For this to work with $mode == 'owner', we
also need to modify the first call in sendNotification to also include
$calendar as third parameter.
Thus, the switch should be
switch ($prefs->getValue('event_notification')) {
case 'owner':
// do not notify unless owner
return $mode == 'owner' ? $vals : false;
case 'read':
// notify about changes in all calendars user has read
access to which is
// true for all users this method is called for (see
sendNotification)
return $vals;
case 'show':
// notify about changes in shown calendars only.
$display_calendars =
unserialize($prefs->getValue('display_cals'));
return in_array($calendar, $display_calendars) ? $vals : false;
}
and the call in sendNotification
$recipients[$owner] = Kronolith::_notificationPref($owner,
'owner', $calendar);
The above is true under the assumption that the owner has always read
access to his own calendars.
State ⇒ Feedback
you do, the user would get a notification if he is the owner of a
calendar even if he doesn't show the calendar and has set in his
preference that he only want to be notified about displayed calendars.
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Change notifications are not sent to owner
Queue ⇒ Kronolith
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
in the Kronolith options, when I set the option labeled with "Choose
if you want to be notified of new, edited, and deleted events by
email" to "On all shown calendars" or to "On all calendars I have read
access to", I'd expect to be notified when new events are created in a
calendar that I own myself. Unfortunately, this is not the case.
The cause for this is that some tests are wrong in the switch clause
in Kronolith.php:_notificationPref(...):
switch ($prefs->getValue('event_notification')) {
case 'owner':
return $mode == 'owner' ? $vals : false;
case 'read':
return $mode == 'read' ? $vals : false;
case 'show':
if ($mode == 'read') {
$display_calendars =
unserialize($prefs->getValue('display_cals'));
return in_array($calendar, $display_calendars) ?
$vals : false;
}
}
In cases 'read' and 'show', $mode should also be allowed to be 'owner'.