[Rt-commit] rt branch 5.0/fix-article-saved-search-update created. rt-5.0.5-209-gda7c4e2857

BPS Git Server git at git.bestpractical.com
Fri Apr 5 20:15:36 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/fix-article-saved-search-update has been created
        at  da7c4e285793df6b7832e018b6e1821eeccc0b4d (commit)

- Log -----------------------------------------------------------------
commit da7c4e285793df6b7832e018b6e1821eeccc0b4d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Apr 5 16:09:24 2024 -0400

    Skip dumping content for failed todo tests
    
    They are expected failures and thus no need to dump content.

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 194c3651cc..0cb8054a6b 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -458,7 +458,7 @@ for my $method_name (qw/
 
         my $self = shift;
         my $ok = $self->$super_method(@_);
-        if (!$ok) {
+        if ( !$ok && !RT::Test->builder->in_todo ) {
             my $dir = RT::Test->temp_directory;
             my ($name) = $self->uri->path =~ m{/([^/]+)$};
             $name ||= 'index.html';

commit b8f3d509d799eff79b5aa9f013631edee61cffdc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Apr 5 16:08:25 2024 -0400

    Test article saved searches

diff --git a/t/articles/search-interface.t b/t/articles/search-interface.t
index 1d9d46ea47..9715190571 100644
--- a/t/articles/search-interface.t
+++ b/t/articles/search-interface.t
@@ -143,6 +143,74 @@ TODO:{
     $m->text_contains('hoi polloi 4');
 }
 
+diag "Testing saved searches";
+
+$m->submit_form_ok(
+    {
+        form_number => 3,
+        fields      => { NewSearchName => 'test', 'Article~' => 'africa' },
+        button      => 'Save',
+    },
+    'Create new saved search'
+);
+$m->text_contains( 'Created search test', 'Created new search test' );
+$m->text_contains('Last Updated');    # Did we do a search?
+$m->text_contains('blah blah 1');
+
+my $form = $m->form_number(3);
+is( $form->value('Article~'), 'africa', 'Search param is saved' );
+
+$m->submit_form_ok(
+    {
+        fields => { 'Article~' => 'ipsum' },
+        button => 'Update',
+    },
+    'Update saved search'
+);
+$m->text_contains( 'Search test updated', 'Updated saved search' );
+$m->text_contains('Last Updated');    # Did we do a search?
+$m->text_contains('hoi polloi 4');
+$m->text_lacks('blah blah 1');
+
+$m->submit_form_ok(
+    {
+        form_number => 3,
+        fields      => { NewSearchName => 'test2', 'Article~' => 'africa' },
+        button      => 'Save',                                                 # the "Save new" button
+    },
+    'Save as a new saved search'
+);
+$m->text_contains( 'Created search test2', 'Created a new search' );
+$m->text_contains('Last Updated');    # Did we do a search?
+$m->text_contains('blah blah 1');
+$m->text_lacks('hoi polloi 4');
+
+$form = $m->form_number(3);
+my $load_saved_search = $form->find_input('LoadSavedSearch');
+my @saved_searches    = $load_saved_search->possible_values;
+is( scalar @saved_searches, 3, '2 saved searches in total' );    # another is the empty option
+
+$m->submit_form_ok(
+    {
+        fields => { LoadSavedSearch => $saved_searches[1] },
+        button => 'Load',
+    },
+    'Load saved search'
+);
+$form = $m->form_number(3);
+is( $form->value('Article~'),        'ipsum',            'Search param from saved search' );
+is( $form->value('LoadSavedSearch'), $saved_searches[1], 'Loaded saved search' );
+$m->text_contains('Last Updated');                               # Did we do a search?
+$m->text_contains('hoi polloi 4');
+$m->text_lacks('blah blah 1');
+
+$m->submit_form_ok( { button => 'Delete', }, 'Delete saved search' );
+is_deeply(
+    [ $m->form_number(3)->find_input('LoadSavedSearch')->possible_values ],
+    [ @saved_searches[ 0, 2 ] ],
+    'Deleted saved search'
+);
+
 done_testing;
 
 # When you send $m to this sub, it must be on a page with

commit caafba6ad7c3ea49014721c514dcc2439566ec86
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Apr 5 14:05:49 2024 -0400

    Fix "Update" operation for article saved searches
    
    For article saved searches, search params are saved in "args" instead of the
    top level.

diff --git a/share/html/Articles/Article/Search.html b/share/html/Articles/Article/Search.html
index fb4df7e283..2704f6af55 100644
--- a/share/html/Articles/Article/Search.html
+++ b/share/html/Articles/Article/Search.html
@@ -231,8 +231,8 @@ if ($ARGS{'Save'}) {
 
         # We already have a search loaded, because CurrentSearch is set,
         # or else we would not have gotten here.
-        my ($ret, $msg) = $search->Update(Name => $ARGS{'NewSearchName'},
-                                          SearchParams => \%searchargs);
+        my ( $ret, $msg )
+            = $search->Update( Name => $ARGS{'NewSearchName'}, SearchParams => { 'args' => \%searchargs } );
         if ($ret) {
             push(@results, loc("Search [_1] updated", $search->Name));
         } else {

commit 04fd2cffe7840bc57323c9246b281c0edf69f3e6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Apr 5 14:03:02 2024 -0400

    Use string comparison op(ne) for SearchPrivacy values like "RT::User-14"
    
    This is to fix the warning like:
    
        Argument "RT::User-14" isn't numeric in numeric ne (!=)

diff --git a/share/html/Articles/Article/Search.html b/share/html/Articles/Article/Search.html
index b65ea60ff7..fb4df7e283 100644
--- a/share/html/Articles/Article/Search.html
+++ b/share/html/Articles/Article/Search.html
@@ -220,7 +220,7 @@ if ($ARGS{'Save'}) {
         push(@results, loc("Could not create search: [_1]", $msg));
     }
 } elsif ($ARGS{'Update'}) {
-    if ($ARGS{'SearchPrivacy'} != $search->Privacy) {
+    if ($ARGS{'SearchPrivacy'} ne $search->Privacy) {
         push(@results,
              loc("Error: cannot change privacy value of existing search"));
     } else {

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list