summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-04-17 20:41:05 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-04-17 20:41:05 +0200
commit1d125667d33ac6542562be663930d72eec8e03b7 (patch)
treebeeb82428447dbd2309b9f21fc659ed2be48adfd
parentd8d3bd333243ebc01630b576a406c6b78725e0bf (diff)
downloadbugzilla-1d125667d33ac6542562be663930d72eec8e03b7.tar.gz
bugzilla-1d125667d33ac6542562be663930d72eec8e03b7.tar.xz
Bug 745320: Shared queries do not work when tags are part of the query
r=dkl a=LpSolit
-rw-r--r--Bugzilla/Search.pm6
-rwxr-xr-xbuglist.cgi13
2 files changed, 12 insertions, 7 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 2ea4b1ae1..1097b32dd 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -792,8 +792,8 @@ sub _param_array {
}
sub _params { $_[0]->{params} }
-
sub _user { return $_[0]->{user} }
+sub _sharer_id { $_[0]->{sharer} }
##############################
# Internal Accessors: SELECT #
@@ -2567,8 +2567,8 @@ sub _multiselect_table {
}
elsif ($field eq 'tag') {
$args->{full_field} = 'tag.name';
- return "bug_tag INNER JOIN tag ON bug_tag.tag_id = tag.id"
- . " AND user_id = " . $self->_user->id;
+ return "bug_tag INNER JOIN tag ON bug_tag.tag_id = tag.id AND user_id = "
+ . ($self->_sharer_id || $self->_user->id);
}
elsif ($field eq 'bug_group') {
$args->{full_field} = 'groups.name';
diff --git a/buglist.cgi b/buglist.cgi
index 7b513e607..ca51e6243 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -228,7 +228,9 @@ sub LookupNamedQuery {
$query->url
|| ThrowUserError("buglist_parameters_required");
- return wantarray ? ($query->url, $query->id) : $query->url;
+ # Detaint $sharer_id.
+ $sharer_id = $query->user->id if $sharer_id;
+ return wantarray ? ($query->url, $query->id, $sharer_id) : $query->url;
}
# Inserts a Named Query (a "Saved Search") into the database, or
@@ -347,6 +349,7 @@ sub _close_standby_message {
my $cmdtype = $cgi->param('cmdtype') || '';
my $remaction = $cgi->param('remaction') || '';
+my $sharer_id;
# Backwards-compatibility - the old interface had cmdtype="runnamed" to run
# a named command, and we can't break this because it's in bookmarks.
@@ -383,8 +386,9 @@ $filename =~ s/"/\\"/g; # escape quotes
if ($cmdtype eq "dorem") {
if ($remaction eq "run") {
my $query_id;
- ($buffer, $query_id) = LookupNamedQuery(scalar $cgi->param("namedcmd"),
- scalar $cgi->param('sharer_id'));
+ ($buffer, $query_id, $sharer_id) =
+ LookupNamedQuery(scalar $cgi->param("namedcmd"),
+ scalar $cgi->param('sharer_id'));
# If this is the user's own query, remember information about it
# so that it can be modified easily.
$vars->{'searchname'} = $cgi->param('namedcmd');
@@ -774,7 +778,8 @@ if ($format->{'extension'} eq 'html' && !defined $params->param('limit')) {
# Generate the basic SQL query that will be used to generate the bug list.
my $search = new Bugzilla::Search('fields' => \@selectcolumns,
'params' => scalar $params->Vars,
- 'order' => \@orderstrings);
+ 'order' => \@orderstrings,
+ 'sharer' => $sharer_id);
my $query = $search->sql;
$vars->{'search_description'} = $search->search_description;