Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
1457749b
Commit
1457749b
authored
Jul 29, 2015
by
Simon Green
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 166951 - Query for "Duplicate Of" (dupe_of)
r=dylan, a=simon
parent
6f9b1761
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
Field.pm
Bugzilla/Field.pm
+1
-0
Search.pm
Bugzilla/Search.pm
+64
-0
No files found.
Bugzilla/Field.pm
View file @
1457749b
...
...
@@ -268,6 +268,7 @@ use constant DEFAULT_FIELDS => (
{
name
=>
'last_visit_ts'
,
desc
=>
'Last Visit'
,
buglist
=>
1
,
type
=>
FIELD_TYPE_DATETIME
},
{
name
=>
'comment_tag'
,
desc
=>
'Comment Tag'
},
{
name
=>
'dupe_of'
,
desc
=>
'Duplicate of'
},
);
################
...
...
Bugzilla/Search.pm
View file @
1457749b
...
...
@@ -287,6 +287,14 @@ use constant OPERATOR_FIELD_OVERRIDE => {
_default
=>
\&
_days_elapsed
,
},
dependson
=>
MULTI_SELECT_OVERRIDE
,
dupe_of
=>
{
%
{
&
MULTI_SELECT_OVERRIDE
},
changedby
=>
\&
_dupe_of_changedby
,
changedbefore
=>
\&
_dupe_of_changedbefore_after
,
changedafter
=>
\&
_dupe_of_changedbefore_after
,
changedfrom
=>
\&
_invalid_combination
,
changedto
=>
\&
_invalid_combination
,
},
keywords
=>
MULTI_SELECT_OVERRIDE
,
'flagtypes.name'
=>
{
_non_changed
=>
\&
_flagtypes_nonchanged
,
...
...
@@ -2516,6 +2524,48 @@ sub _user_nonchanged {
}
}
# Changes to duplicates are stored in the longdesc table
sub
_dupe_of_changedby
{
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$joins
,
$value
)
=
@$args
{
qw(chart_id joins value)
};
my
$table
=
"longdescs_$chart_id"
;
push
(
@$joins
,
{
table
=>
'longdescs'
,
as
=>
$table
});
my
$user_id
=
$self
->
_get_user_id
(
$value
);
$args
->
{
term
}
=
"$table.who = $user_id AND $table.type = "
.
CMT_DUPE_OF
;
# If the user is not part of the insiders group, they cannot see
# private comments
if
(
!
$self
->
_user
->
is_insider
)
{
$args
->
{
term
}
.=
" AND $table.isprivate = 0"
;
}
}
sub
_dupe_of_changedbefore_after
{
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$operator
,
$value
,
$joins
)
=
@$args
{
qw(chart_id operator value joins)
};
my
$dbh
=
Bugzilla
->
dbh
;
my
$sql_operator
=
(
$operator
=~
/before/
)
?
'<='
:
'>='
;
my
$table
=
"longdescs_$chart_id"
;
my
$sql_date
=
$dbh
->
quote
(
SqlifyDate
(
$value
));
my
$join
=
{
table
=>
'longdescs'
,
as
=>
$table
,
extra
=>
[
"$table.bug_when $sql_operator $sql_date AND $table.type = "
.
CMT_DUPE_OF
],
};
push
(
@$joins
,
$join
);
$args
->
{
term
}
=
"$table.bug_when IS NOT NULL"
;
# If the user is not part of the insiders group, they cannot see
# private comments
if
(
!
$self
->
_user
->
is_insider
)
{
$args
->
{
term
}
.=
" AND $table.isprivate = 0"
;
}
}
# XXX This duplicates having Commenter as a search field.
sub
_long_desc_changedby
{
my
(
$self
,
$args
)
=
@_
;
...
...
@@ -2972,6 +3022,11 @@ sub _multiselect_table {
$args
->
{
full_field
}
=
$field
;
return
"dependencies"
;
}
elsif
(
$field
eq
'dupe_of'
)
{
$args
->
{
_select_field
}
=
'dupe'
;
$args
->
{
full_field
}
=
'dupe_of'
;
return
"duplicates"
;
}
elsif
(
$field
eq
'longdesc'
)
{
$args
->
{
_extra_where
}
=
" AND isprivate = 0"
if
!
$self
->
_user
->
is_insider
;
...
...
@@ -3072,6 +3127,15 @@ sub _multiselect_isempty {
};
return
"dependencies_$chart_id.$to IS $not NULL"
;
}
elsif
(
$field
eq
'dupe_of'
)
{
push
@$joins
,
{
table
=>
'duplicates'
,
as
=>
"duplicates_$chart_id"
,
from
=>
'bug_id'
,
to
=>
'dupe'
,
};
return
"duplicates_$chart_id.dupe IS $not NULL"
;
}
elsif
(
$field
eq
'longdesc'
)
{
my
@extra
=
(
"longdescs_$chart_id.type != "
.
CMT_HAS_DUPE
);
push
@extra
,
"longdescs_$chart_id.isprivate = 0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment