Closed Bug 413184 Opened 17 years ago Closed 16 years ago

Unify all of the update_ functions in Bugzilla::Bug

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

3.1.2
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file)

While we were re-writing process_bug, we had to create several different update_ functions that added things to the database at different times. Now that we're all done, we can unify them all into update().
Attached patch v1Splinter Review
Okay, this is a pretty nice cleanup.

I've tested this.
Assignee: create-and-change → mkanat
Status: NEW → ASSIGNED
Attachment #311481 - Flags: review?(LpSolit)
Comment on attachment 311481 [details] [diff] [review]
v1

>Index: process_bug.cgi

>-    my @all_changed_deps = map { @$_ } @{$dep_changes->{'dependson'}};
>-    push(@all_changed_deps, map { @$_ } @{$dep_changes->{'blocked'}});
>-    my %changed_deps = map { $_ => 1 } @all_changed_deps;

>+    my $all_changed_deps = join(', ', @{ $changes->{'dependson'} || [] });
>+    $all_changed_deps = join(', ', @{ $changes->{'blocked'} || [] },
>+                                   $all_changed_deps);
>+    my %changed_deps = map { $_ => 1 } split(', ', $all_changed_deps);
>+    delete $changed_deps{''};

Nit: not sure this is clearer than what was done before. Also, you could write ',' instead of ', ' as you split on it right after and this string is never passed to the UI.


>+        cc        => [split(/,\s/, $old_cc)],

Nit: split(/[\s,]+/, $old_cc) would be safer IMO (unless commas are allowed in email addresses?).


Otherwise looks good and works fine. r=LpSolit
Attachment #311481 - Flags: review?(LpSolit) → review+
Flags: approval+
(In reply to comment #2)
> Nit: not sure this is clearer than what was done before. Also, you could write
> ',' instead of ', ' as you split on it right after and this string is never
> passed to the UI.

  It's not an issue of being clearer than before. Before we were getting arrays of arrays, now we're getting arrays of strings, so we have to actually have different code.

> Nit: split(/[\s,]+/, $old_cc) would be safer IMO (unless commas are allowed in
> email addresses?).

  Will do.
Did the fix on checkin.

Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.408; previous revision: 1.407
done
Checking in Bugzilla/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v  <--  Bug.pm
new revision: 1.237; previous revision: 1.236
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: