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
504a510d
Commit
504a510d
authored
Dec 21, 2006
by
lpsolit%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 364216: Flag::retarget() is broken - Patch by FrÃ
©
dÃ
©
ric Buclin <LpSolit@gmail.com> r/a=myk
parent
8850b0dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
Flag.pm
Bugzilla/Flag.pm
+16
-13
No files found.
Bugzilla/Flag.pm
View file @
504a510d
...
...
@@ -309,7 +309,7 @@ sub validate {
ThrowCodeError
(
'flag_type_inactive'
,
{
'type'
=>
$flag_type
->
name
});
}
_validate
(
undef
,
$flag_type
,
$status
,
\
@requestees
,
$private_attachment
,
_validate
(
undef
,
$flag_type
,
$status
,
undef
,
\
@requestees
,
$private_attachment
,
$bug_id
,
$attach_id
);
}
...
...
@@ -323,15 +323,16 @@ sub validate {
my
$flag
=
new
Bugzilla::
Flag
(
$id
);
$flag
||
ThrowCodeError
(
"flag_nonexistent"
,
{
id
=>
$id
});
_validate
(
$flag
,
$flag
->
type
,
$status
,
\
@requestees
,
$private_attachment
);
_validate
(
$flag
,
$flag
->
type
,
$status
,
undef
,
\
@requestees
,
$private_attachment
);
}
}
sub
_validate
{
my
(
$flag
,
$flag_type
,
$status
,
$requestees
,
$private_attachment
,
my
(
$flag
,
$flag_type
,
$status
,
$
setter
,
$
requestees
,
$private_attachment
,
$bug_id
,
$attach_id
)
=
@_
;
my
$user
=
Bugzilla
->
user
;
# By default, the flag setter (or requester) is the current user.
$setter
||=
Bugzilla
->
user
;
my
$id
=
$flag
?
$flag
->
id
:
$flag_type
->
id
;
# Used in the error messages below.
$bug_id
||=
$flag
->
bug_id
;
...
...
@@ -430,10 +431,10 @@ sub _validate {
# - User in the request_group can clear pending requests and set flags
# and can rerequest set flags.
return
if
((
$status
eq
'X'
||
$status
eq
'?'
)
&&
$
us
er
->
can_request_flag
(
$flag_type
));
&&
$
sett
er
->
can_request_flag
(
$flag_type
));
# - User in the grant_group can set/clear flags, including "+" and "-".
return
if
$
us
er
->
can_set_flag
(
$flag_type
);
return
if
$
sett
er
->
can_set_flag
(
$flag_type
);
# - Any other flag modification is denied
ThrowUserError
(
'flag_update_denied'
,
...
...
@@ -801,27 +802,29 @@ sub retarget {
# If we found at least one, change the type of the flag,
# assuming the setter/requester is allowed to set/request flags
# belonging to this flagtype.
my
$requestee
=
$flag
->
requestee
?
[
$flag
->
requestee
->
login
]
:
[]
;
my
$attach_id
=
$attachment
?
$attachment
->
id
:
undef
;
my
$is_private
=
$attachment
?
$attachment
->
isprivate
:
0
;
my
$is_retargetted
=
0
;
foreach
my
$flagtype
(
@$flagtypes
)
{
# Get the number of flags of this type already set for this target.
my
$has_flags
=
count
(
{
'type_id'
=>
$flag
->
type
->
id
,
{
'type_id'
=>
$flagtype
->
id
,
'target_type'
=>
$attachment
?
'attachment'
:
'bug'
,
'bug_id'
=>
$bug
->
bug_id
,
'attach_id'
=>
$attach
ment
?
$attachment
->
id
:
undef
});
'attach_id'
=>
$attach
_id
});
# Do not create a new flag of this type if this flag type is
# not multiplicable and already has a flag set.
next
if
(
!
$flag
->
type
->
is_multiplicable
&&
$has_flags
);
next
if
(
!
$flagtype
->
is_multiplicable
&&
$has_flags
);
# Check user privileges.
my
$error_mode_cache
=
Bugzilla
->
error_mode
;
Bugzilla
->
error_mode
(
ERROR_MODE_DIE
);
eval
{
my
$requestee
=
$flag
->
requestee
?
[
$flag
->
requestee
->
login
]
:
[]
;
my
$is_private
=
$attachment
?
$attachment
->
isprivate
:
0
;
_validate
(
$flag
,
$flag
->
type
,
$flag
->
status
,
$flag
->
setter
,
$requestee
,
$is_private
);
_validate
(
undef
,
$flagtype
,
$flag
->
status
,
$flag
->
setter
,
$requestee
,
$is_private
,
$bug
->
bug_id
,
$attach_id
);
};
Bugzilla
->
error_mode
(
$error_mode_cache
);
# If the validation failed, then we cannot use this flagtype.
...
...
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