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
e0c777f3
Commit
e0c777f3
authored
Sep 10, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 351345: Move keyword insertion out of post_bug.cgi and into Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
parent
bb61c992
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
Bug.pm
Bugzilla/Bug.pm
+16
-3
post_bug.cgi
post_bug.cgi
+1
-20
No files found.
Bugzilla/Bug.pm
View file @
e0c777f3
...
...
@@ -118,6 +118,7 @@ sub VALIDATORS {
cc
=>
\&
_check_cc
,
deadline
=>
\&
_check_deadline
,
estimated_time
=>
\&
_check_estimated_time
,
keywords
=>
\&
_check_keywords
,
op_sys
=>
\&
_check_op_sys
,
priority
=>
\&
_check_priority
,
product
=>
\&
_check_product
,
...
...
@@ -249,6 +250,11 @@ sub create {
my
$groups
=
$params
->
{
groups
};
delete
$params
->
{
groups
};
# Set up the keyword cache for bug creation.
my
$keywords
=
$params
->
{
keywords
};
$params
->
{
keywords
}
=
join
(
', '
,
sort
{
lc
(
$a
)
cmp
lc
(
$b
)}
map
(
$_
->
name
,
@$keywords
));
my
$bug
=
$class
->
insert_create_data
(
$params
);
# Add the group restrictions
...
...
@@ -264,6 +270,13 @@ sub create {
$sth_cc
->
execute
(
$bug
->
bug_id
,
$user_id
);
}
# Add in keywords
my
$sth_keyword
=
$dbh
->
prepare
(
'INSERT INTO keywords (bug_id, keywordid) VALUES (?, ?)'
);
foreach
my
$keyword_id
(
map
(
$_
->
id
,
@$keywords
))
{
$sth_keyword
->
execute
(
$bug
->
bug_id
,
$keyword_id
);
}
return
$bug
;
}
...
...
@@ -585,14 +598,14 @@ sub _check_keywords {
$keyword_string
=
trim
(
$keyword_string
);
return
[]
if
(
!
$keyword_string
||
!
Bugzilla
->
user
->
in_group
(
'editbugs'
));
my
%
keyword
_id
s
;
my
%
keywords
;
foreach
my
$keyword
(
split
(
/[\s,]+/
,
$keyword_string
))
{
next
unless
$keyword
;
my
$obj
=
new
Bugzilla::
Keyword
({
name
=>
$keyword
});
ThrowUserError
(
"unknown_keyword"
,
{
keyword
=>
$keyword
})
if
!
$obj
;
$keyword
_ids
{
$obj
->
id
}
=
1
;
$keyword
s
{
$obj
->
id
}
=
$obj
;
}
return
[
keys
%
keyword_i
ds
];
return
[
values
%
keywor
ds
];
}
sub
_check_product
{
...
...
post_bug.cgi
View file @
e0c777f3
...
...
@@ -130,8 +130,6 @@ $comment = Bugzilla::Bug->_check_comment($cgi->param('comment'));
# OK except for the fact that it causes e-mail to be suppressed.
$comment
=
$comment
?
$comment
:
" "
;
my
@keyword_ids
=
@
{
Bugzilla::
Bug
->
_check_keywords
(
$cgi
->
param
(
'keywords'
))};
my
(
$depends_on_ids
,
$blocks_ids
)
=
Bugzilla::
Bug
->
_check_dependencies
(
scalar
$cgi
->
param
(
'dependson'
),
scalar
$cgi
->
param
(
'blocked'
));
...
...
@@ -166,6 +164,7 @@ push(@bug_fields, qw(
bug_file_loc
bug_severity
bug_status
keywords
short_desc
op_sys
priority
...
...
@@ -215,25 +214,7 @@ $dbh->do(q{INSERT INTO longdescs (bug_id, who, bug_when, thetext,isprivate)
$comment
,
$privacy
));
my
@all_deps
;
my
$sth_addkeyword
=
$dbh
->
prepare
(
q{
INSERT INTO keywords (bug_id, keywordid) VALUES (?, ?)}
);
if
(
Bugzilla
->
user
->
in_group
(
"editbugs"
))
{
foreach
my
$keyword
(
@keyword_ids
)
{
$sth_addkeyword
->
execute
(
$id
,
$keyword
);
}
if
(
@keyword_ids
)
{
# Make sure that we have the correct case for the kw
my
$kw_ids
=
join
(
', '
,
@keyword_ids
);
my
$list
=
$dbh
->
selectcol_arrayref
(
qq{
SELECT name
FROM keyworddefs
WHERE id IN ($kw_ids)
ORDER BY name}
);
my
$kw_list
=
join
(
', '
,
@$list
);
$dbh
->
do
(
q{UPDATE bugs
SET delta_ts = ?, keywords = ?
WHERE bug_id = ?}
,
undef
,
(
$timestamp
,
$kw_list
,
$id
));
}
if
(
$cgi
->
param
(
'dependson'
)
||
$cgi
->
param
(
'blocked'
))
{
my
%
deps
=
(
dependson
=>
$depends_on_ids
,
blocked
=>
$blocks_ids
);
foreach
my
$pair
([
"blocked"
,
"dependson"
],
[
"dependson"
,
"blocked"
])
{
...
...
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