From: Kohei Yoshino Date: Tue, 21 May 2019 00:38:10 +0000 (-0400) Subject: Bug 1514000 - Suppress duplicated changes in bug history made at the same time mainly... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fdf6bc6835c9c24ab72bf654837c6b20fcd1e0b;p=thirdparty%2Fbugzilla.git Bug 1514000 - Suppress duplicated changes in bug history made at the same time mainly due to mid-air collisions --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 25cbadb28..c3c627f84 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -4554,8 +4554,10 @@ sub GetBugActivity { $suppwhere = "AND COALESCE(attachments.isprivate, 0) = 0"; } + # Use DISTINCT and value comparison to suppress duplicated changes weirdly + # made at the same time by the same user my $query - = "SELECT fielddefs.name, bugs_activity.attach_id, " + = "SELECT DISTINCT fielddefs.name, bugs_activity.attach_id, " . $dbh->sql_date_format('bugs_activity.bug_when', '%Y.%m.%d %H:%i:%s') . " AS bug_when, bugs_activity.removed, bugs_activity.added, profiles.login_name, bugs_activity.comment_id @@ -4566,6 +4568,7 @@ sub GetBugActivity { INNER JOIN profiles ON profiles.userid = bugs_activity.who WHERE bugs_activity.bug_id = ? + AND bugs_activity.removed != bugs_activity.added $datepart $attachpart $suppwhere "; @@ -4619,6 +4622,17 @@ sub GetBugActivity { = @$entry; my %change; my $activity_visible = 1; + my $last_change = @$changes[-1] || {}; + + # Suppress any mid-air collision + if ( $when eq $operation->{'when'} + && $fieldname eq $last_change->{'fieldname'} + && $removed eq $last_change->{'removed'} + && $added eq $last_change->{'added'} + && $attachid eq $last_change->{'attachid'}) + { + next; + } # check if the user should see this field's activity if ( $fieldname eq 'remaining_time'