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
99047442
Commit
99047442
authored
Jan 24, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 574577: commenter_pronoun, cc_pronoun, and contact_pronoun should all be merged
r/a=mkanat
parent
ff21bfca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
76 deletions
+23
-76
Search.pm
Bugzilla/Search.pm
+23
-76
No files found.
Bugzilla/Search.pm
View file @
99047442
...
@@ -317,8 +317,8 @@ use constant OPERATOR_FIELD_OVERRIDE => {
...
@@ -317,8 +317,8 @@ use constant OPERATOR_FIELD_OVERRIDE => {
use
constant
SPECIAL_PARSING
=>
{
use
constant
SPECIAL_PARSING
=>
{
# Pronoun Fields (Ones that can accept %user%, etc.)
# Pronoun Fields (Ones that can accept %user%, etc.)
assigned_to
=>
\&
_contact_pronoun
,
assigned_to
=>
\&
_contact_pronoun
,
cc
=>
\&
_c
c
_pronoun
,
cc
=>
\&
_c
ontact
_pronoun
,
commenter
=>
\&
_co
mmenter
_pronoun
,
commenter
=>
\&
_co
ntact
_pronoun
,
qa_contact
=>
\&
_contact_pronoun
,
qa_contact
=>
\&
_contact_pronoun
,
reporter
=>
\&
_contact_pronoun
,
reporter
=>
\&
_contact_pronoun
,
...
@@ -2022,11 +2022,11 @@ sub _contact_pronoun {
...
@@ -2022,11 +2022,11 @@ sub _contact_pronoun {
sub
_contact_exact_group
{
sub
_contact_exact_group
{
my
(
$self
,
$args
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
my
(
$value
,
$operator
,
$field
,
$chart_id
,
$joins
)
=
my
(
$value
,
$operator
,
$field
,
$chart_id
,
$joins
,
$sequence
)
=
@$args
{
qw(value operator field chart_id joins)
};
@$args
{
qw(value operator field chart_id joins
sequence
)
};
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
$self
->
_user
;
my
$user
=
$self
->
_user
;
$value
=~
/\%group\.([^%]+)%/
;
$value
=~
/\%group\.([^%]+)%/
;
my
$group
=
Bugzilla::
Group
->
check
({
name
=>
$1
,
_error
=>
'invalid_group_name'
});
my
$group
=
Bugzilla::
Group
->
check
({
name
=>
$1
,
_error
=>
'invalid_group_name'
});
$group
->
check_members_are_visible
();
$group
->
check_members_are_visible
();
...
@@ -2034,11 +2034,28 @@ sub _contact_exact_group {
...
@@ -2034,11 +2034,28 @@ sub _contact_exact_group {
||
ThrowUserError
(
'invalid_group_name'
,
{
name
=>
$group
->
name
});
||
ThrowUserError
(
'invalid_group_name'
,
{
name
=>
$group
->
name
});
my
$group_ids
=
Bugzilla::
Group
->
flatten_group_membership
(
$group
->
id
);
my
$group_ids
=
Bugzilla::
Group
->
flatten_group_membership
(
$group
->
id
);
if
(
$field
eq
'cc'
&&
$chart_id
eq
''
)
{
# This is for the email1, email2, email3 fields from query.cgi.
$chart_id
=
"CC$$sequence"
;
$args
->
{
sequence
}
++
;
}
my
$from
=
$field
;
# These fields need an additional table.
if
(
$field
=~
/^(commenter|cc)$/
)
{
my
$join_table
=
$field
;
$join_table
=
'longdescs'
if
$field
eq
'commenter'
;
my
$join_table_alias
=
"${field}_$chart_id"
;
push
(
@$joins
,
{
table
=>
$join_table
,
as
=>
$join_table_alias
});
$from
=
"$join_table_alias.who"
;
}
my
$table
=
"user_group_map_$chart_id"
;
my
$table
=
"user_group_map_$chart_id"
;
my
$join
=
{
my
$join
=
{
table
=>
'user_group_map'
,
table
=>
'user_group_map'
,
as
=>
$table
,
as
=>
$table
,
from
=>
$f
ield
,
from
=>
$f
rom
,
to
=>
'user_id'
,
to
=>
'user_id'
,
extra
=>
[
$dbh
->
sql_in
(
"$table.group_id"
,
$group_ids
),
extra
=>
[
$dbh
->
sql_in
(
"$table.group_id"
,
$group_ids
),
"$table.isbless = 0"
],
"$table.isbless = 0"
],
...
@@ -2052,76 +2069,6 @@ sub _contact_exact_group {
...
@@ -2052,76 +2069,6 @@ sub _contact_exact_group {
}
}
}
}
sub
_cc_pronoun
{
my
(
$self
,
$args
)
=
@_
;
my
(
$full_field
,
$value
)
=
@$args
{
qw(full_field value)
};
my
$user
=
$self
->
_user
;
if
(
$value
=~
/\%group/
)
{
return
$self
->
_cc_exact_group
(
$args
);
}
elsif
(
$value
=~
/^(%\w+%)$/
)
{
$args
->
{
value
}
=
pronoun
(
$1
,
$user
);
$args
->
{
quoted
}
=
$args
->
{
value
};
$args
->
{
value_is_id
}
=
1
;
}
}
sub
_cc_exact_group
{
my
(
$self
,
$args
)
=
@_
;
my
(
$chart_id
,
$sequence
,
$joins
,
$operator
,
$value
)
=
@$args
{
qw(chart_id sequence joins operator value)
};
my
$user
=
$self
->
_user
;
my
$dbh
=
Bugzilla
->
dbh
;
$value
=~
m/%group\.([^%]+)%/
;
my
$group
=
Bugzilla::
Group
->
check
({
name
=>
$1
,
_error
=>
'invalid_group_name'
});
$group
->
check_members_are_visible
();
$user
->
in_group
(
$group
)
||
ThrowUserError
(
'invalid_group_name'
,
{
name
=>
$group
->
name
});
my
$all_groups
=
Bugzilla::
Group
->
flatten_group_membership
(
$group
->
id
);
# This is for the email1, email2, email3 fields from query.cgi.
if
(
$chart_id
eq
""
)
{
$chart_id
=
"CC$$sequence"
;
$args
->
{
sequence
}
++
;
}
my
$cc_table
=
"cc_$chart_id"
;
push
(
@$joins
,
{
table
=>
'cc'
,
as
=>
$cc_table
});
my
$group_table
=
"user_group_map_$chart_id"
;
my
$group_join
=
{
table
=>
'user_group_map'
,
as
=>
$group_table
,
from
=>
"$cc_table.who"
,
to
=>
'user_id'
,
extra
=>
[
$dbh
->
sql_in
(
"$group_table.group_id"
,
$all_groups
),
"$group_table.isbless = 0"
],
};
push
(
@$joins
,
$group_join
);
if
(
$operator
=~
/^not/
)
{
$args
->
{
term
}
=
"$group_table.group_id IS NULL"
;
}
else
{
$args
->
{
term
}
=
"$group_table.group_id IS NOT NULL"
;
}
}
# XXX This should probably be merged with cc_pronoun.
sub
_commenter_pronoun
{
my
(
$self
,
$args
)
=
@_
;
my
$value
=
$args
->
{
value
};
my
$user
=
$self
->
_user
;
if
(
$value
=~
/^(%\w+%)$/
)
{
$args
->
{
value
}
=
pronoun
(
$1
,
$user
);
$args
->
{
quoted
}
=
$args
->
{
value
};
$args
->
{
value_is_id
}
=
1
;
}
}
#####################################################################
#####################################################################
# Search Functions
# Search Functions
#####################################################################
#####################################################################
...
...
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