Commit 7d2c2264 authored by wicked%sci.fi's avatar wicked%sci.fi

Bug 333648: Add flag change to activity log and bugmail when only setter is…

Bug 333648: Add flag change to activity log and bugmail when only setter is changed - Patch by Teemu Mannermaa <wicked@sci.fi> r/a=LpSolit
parent 1708f41a
...@@ -515,7 +515,7 @@ sub snapshot { ...@@ -515,7 +515,7 @@ sub snapshot {
'attach_id' => $attach_id }); 'attach_id' => $attach_id });
my @summaries; my @summaries;
foreach my $flag (@$flags) { foreach my $flag (@$flags) {
my $summary = $flag->type->name . $flag->status; my $summary = $flag->setter->nick . ':' . $flag->type->name . $flag->status;
$summary .= "(" . $flag->requestee->login . ")" if $flag->requestee; $summary .= "(" . $flag->requestee->login . ")" if $flag->requestee;
push(@summaries, $summary); push(@summaries, $summary);
} }
...@@ -625,10 +625,13 @@ sub update_activity { ...@@ -625,10 +625,13 @@ sub update_activity {
my ($bug_id, $attach_id, $timestamp, $old_summaries, $new_summaries) = @_; my ($bug_id, $attach_id, $timestamp, $old_summaries, $new_summaries) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
$old_summaries = join(", ", @$old_summaries); my ($removed, $added) = diff_arrays($old_summaries, $new_summaries);
$new_summaries = join(", ", @$new_summaries); if (scalar @$removed || scalar @$added) {
my ($removed, $added) = diff_strings($old_summaries, $new_summaries); # Remove flag requester/setter information
if ($removed ne $added) { foreach (@$removed, @$added) { s/^\S+:// }
$removed = join(", ", @$removed);
$added = join(", ", @$added);
my $field_id = get_field_id('flagtypes.name'); my $field_id = get_field_id('flagtypes.name');
$dbh->do('INSERT INTO bugs_activity $dbh->do('INSERT INTO bugs_activity
(bug_id, attach_id, who, bug_when, fieldid, removed, added) (bug_id, attach_id, who, bug_when, fieldid, removed, added)
......
...@@ -37,7 +37,7 @@ use base qw(Exporter); ...@@ -37,7 +37,7 @@ use base qw(Exporter);
css_class_quote html_light_quote url_decode css_class_quote html_light_quote url_decode
i_am_cgi get_netaddr correct_urlbase i_am_cgi get_netaddr correct_urlbase
lsearch ssl_require_redirect use_attachbase lsearch ssl_require_redirect use_attachbase
diff_arrays diff_strings diff_arrays
trim wrap_hard wrap_comment find_wrap_point trim wrap_hard wrap_comment find_wrap_point
format_time format_time_decimal validate_date format_time format_time_decimal validate_date
validate_time validate_time
...@@ -345,23 +345,6 @@ sub trim { ...@@ -345,23 +345,6 @@ sub trim {
return $str; return $str;
} }
sub diff_strings {
my ($oldstr, $newstr) = @_;
# Split the old and new strings into arrays containing their values.
$oldstr =~ s/[\s,]+/ /g;
$newstr =~ s/[\s,]+/ /g;
my @old = split(" ", $oldstr);
my @new = split(" ", $newstr);
my ($rem, $add) = diff_arrays(\@old, \@new);
my $removed = join (", ", @$rem);
my $added = join (", ", @$add);
return ($removed, $added);
}
sub wrap_comment { sub wrap_comment {
my ($comment, $cols) = @_; my ($comment, $cols) = @_;
my $wrappedcomment = ""; my $wrappedcomment = "";
...@@ -681,7 +664,6 @@ Bugzilla::Util - Generic utility functions for bugzilla ...@@ -681,7 +664,6 @@ Bugzilla::Util - Generic utility functions for bugzilla
# Functions for manipulating strings # Functions for manipulating strings
$val = trim(" abc "); $val = trim(" abc ");
($removed, $added) = diff_strings($old, $new);
$wrapped = wrap_comment($comment); $wrapped = wrap_comment($comment);
# Functions for formatting time # Functions for formatting time
...@@ -862,14 +844,6 @@ If the item is not in the list, returns -1. ...@@ -862,14 +844,6 @@ If the item is not in the list, returns -1.
Removes any leading or trailing whitespace from a string. This routine does not Removes any leading or trailing whitespace from a string. This routine does not
modify the existing string. modify the existing string.
=item C<diff_strings($oldstr, $newstr)>
Takes two strings containing a list of comma- or space-separated items
and returns what items were removed from or added to the new one,
compared to the old one. Returns a list, where the first entry is a scalar
containing removed items, and the second entry is a scalar containing added
items.
=item C<wrap_hard($string, $size)> =item C<wrap_hard($string, $size)>
Wraps a string, so that a line is I<never> longer than C<$size>. Wraps a string, so that a line is I<never> longer than C<$size>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment