[Rt-commit] rt branch, 4.2/require-savedsearch-names, created. rt-4.2.3-87-gfe8b070

Alex Vandiver alexmv at bestpractical.com
Thu Apr 17 18:19:37 EDT 2014


The branch, 4.2/require-savedsearch-names has been created
        at  fe8b07018ea04aa39eb5bdcd22878f0a2e15cdad (commit)

- Log -----------------------------------------------------------------
commit fe8b07018ea04aa39eb5bdcd22878f0a2e15cdad
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 17 18:15:04 2014 -0400

    Require that saved searches have names in order to be created
    
    Updating an existing saved search to not have a name is already
    impossible because the description is ||='d to the current value.
    
    Fixes I#20210.

diff --git a/share/html/Search/Elements/EditSearches b/share/html/Search/Elements/EditSearches
index 6d66f30..ed4e33a 100644
--- a/share/html/Search/Elements/EditSearches
+++ b/share/html/Search/Elements/EditSearches
@@ -146,7 +146,7 @@ $SavedSearch => {}
 
 $SavedSearch->{'Id'}          = ( $ARGS{Type} && $ARGS{Type} eq 'Chart' ?
 $ARGS{'SavedChartSearchId'} : $ARGS{'SavedSearchId'} ) || 'new';
-$SavedSearch->{'Description'} = $ARGS{'SavedSearchDescription'} || undef;
+$SavedSearch->{'Description'} = $ARGS{'SavedSearchDescription'} || '';
 $SavedSearch->{'Privacy'}     = $ARGS{'SavedSearchOwner'}       || undef;
 
 my @results;
@@ -293,7 +293,7 @@ if ( $obj && $obj->id ) {
     }
     push @results, loc('Updated saved search "[_1]"', $desc);
 }
-elsif ( $id eq 'new' ) {
+elsif ( $id eq 'new' and defined $desc and length $desc ) {
     my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} );
     my ($status, $msg) = $saved_search->Save(
         Privacy      => $privacy,
@@ -316,6 +316,9 @@ elsif ( $id eq 'new' ) {
         push @results, loc("Can't find a saved search to work with").': '.loc($msg);
     }
 }
+elsif ( $id eq 'new' ) {
+    push @results, loc("Can't save a search without a name");
+}
 else {
     push @results, loc("Can't save this search");
 }

-----------------------------------------------------------------------


More information about the rt-commit mailing list