Fixed regexp in Action/Notify.pm

[cross-post from rt-users follows]

Dan Fulbright (on rt-users) wrote:

When I “Take” a ticket, I get an e-mail that says, for example:

Transaction: Given to supportguy by supportguy

The problem is, I’m supportguy, so I know I just gave the ticket to
myself. I have this variable unchanged from the default:

Set($NotifyActor, 0);

OK, I figured this one out on my own, based on something I found on the
rt-devel list. My e-mail address has a + (plus sign) in it. That messed
up the regular expressions in lib/RT/Action/Notify.pm:

  if ($RT::NotifyActor) {
      @{ $self->{'To'} }  = @To;
      @{ $self->{'Cc'} }  = @Cc;
      @{ $self->{'Bcc'} } = @Bcc;
  }
  else {
      @{ $self->{'To'} }  = grep ( !/^$creator$/, @To );
      @{ $self->{'Cc'} }  = grep ( !/^$creator$/, @Cc );
      @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc );
  }

I fixed this by changing the quoting $creator in the regexps with \Q:

      @{ $self->{'To'} }  = grep ( !/^\Q$creator\E$/, @To );
      @{ $self->{'Cc'} }  = grep ( !/^\Q$creator\E$/, @Cc );
      @{ $self->{'Bcc'} } = grep ( !/^\Q$creator\E$/, @Bcc );

I’m cross-posting this to the devel list, so someone can tell me if I
did something I shouldn’t have.

I’m using RT 3.4.1.

–df

Dan Fulbright wrote:

[cross-post from rt-users follows]

Dan Fulbright (on rt-users) wrote:

When I “Take” a ticket, I get an e-mail that says, for example:

Transaction: Given to supportguy by supportguy

The problem is, I’m supportguy, so I know I just gave the ticket to
myself. I have this variable unchanged from the default:

Set($NotifyActor, 0);

OK, I figured this one out on my own, based on something I found on the
rt-devel list. My e-mail address has a + (plus sign) in it. That messed
up the regular expressions in lib/RT/Action/Notify.pm:

 if ($RT::NotifyActor) {
     @{ $self->{'To'} }  = @To;
     @{ $self->{'Cc'} }  = @Cc;
     @{ $self->{'Bcc'} } = @Bcc;
 }
 else {
     @{ $self->{'To'} }  = grep ( !/^$creator$/, @To );
     @{ $self->{'Cc'} }  = grep ( !/^$creator$/, @Cc );
     @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc );
 }

I fixed this by changing the quoting $creator in the regexps with \Q:

     @{ $self->{'To'} }  = grep ( !/^\Q$creator\E$/, @To );
     @{ $self->{'Cc'} }  = grep ( !/^\Q$creator\E$/, @Cc );
     @{ $self->{'Bcc'} } = grep ( !/^\Q$creator\E$/, @Bcc );

I’m cross-posting this to the devel list, so someone can tell me if I
did something I shouldn’t have.
Yes. You’ve done right thing. this have to be commited into mainline.

I’m cross-posting this to the devel list, so someone can tell me if I
did something I shouldn’t have.
Yes. You’ve done right thing. this have to be commited into mainline.

Yes. A variant of the patch and patches for similar behaviour elsewhere
have been committed to RT 3.2. They’ll be merged forward into 3.4 and
beyond.