[Bps-public-commit] RT-Extension-MergeUsers branch fix-user-search-pagination created. 1.06-2-g6ff9709
BPS Git Server
git at git.bestpractical.com
Thu Apr 13 19:52:30 UTC 2023
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-Extension-MergeUsers".
The branch, fix-user-search-pagination has been created
at 6ff97093e39d600fb71f01df9a66010f71b2843b (commit)
- Log -----------------------------------------------------------------
commit 6ff97093e39d600fb71f01df9a66010f71b2843b
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Thu Apr 13 16:51:26 2023 -0300
Support the CombineSearchAndCount feature in DBIx::SearchBuilder
When CombineSearchAndCount is enabled, _DoSearchAndCount will be called
instead of _DoSearch. As both methods call __DoSearch underneath, we can
clear seen_users there instead.
diff --git a/lib/RT/Extension/MergeUsers.pm b/lib/RT/Extension/MergeUsers.pm
index 848214d..a6850be 100644
--- a/lib/RT/Extension/MergeUsers.pm
+++ b/lib/RT/Extension/MergeUsers.pm
@@ -410,6 +410,7 @@ sub NameAndEmail {
package RT::Users;
use RT::Users;
+use version;
sub AddRecord {
my $self = shift;
@@ -429,10 +430,26 @@ sub AddRecord {
return $self->SUPER::AddRecord($record);
}
-sub _DoSearch {
- my $self = shift;
- delete $self->{seen_users};
- return $self->SUPER::_DoSearch(@_);
+# Since DBIx::SearchBuilder 1.72, the new CombineSearchAndCount function
+# is enabled. _DoSearchAndCount will be called instead of _DoSearch. As
+# both methods call __DoSearch underneath, we can clear seen_users there
+# instead.
+# In older versions, _we have only _DoSearch, so we need to clear seen_users
+# there for compatibility purposes.
+if ( DBIx::SearchBuilder->can('__DoSearch') ) {
+ no warnings 'redefine';
+ *__DoSearch = sub {
+ my $self = shift;
+ delete $self->{seen_users};
+ return $self->SUPER::__DoSearch(@_);
+ };
+} else {
+ no warnings 'redefine';
+ *_DoSearch = sub {
+ my $self = shift;
+ delete $self->{seen_users};
+ return $self->SUPER::_DoSearch(@_);
+ };
}
-----------------------------------------------------------------------
hooks/post-receive
--
RT-Extension-MergeUsers
More information about the Bps-public-commit
mailing list