bugSavane - Bugs: bug #314, global notification settings...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #314: global notification settings cancel notification

Submitted by:  Sylvain Beucler <beuc>
Submitted on:  Fri 26 Mar 2004 07:15:49 AM UTC  
 
Category: Web FrontendStatus: Fixed
Severity: 1 - WishPriority: C - Normal
Assigned to: Mathieu Roy <yeupou>Open/Closed: Closed
Release: Planned Release: 1.0.2
Reproducibility: NonePrivacy: Public

Mon 29 Mar 2004 08:27:54 AM UTC, comment #5:

Hi,

Although I don't claim this piece of code is a model of
programming, I don't quite understand the real/potential
bug you found in it.
Here is the logic:
$notif_scope holds the value of the radio button displayed
on the Administration/Email Notification Settings form
It can have three on only three values:
'global', 'category', 'both'

The variable $notif_value holds the numeric equivalent of
the radio button string value and actually is the value
which is kept in the 'tracker_name'._glnotif field of the
'groups' table.

Now for what concerns the few lines you found confusing/buggy:
if ($notif_scope != "global") {
if ($notif_scope == "category") {
$notif_value = 0;
}
if ($notif_scope == "both") {
$notif_value = 2;
}
} else {
$notif_value = 1;
}

it is just an if statement with an other two ifs in the 'if' block:
In other words:
IF $notif_scope is NOT EQUAL to 'global',
we check consecutively if is EQUAL to either 'category' or 'both'
and set $notif_value accordingly
ELSE (meaning it is EQUAL to 'global')
we set $notif value = to 1

Maybe this way of coding without using a suite of if elseif elseif
might be confusing to you. It is just that personally I am more
at ease with the way I coded it.
Now if there is a fundamental logic error in it please let me know
and we will fix it.

For what concerns checking whether a notification e-mail address is set
this is done in the function: trackers_data_get_item_notification_info
in the same file data.php when building the appropriate list of people
to be notified depending on the tracker settings and the item category.
In my opinion the type of notification to be done (global/category/both)
has to be kept separately from the fact corresponding email addresses
have been defined or not. It is the piece of code which build the
mail recipients list to check these various piece of information and
act accordingly.

I hope these few lines of explanation will help understanding.
I imagine this was triggered by observing that tracker notification
was not done properly in certain cases.
- Was this before or after the bug fix [bug #273] I uploaded in the repository?
- Was that fix put online?
Cheers,
Yves

Yves Perrin <ype>
Project Administrator
Sat 27 Mar 2004 10:41:40 AM UTC, comment #4:

You are right, but I do not now the specific enough to explain this code. Maybe Yves could help.

Mathieu Roy <yeupou>
Project AdministratorIn charge of this item.
Sat 27 Mar 2004 09:58:51 AM UTC, comment #3:

if ($notif_scope == "category") {
$notif_value = 0;
}
elseif ($notif_scope == "both") {
$notif_value = 2;
}
else { // $notif_scope == "global" or empty... or any other value
$notif_value = 1;
}

would be more concise.

It is a bit strange that $notif_scope can be empty or "global". I should test in which case $notif_scope is set to those values.

Sylvain Beucler <beuc>
Project Administrator
Fri 26 Mar 2004 05:40:07 PM UTC, comment #2:

Hum, the else should be reached if $notif_scope == global. I do not remember at all the specifics of that issue, but it does make sense to me to have this ending else.

However, if I correctly understood what you mean, considering we are in the global notif scope, we should get the value set to 1 if we are not in "category" or "both" case.

So in the end, it would looks like :

if ($notif_scope != "global")
{
if ($notif_scope == "category")
{ $notif_value = 0; }
if ($notif_scope == "both")
{ $notif_value = 2; }
else { $notif_value = 1; }
}
else
{ $notif_value = 1; }

Tell me if you think I'm wrong on that.

Mathieu Roy <yeupou>
Project AdministratorIn charge of this item.
Fri 26 Mar 2004 07:19:26 AM UTC, comment #1:

Sorry, I meant:
if ($notif_scope != "global") {
if ($notif_scope == "category") {
$notif_value = 0;
}
elseif ($notif_scope == "both") {
$notif_value = 2;
}
else {
$notif_value = 1;
}
}

Sylvain Beucler <beuc>
Project Administrator
Fri 26 Mar 2004 07:15:49 AM UTC, original submission:

In www/include/trackers/data.php:
if ($notif_scope != "global") {
if ($notif_scope == "category") {
$notif_value = 0;
}
if ($notif_scope == "both") {
$notif_value = 2;
}
} else {
$notif_value = 1;
}

should be
if ($notif_scope != "global") {
if ($notif_scope == "category") {
$notif_value = 0;
}
if ($notif_scope == "both") {
$notif_value = 2;
}
else {
$notif_value = 1;
}
}

In the first version, the 'else' part is never reached, and causes projects with global notification settings to have their _glnotif field at 0 in the database, preventing tracker notification.

It is still not perfect because it does not check whether a notification e-mail address is set (otherwise it should stay at 0), but at least it works :)

Sylvain Beucler <beuc>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one

Digest:
   task dependencies.

 

Carbon-Copy List
  • -unavailable- added by ype (Posted a comment)
  • -unavailable- added by yeupou (usually works on the notification stuff)
  • -unavailable- added by yeupou (Updated the item)
  • -unavailable- added by beuc (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 26 Mar 2004 05:40:07 PM UTCyeupouStatusNone=>Fixed
      Assigned toNone=>yeupou
      Open/ClosedOpen=>Closed
      Carbon-Copy-=>Added ype
    Fri 26 Mar 2004 05:20:47 PM UTCyeupouPlanned Release=>1.0.2
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup