Closed Bug 622203 Opened 14 years ago Closed 13 years ago

Allow filing closed bugs via the WebService

Categories

(Bugzilla :: WebService, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: mkanat, Assigned: mkanat)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 5 obsolete files)

This is simpler than bug 399483--we just have to fix the backend and update the POD. Basically this just involves allowing Bugzilla::Bug to use the validators when $invocant is a class.
Attached patch Work In Progress (obsolete) — Splinter Review
This is a bit more work than I anticipated, because there are lots of things that _check_resolution depends on.

I've decided that, for now, I'm not going to make filing new bugs as DUPLICATE work. But all other resolutions and _check_resolution stuff will still work.
Assignee: webservice → mkanat
Status: NEW → ASSIGNED
Attached patch v1 (obsolete) — Splinter Review
All right, here's a patch that allows filing closed bugs via the WebService, but not yet via the enter_bug UI. (Note that enter_bug already filters out closed statuses in its code, so we don't have to worry about modifying it.)

I had to update the way that _check_dependencies works, also, so that "blocked" and "dependson" could go into VALIDATOR_DEPENDENCIES (since they now have to be checked before "resolution" when a bug is filed, due to noresolveonopenblockers).
Attachment #500432 - Attachment is obsolete: true
Attachment #500494 - Flags: review?(LpSolit)
Attached patch v2 (obsolete) — Splinter Review
v1 broke filing new bugs with a dependson value, and also had a bad error message for noresolveonopenblockers for new bugs.
Attachment #500494 - Attachment is obsolete: true
Attachment #500496 - Flags: review?(LpSolit)
Attachment #500494 - Flags: review?(LpSolit)
Attached patch v2.1 (obsolete) — Splinter Review
I removed an incorrect comment that I had added, about commentonchange_resolution.
Attachment #500496 - Attachment is obsolete: true
Attachment #500498 - Flags: review?(LpSolit)
Attachment #500496 - Flags: review?(LpSolit)
Attachment #500498 - Flags: review?(LpSolit) → review?(dkl)
dkl: Any hope of getting a review on this? It's been waiting a LONG time.
Comment on attachment 500498 [details] [diff] [review]
v2.1

Review of attachment 500498 [details] [diff] [review]:
-----------------------------------------------------------------

Overall my testing has been positive with this patch except for the bug I found which I commented on below.

::: Bugzilla/Bug.pm
@@ +1450,5 @@
> +    my ($invocant, $new_value, $field, $params) = @_;
> +
> +    my $has_comment = ref($invocant) ? $invocant->{added_comments} 
> +                                     : (defined $params->{comment}
> +                                        and $params->{comment} ne '');

$params->{'comment'} is a hash by this point with an empty value for 'thetext' if the user omitted a comment on Bug.create. So this never throws error.
Attachment #500498 - Flags: review?(dkl) → review-
Target Milestone: Bugzilla 4.2 → Bugzilla 5.0
Attached patch v3 (obsolete) — Splinter Review
Thanks for the review, and thanks for catching that bug! I've updated the code exactly as you suggested.
Attachment #500498 - Attachment is obsolete: true
Attachment #535777 - Flags: review?(dkl)
Comment on attachment 535777 [details] [diff] [review]
v3

Review of attachment 535777 [details] [diff] [review]:
-----------------------------------------------------------------

In addition to my comment below, user-error.html.tmpl in error == 'comment_required', the template is
looking for old.name and new.name. _check_commenton is passing the actual values and not an object so
when the error displays, you get blank values.

dkl

::: Bugzilla/Bug.pm
@@ +1470,5 @@
> +
> +    if ($is_changing && !$has_comment) {
> +        my $old_value = ref($invocant) ? $invocant->$field : undef;
> +        ThrowUserError('comment_required',
> +                       { old => $old_value, new => $new_value });

When closing an existing bug report that is currently open, to a closed state with resolution, you get the wrong error message.

When closing a bug, old_value will be empty and new_value will not be empty. So the error generated by user-error.html.tmpl will be 

"You have to specify a description for this bug" 

which is what should happend for a new bug, not an existing one.  Instead something like 

"You have to specify a comment when changing the status to RESOLVED"

The template is looking for [% IF old && new %] which is why the wrong error is occurring.
Attachment #535777 - Flags: review?(dkl) → review-
Attached patch v4Splinter Review
Ah, good point. Okay, here's my attempt to address that issue. My solution isn't perfect; let me know if you have any thoughts or suggestions.
Attachment #535777 - Attachment is obsolete: true
Attachment #537672 - Flags: review?(dkl)
Comment on attachment 537672 [details] [diff] [review]
v4

Review of attachment 537672 [details] [diff] [review]:
-----------------------------------------------------------------

I think the solution you came up with is acceptable and works as expected. r=dkl
Attachment #537672 - Flags: review?(dkl) → review+
Flags: approval?
Comment on attachment 537672 [details] [diff] [review]
v4

>=== modified file 'Bugzilla/WebService/Bug.pm'

>+=item The ability to file new bugs with a C<resolution> was added in
>+Bugzilla B<4.2>.

4.2 -> 5.0 (or 4.4 for now).
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/
modified editworkflow.cgi
modified Bugzilla/Bug.pm
modified Bugzilla/WebService/Bug.pm
modified template/en/default/admin/workflow/edit.html.tmpl                     
modified template/en/default/global/user-error.html.tmpl                       
Committed revision 7905
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: approval? → approval+
Resolution: --- → FIXED
Keywords: relnote
Flags: testcase?
Added to the relnotes for 4.4.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: