Closed Bug 522428 Opened 16 years ago Closed 16 years ago

Bugzilla::Bug->create should be case-insensitive for global select fields

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [es-lambda])

Attachments

(1 file, 2 obsolete files)

Right now, Bugzilla::Bug->create is case-sensitive for fields like priority, even though Bugzilla itself is not usually case-sensitive about those fields.
Whiteboard: [es-lambda]
Summary: Bugzilla::Bug->create should be case-insensitive for select fields → Bugzilla::Bug->create should be case-insensitive for global select fields
Attached patch v1 (obsolete) — Splinter Review
I accomplished it by using Bugzilla::Field::Choice->check, which also allowed me to do a lot of nice cleanup. Note that check_multi_select no longer has trick_taint in it because the return value of _check_single_select is untainted always.
Assignee: create-and-change → mkanat
Status: NEW → ASSIGNED
Attachment #406401 - Flags: review?(dkl)
Attachment #406401 - Flags: review?(dkl) → review-
Comment on attachment 406401 [details] [diff] [review] v1 > sub _check_multi_select_field { >+ push(@checked_values, $invocant->_check_select_field($field, $value)); Arguments are passed in the wrong order, see below. > sub _check_select_field { > my ($invocant, $value, $field) = @_; Didn't test it.
Attached patch v2 (obsolete) — Splinter Review
Thanks for catching that! :-)
Attachment #406401 - Attachment is obsolete: true
Attachment #406844 - Flags: review?(LpSolit)
Attachment #406844 - Flags: review?(LpSolit) → review+
Comment on attachment 406844 [details] [diff] [review] v2 >+ if ($resolution ne '') { >+ $resolution = $self->_check_select_field($resolution, 'resolution'); >+ } You must do this check unconditionally. At this point, it's impossible for $resolution to be ''; this is caught earlier in _check_resolution() (this subroutine isn't called for open bugs). So please remove the if () check. > sub _check_select_field { >- $value = trim($value); >+ my $object = Bugzilla::Field::Choice->type($field)->check($value); You no longer trim() the input value, meaning that e.g. 'major ' is no longer accepted as a valid severity. Bugzilla::Object->check() trims the input value to check for its existence, but that's not the value it passes to new(), so we still have to trim it somewhere. r=LpSolit with both comments fixed
Flags: approval+
Depends on: 523977
(In reply to comment #4) > You must do this check unconditionally. At this point, it's impossible for > $resolution to be ''; this is caught earlier in _check_resolution() (this > subroutine isn't called for open bugs). So please remove the if () check. Okay, I'll attach a new patch that fixes that. > You no longer trim() the input value, meaning that e.g. 'major ' is no longer > accepted as a valid severity. Bugzilla::Object->check() trims the input value > to check for its existence, but that's not the value it passes to new(), so we > still have to trim it somewhere. Ah, instead of fixing that in this patch, I've fixed it in Bugzilla::Object, in bug 519584, and I'll wait for that to go in before I check in this patch.
Attached patch v3Splinter Review
Carrying forward r+.
Attachment #406844 - Attachment is obsolete: true
Attachment #407888 - Flags: review+
Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.291; previous revision: 1.290 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: