Closed
Bug 348539
Opened 18 years ago
Closed 18 years ago
Move CC validation out of post_bug.cgi and into Bugzilla::Bug
Categories
(Bugzilla :: Creating/Changing Bugs, enhancement)
Tracking
()
RESOLVED
FIXED
Bugzilla 3.0
People
(Reporter: mkanat, Assigned: mkanat)
References
Details
Attachments
(1 file, 2 obsolete files)
2.60 KB,
patch
|
bugzilla-mozilla
:
review+
|
Details | Diff | Splinter Review |
This should be pretty easy. We're just moving the code that converts the login_names into userids.
Assignee | ||
Comment 1•18 years ago
|
||
Once again, a very straightforward patch. Depends on the other post_bug.cgi patches I've asked you to review, but only because the patch won't apply otherwise. It doesn't actually depend on any code from the other patches.
Assignee: create-and-change → mkanat
Status: NEW → ASSIGNED
Attachment #233486 -
Flags: review?(bugzilla-mozilla)
Comment 2•18 years ago
|
||
Comment on attachment 233486 [details] [diff] [review] v1 >diff -u post_bug.cgi post_bug.cgi >@@ -257,12 +246,12 @@ > > if (Bugzilla->params->{"strict_isolation"}) { > my @blocked_users = (); >- my %related_users = %ccids; >- $related_users{$cgi->param('assigned_to')} = 1; >+ my @related_users = @cc_ids; >+ push(@related_users, $cgi->param('assigned_to')); > if (Bugzilla->params->{'useqacontact'} && $cgi->param('qa_contact')) { >- $related_users{$cgi->param('qa_contact')} = 1; >+ push(@related_users, $cgi->param('qa_contact')); > } >- foreach my $pid (keys %related_users) { >+ foreach my $pid (@related_users) { > my $related_user = Bugzilla::User->new($pid); > if (!$related_user->can_edit_product($product->id)) { > push (@blocked_users, $related_user->login); You assume @related_users is unique, while it doesn't have to be. Although strange, I could assign it to someone/myself and also put the assignee in the CC. Same for qa_contact. Rest looks good.
Attachment #233486 -
Flags: review?(bugzilla-mozilla) → review-
Comment 3•18 years ago
|
||
Oh, and a general comment.. in some of the patches you do 'scalar $cgi->param', while here you pass $cgi->param directly. Wouldn't it be easier to have the _check functions deal with that?
Comment 4•18 years ago
|
||
PS2: Wouldn't match_field have validated the CC field?
Comment 5•18 years ago
|
||
If it's a scalar, you must write scalar $cgi->param('foo'). Consider this: my_function($cgi->param('foo'), $cgi->param('bar')); sub my_function { my ($foo, $bar) = @_; ... } If $cgi->param('foo') is undefined, then you will get: $foo = $cgi->param('bar') $bar = undef which is not what you want. If you explicitly write 'scalar', then you get what you expected.
Assignee | ||
Comment 6•18 years ago
|
||
(In reply to comment #3) > Oh, and a general comment.. in some of the patches you do 'scalar $cgi->param', > while here you pass $cgi->param directly. Wouldn't it be easier to have the > _check functions deal with that? And yeah, it's as LpSolit said. However, I think you could be right in that what I *should* do is make the non-undef field the *first* param, and then the second param can be undef. (In reply to comment #4) > PS2: Wouldn't match_field have validated the CC field? Yes, but we shouldn't depend on that for internal functions in Bugzilla::Bug, particularly as they'll probably be used by the webservice API.
Assignee | ||
Comment 7•18 years ago
|
||
Also, the validator converts logins to IDs, where the match function only converts partial logins to full logins. I fixed the comment.
Attachment #233486 -
Attachment is obsolete: true
Attachment #234681 -
Flags: review?(bugzilla-mozilla)
Comment 8•18 years ago
|
||
Comment on attachment 234681 [details] [diff] [review] v2 >Index: post_bug.cgi >- foreach my $pid (keys %related_users) { >+ # For each unique user in @related_users... >+ foreach my $pid (keys(map {$_ => 1} @related_users)) { # Failed test 'post_bug.cgi --ERROR' # in t/001compile.t at line 101. not ok 33 - post_bug.cgi --ERROR Type of arg 1 to keys must be hash (not map iterator) at post_bug.cgi line 271, near "@related_users)" post_bug.cgi had compilation errors.
Attachment #234681 -
Flags: review?(bugzilla-mozilla) → review-
Assignee | ||
Comment 9•18 years ago
|
||
Oh! :-) I fixed it. :-) (I had tested process_bug accidentally instead of post_bug, before.)
Attachment #234681 -
Attachment is obsolete: true
Attachment #234792 -
Flags: review?(bugzilla-mozilla)
Updated•18 years ago
|
Attachment #234792 -
Flags: review?(bugzilla-mozilla) → review+
Updated•18 years ago
|
Flags: approval?
Updated•18 years ago
|
Flags: approval? → approval+
Assignee | ||
Comment 10•18 years ago
|
||
Checking in post_bug.cgi; /cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v <-- post_bug.cgi new revision: 1.164; previous revision: 1.163 done Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.138; previous revision: 1.137 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•