[Rt-commit] rt branch, 4.4/config-option-search-results-navigation-links, repushed

Craig Kaiser craig at bestpractical.com
Fri Aug 28 13:17:47 EDT 2020


The branch 4.4/config-option-search-results-navigation-links was deleted and repushed:
       was e9c85eb96ace4d23ed59880e726fbe4533fe1f77
       now 83260d193ccf6a1460598ce5164842f85d958d75

1: 15ee84ebb3 ! 1: 4ea15a92c3 Add config option to disable search results navigation links
    @@ -14,7 +14,7 @@
      Set($SearchResultsAutoRedirect, 0);
      
     +
    -+=item C<$ShowSearchResultsNavInMenu>
    ++=item C<$ShowSearchNavigation>
     +
     +Option to build the search navigation options in the RT menu ( First, Last, Prev, Next ).
     +This feature requires the re-running of the current search in order to accuratly create
    @@ -22,7 +22,7 @@
     +
     +=cut
     +
    -+Set($ShowSearchResultsNavInMenu, 1);
    ++Set($ShowSearchNavigation, 1);
     +
      =back
      
    @@ -38,7 +38,7 @@
     -                if ( defined $session{"tickets"} ) {
     -                    # we have to update session data if we get new ItemMap
     -                    my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
    -+                if ( RT::Config->Get( 'ShowSearchResultsNavInMenu' ) ) {
    ++                if ( RT::Config->Get( 'ShowSearchNavigation' ) ) {
     +                    if ( defined $session{"tickets"} ) {
     +                        # we have to update session data if we get new ItemMap
     +                        my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
    @@ -96,7 +96,7 @@
      
      my %link_rel;
     -if (defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
    -+if (RT::Config->Get( 'ShowSearchResultsNavInMenu' ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
    ++if (RT::Config->Get( 'ShowSearchNavigation' ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
          my $item_map = $session{'tickets'}->ItemMap;
          $link_rel{first} = "/Ticket/Display.html?id=" . $item_map->{first}                if $item_map->{$TicketObj->Id}{prev};
          $link_rel{prev}  = "/Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{prev} if $item_map->{$TicketObj->Id}{prev};
2: 9e0bd5b9f7 ! 2: b34034b353 Add tests for 'ShowSearchNavigation' config option
    @@ -1,6 +1,6 @@
     Author: craig kaiser <craig at bestpractical.com>
     
    -    Add tests for 'ShowSearchResultsNavInMenu' config option
    +    Add tests for 'ShowSearchNavigation' config option
     
     diff --git a/t/web/search_linkdisplay.t b/t/web/search_linkdisplay.t
     --- a/t/web/search_linkdisplay.t
    @@ -17,10 +17,10 @@
     +my $t_link = $m->find_link( id => "search-tickets-next" )->url;
     +is ($t_link, "/Ticket/Display.html?id=".$ticket2->Id, 'link to the next ticket in current search found');
     +
    -+diag "Set ShowSearchResultsNavInMenu to false and confirm we do not load navigation links.";
    ++diag "Set ShowSearchNavigation to false and confirm we do not load navigation links.";
     +{
     +  RT::Test->stop_server;
    -+  RT->Config->Set( 'ShowSearchResultsNavInMenu' => 0 );
    ++  RT->Config->Set( 'ShowSearchNavigation' => 0 );
     +  ($baseurl, $m) = RT::Test->started_ok;
     +
     +  # Get a search that returns multiple tickets
3: fb98ee7a53 ! 3: a3a4b83756 Allow ShowSearchResultsNavInMenu to be user level overridable
    @@ -10,10 +10,9 @@
              Type => 'HASH',
          },
     +
    -+    ShowSearchResultsNavInMenu => {
    ++    ShowSearchNavigation => {
     +        Section     => 'Ticket display',
     +        Overridable => 1,
    -+        SortOrder   => 2,
     +        Widget      => '/Widgets/Form/Boolean',
     +        WidgetArguments => {
     +            Description => 'Build search results navigation menu items', # loc
    @@ -31,8 +30,8 @@
                          path  => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id,
                      ) if $session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System );
      
    --                if ( RT::Config->Get( 'ShowSearchResultsNavInMenu' ) ) {
    -+                if ( RT::Config->Get( 'ShowSearchResultsNavInMenu', $session{'CurrentUser'} ) ) {
    +-                if ( RT::Config->Get( 'ShowSearchNavigation' ) ) {
    ++                if ( RT::Config->Get( 'ShowSearchNavigation', $session{'CurrentUser'} ) ) {
                          if ( defined $session{"tickets"} ) {
                              # we have to update session data if we get new ItemMap
                              my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} );
    @@ -44,8 +43,8 @@
      my $attachment_content = $TicketObj->TextAttachments;
      
      my %link_rel;
    --if (RT::Config->Get( 'ShowSearchResultsNavInMenu' ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
    -+if (RT::Config->Get( 'ShowSearchResultsNavInMenu', $session{'CurrentUser'} ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
    +-if (RT::Config->Get( 'ShowSearchNavigation' ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
    ++if (RT::Config->Get( 'ShowSearchNavigation', $session{'CurrentUser'} ) && defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {
          my $item_map = $session{'tickets'}->ItemMap;
          $link_rel{first} = "/Ticket/Display.html?id=" . $item_map->{first}                if $item_map->{$TicketObj->Id}{prev};
          $link_rel{prev}  = "/Ticket/Display.html?id=" . $item_map->{$TicketObj->Id}{prev} if $item_map->{$TicketObj->Id}{prev};
4: e9c85eb96a ! 4: 83260d193c Add tests for setting user pref of 'ShowSearchNavigation'
    @@ -1,6 +1,6 @@
     Author: craig kaiser <craig at bestpractical.com>
     
    -    Add tests for setting user pref of 'ShowSearchResultsNavInMenu'
    +    Add tests for setting user pref of 'ShowSearchNavigation'
     
     diff --git a/t/web/search_linkdisplay.t b/t/web/search_linkdisplay.t
     --- a/t/web/search_linkdisplay.t
    @@ -10,7 +10,7 @@
        is($t_link, undef, "Search navigation results are not rendered");
      }
     +
    -+diag "Override ShowSearchResultsNavInMenu at user pref level.";
    ++diag "Override ShowSearchNavigation at user pref level.";
     +{
     +    ok( $m->login( 'root', 'password' ), 'logged in as root' );
     +
    @@ -18,9 +18,9 @@
     +    $root->Load( 'root' );
     +    ok ( $root->Id, "Loaded root user" );
     +
    -+    $root->SetPreferences( $RT::System => { %{ $root->Preferences( $RT::System ) || {}}, ShowSearchResultsNavInMenu => 1 });
    ++    $root->SetPreferences( $RT::System => { %{ $root->Preferences( $RT::System ) || {}}, ShowSearchNavigation => 1 });
     +
    -+    is( RT::Config->Get( 'ShowSearchResultsNavInMenu', $root ), 1, "User pref for ShowSearchResultsNavInMenu successfully set.");
    ++    is( RT::Config->Get( 'ShowSearchNavigation', $root ), 1, "User pref for ShowSearchNavigation successfully set.");
     +
     +    $m->get_ok("/Search/Results.html?Format=id,RefersTo;Query=id>0");
     +
    @@ -29,8 +29,8 @@
     +    is ($t_link, "/Ticket/Display.html?id=".$ticket2->Id, 'link to the next ticket in current search found');
     +
     +
    -+    $root->SetPreferences( $RT::System => { %{ $root->Preferences( $RT::System ) || {}}, ShowSearchResultsNavInMenu => 0 });
    -+    is( RT::Config->Get( 'ShowSearchResultsNavInMenu', $root ), 0, "User pref for ShowSearchResultsNavInMenu successfully set.");
    ++    $root->SetPreferences( $RT::System => { %{ $root->Preferences( $RT::System ) || {}}, ShowSearchNavigation => 0 });
    ++    is( RT::Config->Get( 'ShowSearchNavigation', $root ), 0, "User pref for ShowSearchNavigation successfully set.");
     +}
     +
      done_testing;



More information about the rt-commit mailing list