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
3332dda2
Commit
3332dda2
authored
Sep 12, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 351877: Move dependson/blocked insertion into Bugzilla::Bug from post_bug.cgi
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
parent
901ce06e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
22 deletions
+34
-22
Bug.pm
Bugzilla/Bug.pm
+31
-0
post_bug.cgi
post_bug.cgi
+3
-22
No files found.
Bugzilla/Bug.pm
View file @
3332dda2
...
...
@@ -249,12 +249,21 @@ sub create {
delete
$params
->
{
cc
};
my
$groups
=
$params
->
{
groups
};
delete
$params
->
{
groups
};
my
$depends_on
=
$params
->
{
dependson
};
delete
$params
->
{
dependson
};
my
$blocked
=
$params
->
{
blocked
};
delete
$params
->
{
blocked
};
# Set up the keyword cache for bug creation.
my
$keywords
=
$params
->
{
keywords
};
$params
->
{
keywords
}
=
join
(
', '
,
sort
{
lc
(
$a
)
cmp
lc
(
$b
)}
map
(
$_
->
name
,
@$keywords
));
# We don't want the bug to appear in the system until it's correctly
# protected by groups.
my
$timestamp
=
$params
->
{
creation_ts
};
delete
$params
->
{
creation_ts
};
my
$bug
=
$class
->
insert_create_data
(
$params
);
# Add the group restrictions
...
...
@@ -264,6 +273,9 @@ sub create {
$sth_group
->
execute
(
$bug
->
bug_id
,
$group_id
);
}
$dbh
->
do
(
'UPDATE bugs SET creation_ts = ? WHERE bug_id = ?'
,
undef
,
$timestamp
,
$bug
->
bug_id
);
# Add the CCs
my
$sth_cc
=
$dbh
->
prepare
(
'INSERT INTO cc (bug_id, who) VALUES (?,?)'
);
foreach
my
$user_id
(
@$cc_ids
)
{
...
...
@@ -277,6 +289,22 @@ sub create {
$sth_keyword
->
execute
(
$bug
->
bug_id
,
$keyword_id
);
}
# Set up dependencies (blocked/dependson)
my
$sth_deps
=
$dbh
->
prepare
(
'INSERT INTO dependencies (blocked, dependson) VALUES (?, ?)'
);
foreach
my
$depends_on_id
(
@$depends_on
)
{
$sth_deps
->
execute
(
$bug
->
bug_id
,
$depends_on_id
);
# Log the reverse action on the other bug.
LogActivityEntry
(
$depends_on_id
,
'blocked'
,
''
,
$bug
->
bug_id
,
$bug
->
reporter
->
id
,
$timestamp
);
}
foreach
my
$blocked_id
(
@$blocked
)
{
$sth_deps
->
execute
(
$blocked_id
,
$bug
->
bug_id
);
# Log the reverse action on the other bug.
LogActivityEntry
(
$blocked_id
,
'dependson'
,
''
,
$bug
->
bug_id
,
$bug
->
reporter
->
id
,
$timestamp
);
}
return
$bug
;
}
...
...
@@ -317,6 +345,9 @@ sub run_create_validators {
$class
->
_check_strict_isolation
(
$product
,
$params
->
{
cc
},
$params
->
{
assigned_to
},
$params
->
{
qa_contact
});
(
$params
->
{
dependson
},
$params
->
{
blocked
})
=
$class
->
_check_dependencies
(
$params
->
{
dependson
},
$params
->
{
blocked
});
return
$params
;
}
...
...
post_bug.cgi
View file @
3332dda2
...
...
@@ -130,9 +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
(
$depends_on_ids
,
$blocks_ids
)
=
Bugzilla::
Bug
->
_check_dependencies
(
scalar
$cgi
->
param
(
'dependson'
),
scalar
$cgi
->
param
(
'blocked'
));
# get current time
my
$timestamp
=
$dbh
->
selectrow_array
(
q{SELECT NOW()}
);
...
...
@@ -161,9 +158,11 @@ push(@bug_fields, qw(
qa_contact
alias
blocked
bug_file_loc
bug_severity
bug_status
dependson
keywords
short_desc
op_sys
...
...
@@ -213,24 +212,6 @@ $dbh->do(q{INSERT INTO longdescs (bug_id, who, bug_when, thetext,isprivate)
VALUES (?, ?, ?, ?, ?)}
,
undef
,
(
$id
,
$user
->
id
,
$timestamp
,
$comment
,
$privacy
));
my
@all_deps
;
if
(
Bugzilla
->
user
->
in_group
(
"editbugs"
))
{
if
(
$cgi
->
param
(
'dependson'
)
||
$cgi
->
param
(
'blocked'
))
{
my
%
deps
=
(
dependson
=>
$depends_on_ids
,
blocked
=>
$blocks_ids
);
foreach
my
$pair
([
"blocked"
,
"dependson"
],
[
"dependson"
,
"blocked"
])
{
my
(
$me
,
$target
)
=
@
{
$pair
};
my
$sth_dep
=
$dbh
->
prepare
(
qq{
INSERT INTO dependencies ($me, $target) VALUES (?, ?)}
);
foreach
my
$i
(
@
{
$deps
{
$target
}})
{
$sth_dep
->
execute
(
$id
,
$i
);
push
(
@all_deps
,
$i
);
# list for mailing dependent bugs
# Log the activity for the other bug:
LogActivityEntry
(
$i
,
$me
,
""
,
$id
,
$user
->
id
,
$timestamp
);
}
}
}
}
# All fields related to the newly created bug are set.
# The bug can now be made accessible.
$dbh
->
do
(
"UPDATE bugs SET creation_ts = ? WHERE bug_id = ?"
,
...
...
@@ -288,7 +269,7 @@ push (@{$vars->{'sentmail'}}, { type => 'created',
id
=>
$id
,
});
foreach
my
$i
(
@
all_deps
)
{
foreach
my
$i
(
@
{
$bug
->
dependson
||
[]
},
@
{
$bug
->
blocked
||
[]
}
)
{
push
(
@
{
$vars
->
{
'sentmail'
}},
{
type
=>
'dep'
,
id
=>
$i
,
});
}
...
...
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