diff options
author | Byron Jones <glob@mozilla.com> | 2015-06-10 07:32:16 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-06-10 07:32:16 +0200 |
commit | 869a610c29cdfc1450c9d9f3cea15416953338f0 (patch) | |
tree | 7c95b2dcf88fd4ee55aa54f6b0c86c07a4c53571 /extensions/BugModal/lib | |
parent | 2b4dfa90922be824b0e1c13267c1c481a3ad62ea (diff) | |
download | bugzilla-869a610c29cdfc1450c9d9f3cea15416953338f0.tar.gz bugzilla-869a610c29cdfc1450c9d9f3cea15416953338f0.tar.xz |
Bug 1146769: cc activity isn't shown
Diffstat (limited to 'extensions/BugModal/lib')
-rw-r--r-- | extensions/BugModal/lib/ActivityStream.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm index 4d399854f..b66352031 100644 --- a/extensions/BugModal/lib/ActivityStream.pm +++ b/extensions/BugModal/lib/ActivityStream.pm @@ -24,10 +24,12 @@ use Bugzilla::Constants; # user_id => actor user-id # comment => optional, comment added # id => unique identifier for this change-set +# cc_only => boolean # activty => [ # { # who => user object # when => time (string) +# cc_only => boolean # changes => [ # { # fieldname => field name :) @@ -55,7 +57,7 @@ sub activity_stream { foreach my $change_set (@$stream) { $change_set->{id} = $change_set->{comment} ? 'c' . $change_set->{comment}->count - : 'a' . ($change_set->{time} - $base_time) . '.' . $change_set->{user_id}; + : 'a' . ($change_set->{time} - $base_time) . '_' . $change_set->{user_id}; $change_set->{activity} = [ sort { $a->{fieldname} cmp $b->{fieldname} } @{ $change_set->{activity} } @@ -91,6 +93,7 @@ sub _add_activity_to_stream { my ($stream, $time, $user_id, $data) = @_; foreach my $entry (@$stream) { next unless $entry->{time} == $time && $entry->{user_id} == $user_id; + $entry->{cc_only} = $entry->{cc_only} && $data->{cc_only}; push @{ $entry->{activity} }, $data; return; } @@ -98,6 +101,7 @@ sub _add_activity_to_stream { time => $time, user_id => $user_id, comment => undef, + cc_only => $data->{cc_only}, activity => [ $data ], }; } @@ -138,13 +142,13 @@ sub _add_activities_to_stream { # envelope, augment and tweak foreach my $operation (@$raw_activity) { - # until we can toggle their visibility, skip CC changes - $operation->{changes} = [ grep { $_->{fieldname} ne 'cc' } @{ $operation->{changes} } ]; - next unless @{ $operation->{changes} }; # make operation.who an object $operation->{who} = Bugzilla::User->new({ name => $operation->{who}, cache => 1 }); + # we need to track operations which are just cc changes + $operation->{cc_only} = 1; + for (my $i = 0; $i < scalar(@{$operation->{changes}}); $i++) { my $change = $operation->{changes}->[$i]; @@ -245,6 +249,11 @@ sub _add_activities_to_stream { } $i--; } + + # track cc-only + if ($change->{fieldname} ne 'cc') { + $operation->{cc_only} = 0; + } } _add_activity_to_stream($stream, date_str_to_time($operation->{when}), $operation->{who}->id, $operation); |