[Rt-commit] rt branch, 4.0/saved-search-context, updated. rt-4.0.1-221-g122daf6
Jason May
jasonmay at bestpractical.com
Thu Sep 15 13:38:39 EDT 2011
The branch, 4.0/saved-search-context has been updated
via 122daf694962626c9a41c9f7ac2f2b0e239eed22 (commit)
from f28d1fd7084189adcfde13266848b00295449701 (commit)
Summary of changes:
share/html/Search/Build.html | 6 ++++++
t/web/saved_search_context.t | 30 ++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 122daf694962626c9a41c9f7ac2f2b0e239eed22
Author: Jason May <jasonmay at bestpractical.com>
Date: Thu Sep 15 13:29:20 2011 -0400
Include SavedSearchId in the tab query params
Without this fix, saving a new search and clicking one of the tabs like
'Edit Search' will lose the saved search context. You would have to load
it again.
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index 7b2dc7f..5522479 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -277,6 +277,12 @@ my ( $AvailableColumns, $CurrentFormat );
# if we're asked to save the current search, save it
push @actions, $m->comp( 'Elements/EditSearches:Save', %ARGS, Query => \%query, SavedSearch => \%saved_search);
+# Populate the "query" context with saved search data
+
+if ($ARGS{SavedSearchSave}) {
+ $query{'SavedSearchId'} = $saved_search{'Id'};
+}
+
# Push the updates into the session so we don't lose 'em
$session{'CurrentSearchHash'} = {
diff --git a/t/web/saved_search_context.t b/t/web/saved_search_context.t
index 002763b..fe9c51e 100644
--- a/t/web/saved_search_context.t
+++ b/t/web/saved_search_context.t
@@ -37,3 +37,33 @@ $m->follow_link(id => 'page-bulk');
$m->form_name('BulkUpdate');
ok(!$m->value('UpdateTicket2'), "There is no Ticket #2 in the search's bulk update");
+
+sub edit_search_link_has {
+ my ($m, $id, $msg) = @_;
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ (my $dec_id = $id) =~ s/:/%3A/g;
+
+ my $chart_url = $m->find_link(id => 'page-edit_search')->url;
+ like(
+ $chart_url, qr{SavedSearchId=\Q$dec_id\E},
+ $msg || 'Search link matches the pattern we expected'
+ );
+}
+
+diag("Test search context");
+{
+ $m->get_ok($url . '/Search/Build.html');
+ $m->form_name('BuildQuery');
+ $m->field(ValueOfPriority => 45);
+ $m->click('AddClause');
+ $m->form_name('BuildQuery');
+ $m->set_fields(
+ SavedSearchDescription => 'my saved search',
+ );
+ $m->click('SavedSearchSave');
+
+ my $saved_search_id = $m->form_name('BuildQuery')->value('SavedSearchId');
+ edit_search_link_has($m, $saved_search_id);
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list