[Rt-commit] r13413 - rt/3.8/trunk/lib/RT/Interface
ruz at bestpractical.com
ruz at bestpractical.com
Wed Jun 18 23:09:25 EDT 2008
Author: ruz
Date: Wed Jun 18 23:09:24 2008
New Revision: 13413
Modified:
rt/3.8/trunk/lib/RT/Interface/Web.pm
Log:
* handle better empty content when type is text/html
* <br /> can be <br type="_moz" />
Modified: rt/3.8/trunk/lib/RT/Interface/Web.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Interface/Web.pm (original)
+++ rt/3.8/trunk/lib/RT/Interface/Web.pm Wed Jun 18 23:09:24 2008
@@ -562,34 +562,36 @@
delete $args{ARGSRef}->{'UpdateAttachments'};
}
- return () unless $args{ARGSRef}->{'UpdateTimeWorked'}
- || $args{ARGSRef}->{'UpdateAttachments'}
- || defined $args{ARGSRef}->{'UpdateContent'};
+ if ( defined $args{ARGSRef}->{'UpdateContent'} ) {
+ #Make the update content have no 'weird' newlines in it
+ $args{ARGSRef}->{'UpdateContent'} =~ s/\r+\n/\n/g;
+
+ #filter empty content when type is text/html
+ $args{ARGSRef}->{'UpdateContent'} = ''
+ if ($args{ARGSRef}->{'UpdateContentType'}||'') eq "text/html"
+ && $args{ARGSRef}->{'UpdateContent'} =~ m{^\s*(?:<br[^>]*/?>)*\s*$}s;
+
+ # skip updates if the content contains only user's signature
+ # and we don't update other fields
+ if ( $args{'SkipSignatureOnly'} ) {
+ my $sig = $args{'TicketObj'}->CurrentUser->UserObj->Signature || '';
+ $sig =~ s/^\s*|\s*$//g;
- #Make the update content have no 'weird' newlines in it
- $args{ARGSRef}->{'UpdateContent'} =~ s/\r+\n/\n/g if $args{ARGSRef}->{'UpdateContent'};
+ $args{ARGSRef}->{'UpdateContent'} = ''
+ if $args{ARGSRef}->{'UpdateContent'} =~ /^\s*(--)?\s*\Q$sig\E\s*$/;
- # skip updates if the content contains only user's signature
- # and we don't update other fields
- if ( $args{'SkipSignatureOnly'} ) {
- my $sig = $args{'TicketObj'}->CurrentUser->UserObj->Signature || '';
- $sig =~ s/^\s*|\s*$//g;
- if ($args{ARGSRef}->{'UpdateContent'} =~ /^\s*(--)?\s*\Q$sig\E\s*$/
- or ( defined $args{ARGSRef}->{'UpdateContentType'}
- and $args{ARGSRef}->{'UpdateContentType'} eq "text/html"
+ $args{ARGSRef}->{'UpdateContent'} = ''
+ if ($args{ARGSRef}->{'UpdateContentType'}||'') eq "text/html"
and $args{ARGSRef}->{'UpdateContent'}
- =~ /^\s*<p>\s*(--)?\s*<br\s*\/?>\s*\Q$sig\E\s*<\/p>\s*$/ )
- )
- {
- return () unless $args{ARGSRef}->{'UpdateTimeWorked'} ||
- $args{ARGSRef}->{'UpdateAttachments'};
-
- # we have to create transaction, but we don't create attachment
- # XXX: this couldn't work as expected
- $args{ARGSRef}->{'UpdateContent'} = '';
+ =~ m{^\s*<p>\s*(--)?\s*<br[^>]*?/?>\s*\Q$sig\E\s*</p>\s*$}s;
}
}
+ return () unless $args{ARGSRef}->{'UpdateTimeWorked'}
+ || $args{ARGSRef}->{'UpdateAttachments'}
+ || ( defined $args{ARGSRef}->{'UpdateContent'}
+ && length $args{ARGSRef}->{'UpdateContent'} );
+
if ( $args{ARGSRef}->{'UpdateSubject'} eq $args{'TicketObj'}->Subject ) {
$args{ARGSRef}->{'UpdateSubject'} = undef;
}
More information about the Rt-commit
mailing list