[Rt-commit] rt branch 5.0/article-autocomplete-should-be-case-insensitive created. rt-5.0.3-126-g219d73068a
BPS Git Server
git at git.bestpractical.com
Thu Nov 17 18:14:11 UTC 2022
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/article-autocomplete-should-be-case-insensitive has been created
at 219d73068ac03db3ea487355bbc415e341a217a3 (commit)
- Log -----------------------------------------------------------------
commit 219d73068ac03db3ea487355bbc415e341a217a3
Author: Brian Conry <bconry at bestpractical.com>
Date: Thu Nov 17 10:46:40 2022 -0600
Add case-sensitivity tests for Articles autocomplete
diff --git a/t/web/case-sensitivity.t b/t/web/case-sensitivity.t
index 6cb0f1579a..ad45f8fcfa 100644
--- a/t/web/case-sensitivity.t
+++ b/t/web/case-sensitivity.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 18;
+use RT::Test tests => 25;
my $q = RT::Test->load_or_create_queue( Name => 'General' );
ok $q && $q->id, 'loaded or created queue';
@@ -13,6 +13,12 @@ my ($root, $root_id);
ok $root_id = $root->id, 'found root';
}
+RT->Config->Set( 'ArticleSearchFields', {
+ Name => 'STARTSWITH',
+ Summary => 'LIKE',
+ 'CF.1' => 'LIKE',
+});
+
my ($baseurl, $m) = RT::Test->started_ok;
$m->login;
@@ -86,3 +92,30 @@ my $cf;
);
}
+# test articles auto completer
+{
+ my $article_name = 'Case-Sensitive Sample Article ' . $$;
+ my $art = RT::Article->new($RT::SystemUser);
+ my ($id,$msg) =$art->Create(
+ Class => 'General',
+ Name => $article_name,
+ Description => 'A Case-Sensitive Article Description',
+ Summary => 'A Case-Sensitive Article Summary',
+ 'CustomField-1' => 'Case-sensitive Article Content',
+ );
+ ok($id,$msg);
+
+ my $result = [{ "label" => $article_name, "value" => 1 }];
+
+ # test Name
+ $m->get_ok('/Helpers/Autocomplete/Articles?return=id&queue=1&term=case-sensitive sample article');
+ is_deeply( JSON::from_json( $m->content ), $result, 'Found by Name' );
+
+ # test Summary
+ $m->get_ok('/Helpers/Autocomplete/Articles?return=id&queue=1&term=article summary');
+ is_deeply( JSON::from_json( $m->content ), $result, 'Found by Summary' );
+
+ # test CF.Content
+ $m->get_ok('/Helpers/Autocomplete/Articles?return=id&queue=1&term=article content');
+ is_deeply( JSON::from_json( $m->content ), $result, 'Found by Content' );
+}
commit 6c8afd7f49fa8658c7b28d3556d65566d6edb51c
Author: Brian Conry <bconry at bestpractical.com>
Date: Thu Nov 17 10:23:16 2022 -0600
Article autocomplete should be case insensitive
CHange c8274d2937 added the ability to customize the fields searched for
autocomplete results when finding articles to include.
That change also inadvertently made those searches case sensitive.
This change fixes that.
diff --git a/lib/RT/Articles.pm b/lib/RT/Articles.pm
index 285cfe6de9..db4f188ef8 100644
--- a/lib/RT/Articles.pm
+++ b/lib/RT/Articles.pm
@@ -927,6 +927,7 @@ sub SimpleSearch {
LookupType => RT::Article->new( $self->CurrentUser )->CustomFieldLookupType,
);
if ( $ok ) {
+ # LimitCustomField already adds CASESENSITIVE => 0
$self->LimitCustomField(
CUSTOMFIELD => $cf->Id,
OPERATOR => $op,
@@ -944,6 +945,7 @@ sub SimpleSearch {
VALUE => $args{Term},
ENTRYAGGREGATOR => 'OR',
SUBCLAUSE => 'autocomplete',
+ CASESENSITIVE => 0,
);
}
}
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list