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
$cgi
->
param
(
'isprivate'
,
$cgi
->
param
(
'isprivate'
)
?
1
:
0
);
}
sub
validateObsolete
{
my
@obsolete_ids
=
();
my
$dbh
=
Bugzilla
->
dbh
;
sub
validateObsolete
{
# Make sure the attachment id is valid and the user has permissions to view
# the bug to which it is attached.
my
@obsolete_attachments
;
foreach
my
$attachid
(
$cgi
->
param
(
'obsolete'
))
{
my
$vars
=
{};
$vars
->
{
'attach_id'
}
=
$attachid
;
detaint_natural
(
$attachid
)
||
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.
ThrowUserError
(
"invalid_attach_id"
,
$vars
)
unless
$bugid
;
my
$attachment
=
Bugzilla::
Attachment
->
get
(
$attachid
);
# Make sure the attachment exists in the database.
ThrowUserError
(
"invalid_attach_id"
,
$vars
)
unless
$attachment
;
$vars
->
{
'description'
}
=
$attachment
->
description
;
$vars
->
{
'description'
}
=
$description
;
if
(
$bugid
!=
$cgi
->
param
(
'bugid'
))
{
if
(
$attachment
->
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
);
}
if
(
$isobsolete
)
{
if
(
$attachment
->
isobsolete
)
{
ThrowCodeError
(
"attachment_already_obsolete"
,
$vars
);
}
# Check that the user can modify this attachment
validateCanEdit
(
$attachid
);
push
(
@obsolete_
ids
,
$attachid
);
push
(
@obsolete_
attachments
,
$attachment
);
}
return
@obsolete_ids
;
return
@obsolete_attachments
;
}
# Returns 1 if the parameter is a content-type viewable in this browser
...
...
@@ -797,8 +787,8 @@ sub insert
$bugid
,
$user
,
$timestamp
,
\
$vars
);
my
$isprivate
=
$cgi
->
param
(
'isprivate'
)
?
1
:
0
;
my
@obsolete_
ids
=
()
;
@obsolete_
id
s
=
validateObsolete
()
if
$cgi
->
param
(
'obsolete'
);
my
@obsolete_
attachments
;
@obsolete_
attachment
s
=
validateObsolete
()
if
$cgi
->
param
(
'obsolete'
);
# Insert a comment about the new attachment into the database.
my
$comment
=
"Created an attachment (id=$attachid)\n"
.
...
...
@@ -809,17 +799,19 @@ sub insert
# Make existing attachments obsolete.
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.
# 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 "
.
"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,
fieldid, removed, added)
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
...
...
@@ -865,7 +857,10 @@ sub insert
}
# 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.
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
,
...
...
@@ -963,8 +958,9 @@ sub update
Bugzilla::Flag::
validate
(
$cgi
,
$bugid
,
$attach_id
);
Bugzilla::FlagType::
validate
(
$cgi
,
$bugid
,
$attach_id
);
# Lock database tables in preparation for updating the attachment.
$dbh
->
bz_lock_tables
(
'attachments WRITE'
,
'flags WRITE'
,
my
$bug
=
new
Bugzilla::
Bug
(
$bugid
,
$userid
);
# Lock database tables in preparation for updating the attachment.
$dbh
->
bz_lock_tables
(
'attachments WRITE'
,
'flags WRITE'
,
'flagtypes READ'
,
'fielddefs READ'
,
'bugs_activity WRITE'
,
'flaginclusions AS i READ'
,
'flagexclusions AS e READ'
,
# cc, bug_group_map, user_group_map, and groups are in here so we
...
...
@@ -974,7 +970,7 @@ sub update
# Bugzilla::User can flatten groups.
'bugs WRITE'
,
'profiles READ'
,
'email_setting 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
# so we can record those changes in the activity table.
...
...
@@ -999,7 +995,8 @@ sub update
# to attachments so that we can delete pending requests if the user
# is obsoleting this attachment without deleting any requests
# 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.
$dbh
->
do
(
"UPDATE attachments
...
...
editflagtypes.cgi
View file @
4c74fbe0
...
...
@@ -41,6 +41,8 @@ use Bugzilla::Group;
use
Bugzilla::
Util
;
use
Bugzilla::
Product
;
use
Bugzilla::
Component
;
use
Bugzilla::
Bug
;
use
Bugzilla::
Attachment
;
use
List::
Util
qw(reduce)
;
...
...
@@ -384,10 +386,10 @@ sub update {
validateAndSubmit
(
$id
);
$dbh
->
bz_unlock_tables
();
# 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.
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
INNER JOIN bugs
ON flags.bug_id = bugs.bug_id
...
...
@@ -400,11 +402,14 @@ sub update {
WHERE flags.type_id = ?
AND i.type_id IS NULL'
,
undef
,
$id
);
foreach
my
$flag_id
(
@$flag_ids
)
{
Bugzilla::Flag::
clear
(
$flag_id
);
foreach
my
$flag
(
@$flags
)
{
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
INNER JOIN bugs
ON flags.bug_id = bugs.bug_id
...
...
@@ -416,10 +421,13 @@ sub update {
AND (bugs.component_id = e.component_id
OR e.component_id IS NULL)'
,
undef
,
$id
);
foreach
my
$flag_id
(
@$flag_ids
)
{
Bugzilla::Flag::
clear
(
$flag_id
);
foreach
my
$flag
(
@$flags
)
{
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
->
{
'message'
}
=
"flag_type_changes_saved"
;
...
...
process_bug.cgi
View file @
4c74fbe0
...
...
@@ -2122,7 +2122,7 @@ foreach my $id (@idlist) {
}
}
# Set and update flags.
Bugzilla::Flag::
process
(
$
id
,
undef
,
$timestamp
,
$cgi
);
Bugzilla::Flag::
process
(
$
new_bug_obj
,
undef
,
$timestamp
,
$cgi
);
if
(
$bug_changed
)
{
$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 @@
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on [% terms.bug %]
[%+ 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,
and the user you asked isn't in all the groups to which
the [% terms.bug %] has been restricted.
...
...
@@ -463,7 +463,7 @@
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on
[%+ 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,
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.
...
...
template/en/default/request/email.txt.tmpl
View file @
4c74fbe0
...
...
@@ -23,9 +23,8 @@
[% PROCESS global/variables.none.tmpl %]
[% bugidsummary = flag.target.bug.id _ ': ' _ flag.target.bug.summary %]
[% attidsummary = flag.target.attachment.id _ ': ' _
flag.target.attachment.summary %]
[% bugidsummary = bug.bug_id _ ': ' _ bug.short_desc %]
[% attidsummary = attachment.id _ ': ' _ attachment.description %]
[% statuses = { '+' => "granted" , '-' => 'denied' , 'X' => "cancelled" ,
'?' => "asked" } %]
[% IF flag.status == '?' %]
...
...
@@ -39,9 +38,9 @@
[% END %]
From: bugzilla-request-daemon
To: [% to %]
Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+
flag.target.bug.id %]] [% flag.target.bug.summary
%]
[%- IF
flag.target.attachment.exists
%] :
[Attachment [%
flag.target.attachment.id %]] [% flag.target.attachment.summary
%][% END %]
Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+
bug.bug_id %]] [% bug.short_desc
%]
[%- IF
attachment
%] :
[Attachment [%
attachment.id %]] [% attachment.description
%][% END %]
[%+ USE wrap -%]
[%- FILTER bullet = wrap(80) -%]
...
...
@@ -50,13 +49,13 @@ Subject: [% flag.type.name %] [%+ subject_status %]: [[% terms.Bug %] [%+ flag.t
[% terms.Bug %] [%+ bugidsummary %]
[% END %]
[%+ Param('urlbase') %]show_bug.cgi?id=[%
flag.target.bug.
id %]
[% IF
flag.target.attachment.exists
%]
[%+ Param('urlbase') %]show_bug.cgi?id=[%
bug.bug_
id %]
[% IF
attachment
%]
[% FILTER bullet = wrap(80) %]
Attachment [% attidsummary %]
[%- END %]
[%+ Param('urlbase') %]attachment.cgi?id=[%
flag.target.
attachment.id %]&action=edit
[%+ Param('urlbase') %]attachment.cgi?id=[% attachment.id %]&action=edit
[%- END %]
[%- 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