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
4c74fbe0
Commit
4c74fbe0
authored
Jun 19, 2006
by
lpsolit%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 339750: Remove Bugzilla::Flag::GetBug - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=myk
parent
1ae6c5f8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
54 deletions
+58
-54
Flag.pm
Bugzilla/Flag.pm
+0
-0
attachment.cgi
attachment.cgi
+30
-33
editflagtypes.cgi
editflagtypes.cgi
+17
-9
process_bug.cgi
process_bug.cgi
+1
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+2
-2
email.txt.tmpl
template/en/default/request/email.txt.tmpl
+8
-9
No files found.
Bugzilla/Flag.pm
View file @
4c74fbe0
This diff is collapsed.
Click to expand it.
attachment.cgi
View file @
4c74fbe0
...
@@ -268,49 +268,39 @@ sub validatePrivate
...
@@ -268,49 +268,39 @@ sub validatePrivate
$cgi
->
param
(
'isprivate'
,
$cgi
->
param
(
'isprivate'
)
?
1
:
0
);
$cgi
->
param
(
'isprivate'
,
$cgi
->
param
(
'isprivate'
)
?
1
:
0
);
}
}
sub
validateObsolete
sub
validateObsolete
{
{
my
@obsolete_ids
=
();
my
$dbh
=
Bugzilla
->
dbh
;
# Make sure the attachment id is valid and the user has permissions to view
# Make sure the attachment id is valid and the user has permissions to view
# the bug to which it is attached.
# the bug to which it is attached.
my
@obsolete_attachments
;
foreach
my
$attachid
(
$cgi
->
param
(
'obsolete'
))
{
foreach
my
$attachid
(
$cgi
->
param
(
'obsolete'
))
{
my
$vars
=
{};
my
$vars
=
{};
$vars
->
{
'attach_id'
}
=
$attachid
;
$vars
->
{
'attach_id'
}
=
$attachid
;
detaint_natural
(
$attachid
)
detaint_natural
(
$attachid
)
||
ThrowCodeError
(
"invalid_attach_id_to_obsolete"
,
$vars
);
||
ThrowCodeError
(
"invalid_attach_id_to_obsolete"
,
$vars
);
my
(
$bugid
,
$isobsolete
,
$description
)
=
$dbh
->
selectrow_array
(
"SELECT bug_id, isobsolete, description
FROM attachments WHERE attach_id = ?"
,
undef
,
$attachid
);
# Make sure the attachment exists in the database.
my
$attachment
=
Bugzilla::
Attachment
->
get
(
$attachid
);
ThrowUserError
(
"invalid_attach_id"
,
$vars
)
unless
$bugid
;
# Make sure the attachment exists in the database.
ThrowUserError
(
"invalid_attach_id"
,
$vars
)
unless
$attachment
;
$vars
->
{
'description'
}
=
$attachment
->
description
;
$vars
->
{
'description'
}
=
$description
;
if
(
$attachment
->
bug_id
!=
$cgi
->
param
(
'bugid'
))
{
if
(
$bugid
!=
$cgi
->
param
(
'bugid'
))
{
$vars
->
{
'my_bug_id'
}
=
$cgi
->
param
(
'bugid'
);
$vars
->
{
'my_bug_id'
}
=
$cgi
->
param
(
'bugid'
);
$vars
->
{
'attach_bug_id'
}
=
$
bug
id
;
$vars
->
{
'attach_bug_id'
}
=
$
attachment
->
bug_
id
;
ThrowCodeError
(
"mismatched_bug_ids_on_obsolete"
,
$vars
);
ThrowCodeError
(
"mismatched_bug_ids_on_obsolete"
,
$vars
);
}
}
if
(
$isobsolete
)
if
(
$attachment
->
isobsolete
)
{
{
ThrowCodeError
(
"attachment_already_obsolete"
,
$vars
);
ThrowCodeError
(
"attachment_already_obsolete"
,
$vars
);
}
}
# Check that the user can modify this attachment
# Check that the user can modify this attachment
validateCanEdit
(
$attachid
);
validateCanEdit
(
$attachid
);
push
(
@obsolete_
ids
,
$attachid
);
push
(
@obsolete_
attachments
,
$attachment
);
}
}
return
@obsolete_attachments
;
return
@obsolete_ids
;
}
}
# Returns 1 if the parameter is a content-type viewable in this browser
# Returns 1 if the parameter is a content-type viewable in this browser
...
@@ -797,8 +787,8 @@ sub insert
...
@@ -797,8 +787,8 @@ sub insert
$bugid
,
$user
,
$bugid
,
$user
,
$timestamp
,
\
$vars
);
$timestamp
,
\
$vars
);
my
$isprivate
=
$cgi
->
param
(
'isprivate'
)
?
1
:
0
;
my
$isprivate
=
$cgi
->
param
(
'isprivate'
)
?
1
:
0
;
my
@obsolete_
ids
=
()
;
my
@obsolete_
attachments
;
@obsolete_
id
s
=
validateObsolete
()
if
$cgi
->
param
(
'obsolete'
);
@obsolete_
attachment
s
=
validateObsolete
()
if
$cgi
->
param
(
'obsolete'
);
# Insert a comment about the new attachment into the database.
# Insert a comment about the new attachment into the database.
my
$comment
=
"Created an attachment (id=$attachid)\n"
.
my
$comment
=
"Created an attachment (id=$attachid)\n"
.
...
@@ -809,17 +799,19 @@ sub insert
...
@@ -809,17 +799,19 @@ sub insert
# Make existing attachments obsolete.
# Make existing attachments obsolete.
my
$fieldid
=
get_field_id
(
'attachments.isobsolete'
);
my
$fieldid
=
get_field_id
(
'attachments.isobsolete'
);
foreach
my
$obsolete_id
(
@obsolete_ids
)
{
my
$bug
=
new
Bugzilla::
Bug
(
$bugid
,
$user
->
id
);
foreach
my
$obsolete_attachment
(
@obsolete_attachments
)
{
# If the obsolete attachment has request flags, cancel them.
# If the obsolete attachment has request flags, cancel them.
# This call must be done before updating the 'attachments' table.
# This call must be done before updating the 'attachments' table.
Bugzilla::Flag::
CancelRequests
(
$bug
id
,
$obsolete_id
,
$timestamp
);
Bugzilla::Flag::
CancelRequests
(
$bug
,
$obsolete_attachment
,
$timestamp
);
$dbh
->
do
(
"UPDATE attachments SET isobsolete = 1 "
.
$dbh
->
do
(
"UPDATE attachments SET isobsolete = 1 "
.
"WHERE attach_id = ?"
,
undef
,
$obsolete_id
);
"WHERE attach_id = ?"
,
undef
,
$obsolete_
attachment
->
id
);
$dbh
->
do
(
"INSERT INTO bugs_activity (bug_id, attach_id, who, bug_when,
$dbh
->
do
(
"INSERT INTO bugs_activity (bug_id, attach_id, who, bug_when,
fieldid, removed, added)
fieldid, removed, added)
VALUES (?,?,?,?,?,?,?)"
,
undef
,
VALUES (?,?,?,?,?,?,?)"
,
undef
,
$bugid
,
$obsolete_id
,
$user
->
id
,
$timestamp
,
$fieldid
,
0
,
1
);
$bugid
,
$obsolete_
attachment
->
id
,
$user
->
id
,
$timestamp
,
$fieldid
,
0
,
1
);
}
}
# Assign the bug to the user, if they are allowed to take it
# Assign the bug to the user, if they are allowed to take it
...
@@ -865,7 +857,10 @@ sub insert
...
@@ -865,7 +857,10 @@ sub insert
}
}
# Create flags.
# Create flags.
Bugzilla::Flag::
process
(
$bugid
,
$attachid
,
$timestamp
,
$cgi
);
# Update the bug object with updated data.
$bug
=
new
Bugzilla::
Bug
(
$bugid
,
$user
->
id
);
my
$attachment
=
Bugzilla::
Attachment
->
get
(
$attachid
);
Bugzilla::Flag::
process
(
$bug
,
$attachment
,
$timestamp
,
$cgi
);
# Define the variables and functions that will be passed to the UI template.
# Define the variables and functions that will be passed to the UI template.
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
,
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
,
...
@@ -963,8 +958,9 @@ sub update
...
@@ -963,8 +958,9 @@ sub update
Bugzilla::Flag::
validate
(
$cgi
,
$bugid
,
$attach_id
);
Bugzilla::Flag::
validate
(
$cgi
,
$bugid
,
$attach_id
);
Bugzilla::FlagType::
validate
(
$cgi
,
$bugid
,
$attach_id
);
Bugzilla::FlagType::
validate
(
$cgi
,
$bugid
,
$attach_id
);
# Lock database tables in preparation for updating the attachment.
my
$bug
=
new
Bugzilla::
Bug
(
$bugid
,
$userid
);
$dbh
->
bz_lock_tables
(
'attachments WRITE'
,
'flags WRITE'
,
# Lock database tables in preparation for updating the attachment.
$dbh
->
bz_lock_tables
(
'attachments WRITE'
,
'flags WRITE'
,
'flagtypes READ'
,
'fielddefs READ'
,
'bugs_activity WRITE'
,
'flagtypes READ'
,
'fielddefs READ'
,
'bugs_activity WRITE'
,
'flaginclusions AS i READ'
,
'flagexclusions AS e READ'
,
'flaginclusions AS i READ'
,
'flagexclusions AS e READ'
,
# cc, bug_group_map, user_group_map, and groups are in here so we
# cc, bug_group_map, user_group_map, and groups are in here so we
...
@@ -974,7 +970,7 @@ sub update
...
@@ -974,7 +970,7 @@ sub update
# Bugzilla::User can flatten groups.
# Bugzilla::User can flatten groups.
'bugs WRITE'
,
'profiles READ'
,
'email_setting READ'
,
'bugs WRITE'
,
'profiles READ'
,
'email_setting READ'
,
'cc READ'
,
'bug_group_map READ'
,
'user_group_map READ'
,
'cc READ'
,
'bug_group_map READ'
,
'user_group_map READ'
,
'group_group_map READ'
,
'groups READ'
);
'group_group_map READ'
,
'groups READ'
,
'group_control_map READ'
);
# Get a copy of the attachment record before we make changes
# Get a copy of the attachment record before we make changes
# so we can record those changes in the activity table.
# so we can record those changes in the activity table.
...
@@ -999,7 +995,8 @@ sub update
...
@@ -999,7 +995,8 @@ sub update
# to attachments so that we can delete pending requests if the user
# to attachments so that we can delete pending requests if the user
# is obsoleting this attachment without deleting any requests
# is obsoleting this attachment without deleting any requests
# the user submits at the same time.
# the user submits at the same time.
Bugzilla::Flag::
process
(
$bugid
,
$attach_id
,
$timestamp
,
$cgi
);
my
$attachment
=
Bugzilla::
Attachment
->
get
(
$attach_id
);
Bugzilla::Flag::
process
(
$bug
,
$attachment
,
$timestamp
,
$cgi
);
# Update the attachment record in the database.
# Update the attachment record in the database.
$dbh
->
do
(
"UPDATE attachments
$dbh
->
do
(
"UPDATE attachments
...
...
editflagtypes.cgi
View file @
4c74fbe0
...
@@ -41,6 +41,8 @@ use Bugzilla::Group;
...
@@ -41,6 +41,8 @@ use Bugzilla::Group;
use
Bugzilla::
Util
;
use
Bugzilla::
Util
;
use
Bugzilla::
Product
;
use
Bugzilla::
Product
;
use
Bugzilla::
Component
;
use
Bugzilla::
Component
;
use
Bugzilla::
Bug
;
use
Bugzilla::
Attachment
;
use
List::
Util
qw(reduce)
;
use
List::
Util
qw(reduce)
;
...
@@ -384,10 +386,10 @@ sub update {
...
@@ -384,10 +386,10 @@ sub update {
validateAndSubmit
(
$id
);
validateAndSubmit
(
$id
);
$dbh
->
bz_unlock_tables
();
$dbh
->
bz_unlock_tables
();
# Clear existing flags for bugs/attachments in categories no longer on
# Clear existing flags for bugs/attachments in categories no longer on
# the list of inclusions or that have been added to the list of exclusions.
# the list of inclusions or that have been added to the list of exclusions.
my
$flag
_ids
=
$dbh
->
selectcol_arrayref
(
'SELECT flags.
id
my
$flag
s
=
$dbh
->
selectall_arrayref
(
'SELECT flags.id, flags.bug_id, flags.attach_
id
FROM flags
FROM flags
INNER JOIN bugs
INNER JOIN bugs
ON flags.bug_id = bugs.bug_id
ON flags.bug_id = bugs.bug_id
...
@@ -400,11 +402,14 @@ sub update {
...
@@ -400,11 +402,14 @@ sub update {
WHERE flags.type_id = ?
WHERE flags.type_id = ?
AND i.type_id IS NULL'
,
AND i.type_id IS NULL'
,
undef
,
$id
);
undef
,
$id
);
foreach
my
$flag_id
(
@$flag_ids
)
{
foreach
my
$flag
(
@$flags
)
{
Bugzilla::Flag::
clear
(
$flag_id
);
my
(
$flag_id
,
$bug_id
,
$attach_id
)
=
@$flag
;
my
$bug
=
new
Bugzilla::
Bug
(
$bug_id
,
$user
->
id
);
my
$attachment
=
$attach_id
?
Bugzilla::
Attachment
->
get
(
$attach_id
)
:
undef
;
Bugzilla::Flag::
clear
(
$flag_id
,
$bug
,
$attachment
);
}
}
$flag
_ids
=
$dbh
->
selectcol_arrayref
(
'SELECT flags.id
$flag
s
=
$dbh
->
selectall_arrayref
(
'SELECT flags.id, flags.bug_id, flags.attach_id
FROM flags
FROM flags
INNER JOIN bugs
INNER JOIN bugs
ON flags.bug_id = bugs.bug_id
ON flags.bug_id = bugs.bug_id
...
@@ -416,10 +421,13 @@ sub update {
...
@@ -416,10 +421,13 @@ sub update {
AND (bugs.component_id = e.component_id
AND (bugs.component_id = e.component_id
OR e.component_id IS NULL)'
,
OR e.component_id IS NULL)'
,
undef
,
$id
);
undef
,
$id
);
foreach
my
$flag_id
(
@$flag_ids
)
{
foreach
my
$flag
(
@$flags
)
{
Bugzilla::Flag::
clear
(
$flag_id
);
my
(
$flag_id
,
$bug_id
,
$attach_id
)
=
@$flag
;
my
$bug
=
new
Bugzilla::
Bug
(
$bug_id
,
$user
->
id
);
my
$attachment
=
$attach_id
?
Bugzilla::
Attachment
->
get
(
$attach_id
)
:
undef
;
Bugzilla::Flag::
clear
(
$flag_id
,
$bug
,
$attachment
);
}
}
$vars
->
{
'name'
}
=
$cgi
->
param
(
'name'
);
$vars
->
{
'name'
}
=
$cgi
->
param
(
'name'
);
$vars
->
{
'message'
}
=
"flag_type_changes_saved"
;
$vars
->
{
'message'
}
=
"flag_type_changes_saved"
;
...
...
process_bug.cgi
View file @
4c74fbe0
...
@@ -2122,7 +2122,7 @@ foreach my $id (@idlist) {
...
@@ -2122,7 +2122,7 @@ foreach my $id (@idlist) {
}
}
}
}
# Set and update flags.
# Set and update flags.
Bugzilla::Flag::
process
(
$
id
,
undef
,
$timestamp
,
$cgi
);
Bugzilla::Flag::
process
(
$
new_bug_obj
,
undef
,
$timestamp
,
$cgi
);
if
(
$bug_changed
)
{
if
(
$bug_changed
)
{
$dbh
->
do
(
q{UPDATE bugs SET delta_ts = ? WHERE bug_id = ?}
,
$dbh
->
do
(
q{UPDATE bugs SET delta_ts = ? WHERE bug_id = ?}
,
...
...
template/en/default/global/user-error.html.tmpl
View file @
4c74fbe0
...
@@ -446,7 +446,7 @@
...
@@ -446,7 +446,7 @@
You asked [% requestee.identity FILTER html %]
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on [% terms.bug %]
for <code>[% flag_type.name FILTER html %]</code> on [% terms.bug %]
[%+ bug_id FILTER html -%]
[%+ bug_id FILTER html -%]
[% IF attach
ment %], attachment [% attachment.id FILTER html %][% END %],
[% IF attach
_id > 0 %], attachment [% attach_id FILTER html %][% END %],
but that [% terms.bug %] has been restricted to users in certain groups,
but that [% terms.bug %] has been restricted to users in certain groups,
and the user you asked isn't in all the groups to which
and the user you asked isn't in all the groups to which
the [% terms.bug %] has been restricted.
the [% terms.bug %] has been restricted.
...
@@ -463,7 +463,7 @@
...
@@ -463,7 +463,7 @@
You asked [% requestee.identity FILTER html %]
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on
for <code>[% flag_type.name FILTER html %]</code> on
[%+ terms.bug %] [%+ bug_id FILTER html %],
[%+ terms.bug %] [%+ bug_id FILTER html %],
attachment [% attach
ment.
id FILTER html %], but that attachment
attachment [% attach
_
id FILTER html %], but that attachment
is restricted to users in the [% Param("insidergroup") FILTER html %] group,
is restricted to users in the [% Param("insidergroup") FILTER html %] group,
and the user you asked isn't in that group. Please choose someone else
and the user you asked isn't in that group. Please choose someone else
to ask, or ask an administrator to add the user to the group.
to ask, or ask an administrator to add the user to the group.
...
...
template/en/default/request/email.txt.tmpl
View file @
4c74fbe0
...
@@ -23,9 +23,8 @@
...
@@ -23,9 +23,8 @@
[% PROCESS global/variables.none.tmpl %]
[% PROCESS global/variables.none.tmpl %]
[% bugidsummary = flag.target.bug.id _ ': ' _ flag.target.bug.summary %]
[% bugidsummary = bug.bug_id _ ': ' _ bug.short_desc %]
[% attidsummary = flag.target.attachment.id _ ': ' _
[% attidsummary = attachment.id _ ': ' _ attachment.description %]
flag.target.attachment.summary %]
[% statuses = { '+' => "granted" , '-' => 'denied' , 'X' => "cancelled" ,
[% statuses = { '+' => "granted" , '-' => 'denied' , 'X' => "cancelled" ,
'?' => "asked" } %]
'?' => "asked" } %]
[% IF flag.status == '?' %]
[% IF flag.status == '?' %]
...
@@ -39,9 +38,9 @@
...
@@ -39,9 +38,9 @@
[% END %]
[% END %]
From: bugzilla-request-daemon
From: bugzilla-request-daemon
To: [% to %]
To: [% to %]
Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+
flag.target.bug.id %]] [% flag.target.bug.summary
%]
Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+
bug.bug_id %]] [% bug.short_desc
%]
[%- IF
flag.target.attachment.exists
%] :
[%- IF
attachment
%] :
[Attachment [%
flag.target.attachment.id %]] [% flag.target.attachment.summary
%][% END %]
[Attachment [%
attachment.id %]] [% attachment.description
%][% END %]
[%+ USE wrap -%]
[%+ USE wrap -%]
[%- FILTER bullet = wrap(80) -%]
[%- FILTER bullet = wrap(80) -%]
...
@@ -50,13 +49,13 @@ Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+ flag.t
...
@@ -50,13 +49,13 @@ Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+ flag.t
[% terms.Bug %] [%+ bugidsummary %]
[% terms.Bug %] [%+ bugidsummary %]
[% END %]
[% END %]
[%+ Param('urlbase') %]show_bug.cgi?id=[%
flag.target.bug.
id %]
[%+ Param('urlbase') %]show_bug.cgi?id=[%
bug.bug_
id %]
[% IF
flag.target.attachment.exists
%]
[% IF
attachment
%]
[% FILTER bullet = wrap(80) %]
[% FILTER bullet = wrap(80) %]
Attachment [% attidsummary %]
Attachment [% attidsummary %]
[%- END %]
[%- END %]
[%+ Param('urlbase') %]attachment.cgi?id=[%
flag.target.
attachment.id %]&action=edit
[%+ Param('urlbase') %]attachment.cgi?id=[% attachment.id %]&action=edit
[%- END %]
[%- END %]
[%- FILTER bullet = wrap(80) %]
[%- FILTER bullet = wrap(80) %]
...
...
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