[Rt-commit] r13596 - rt/3.8/trunk/share/html/Search/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Wed Jun 25 18:47:02 EDT 2008
Author: ruz
Date: Wed Jun 25 18:47:01 2008
New Revision: 13596
Modified:
rt/3.8/trunk/share/html/Search/Elements/EditQuery
Log:
* add/replace only one once for a group of siblings
Modified: rt/3.8/trunk/share/html/Search/Elements/EditQuery
==============================================================================
--- rt/3.8/trunk/share/html/Search/Elements/EditQuery (original)
+++ rt/3.8/trunk/share/html/Search/Elements/EditQuery Wed Jun 25 18:47:01 2008
@@ -163,9 +163,12 @@
push @top, $node;
}
+ my %seen;
+ my @non_siblings_top = grep !$seen{ $_->getParent }++, @top;
+
foreach ( @New ) {
my $add = $_->clone;
- foreach my $selected( @top ) {
+ foreach my $selected( @non_siblings_top ) {
my $newindex = $selected->getIndex + 1;
$selected->insertSibling( $newindex, $add );
}
@@ -207,9 +210,12 @@
}
if ( @New && @$Selected ) {
+ my %seen;
+ my @non_siblings_selected = grep !$seen{ $_->getParent }++, @$Selected;
+
foreach ( @New ) {
my $add = $_->clone;
- foreach my $selected( @$Selected ) {
+ foreach my $selected( @non_siblings_selected ) {
my $newindex = $selected->getIndex + 1;
$selected->insertSibling( $newindex, $add );
}
More information about the Rt-commit
mailing list