Repository navigation
Bug 2085398 - Read flag changes from flag_activity and stop writing them to bugs_activity #2796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
498ab61
67005a9
d48a83d
689debf
471b376
8d5afe3
347c44a
9a84beb
ecd87d9
ba54af1
a9435b0
a140f70
3b3f4ba
3cf9f6d
32f997d
ebde8bb
b33c1df
34ee87d
e18e3fa
717eb53
59fe15b
c560c65
aca6a3b
f6a636a
98f9ae8
873f583
ef867b0
ae19b88
4071ba9
66203f8
c5f3d23
f290a46
2635ec3
62a6b1b
1b51765
0059875
97fa12e
3c3fd85
6bf4021
91b8a07
ca4030c
5c3d058
3c0d478
cc875d3
715c65f
dc04011
c1c4690
af5884e
ed6ab6e
ba2af71
ff7a278
7ba522f
259baba
262c8aa
ca55922
7f1ecfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ use Bugzilla::Util; | |
| use Bugzilla::Bug; | ||
| use Bugzilla::Attachment; | ||
| use Bugzilla::Comment; | ||
| use Bugzilla::FlagActivity; | ||
| use Bugzilla::FlagType; | ||
| use Bugzilla::Logging; | ||
| use Bugzilla::Mailer; | ||
|
|
@@ -1044,12 +1045,25 @@ sub _get_diffs { | |
| my ($bug, $end, $user_cache) = @_; | ||
| my $dbh = Bugzilla->dbh; | ||
|
|
||
| my @args = ($bug->id); | ||
| my @args = ($bug->id); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: alignment is off here, looks like perltidy wasn't run.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, done with the repo's Fixed in c1c4690 |
||
| my $flag_newer = Bugzilla::FlagActivity->after_cutoff_sql('fsa'); | ||
| my $ba_before_cutoff | ||
| = Bugzilla::FlagActivity->bugs_activity_before_cutoff_sql('bugs_activity'); | ||
| my $flag_last = Bugzilla::FlagActivity->last_of_request_sql('fsa'); | ||
| my $flag_prev_id = Bugzilla::FlagActivity->previous_id_sql('fsa'); | ||
| my $flag_old_req | ||
| = $dbh->sql_string_concat('ft.name', q{'?('}, 'preq.login_name', q{')'}); | ||
| my $flag_old = $dbh->sql_string_concat('ft.name', 'prev.status'); | ||
| my $flag_new_req | ||
| = $dbh->sql_string_concat('ft.name', q{'?('}, 'req.login_name', q{')'}); | ||
| my $flag_new = $dbh->sql_string_concat('ft.name', 'fsa.status'); | ||
|
|
||
| # If lastdiffed is NULL, then we don't limit the search on time. | ||
| my $when_restriction = ''; | ||
| my $when_restriction = ''; | ||
| my $flag_when_restriction = ''; | ||
| if ($bug->lastdiffed) { | ||
| $when_restriction = ' AND bug_when > ? AND bug_when <= ?'; | ||
| $when_restriction = ' AND bug_when > ? AND bug_when <= ?'; | ||
| $flag_when_restriction = ' AND fsa.flag_when > ? AND fsa.flag_when <= ?'; | ||
| push @args, ($bug->lastdiffed, $end); | ||
| } | ||
|
|
||
|
|
@@ -1058,15 +1072,50 @@ sub _get_diffs { | |
| fielddefs.description AS field_desc, | ||
| bugs_activity.bug_when, bugs_activity.removed AS old, | ||
| bugs_activity.added AS new, bugs_activity.attach_id, | ||
| bugs_activity.comment_id, bugs_activity.who | ||
| bugs_activity.comment_id, bugs_activity.who, | ||
| bugs_activity.id AS activity_id | ||
| FROM bugs_activity | ||
| INNER JOIN fielddefs | ||
| ON fielddefs.id = bugs_activity.fieldid | ||
| WHERE bugs_activity.bug_id = ? | ||
| AND $ba_before_cutoff | ||
| $when_restriction | ||
| ORDER BY bugs_activity.bug_when, fielddefs.description", {Slice => {}}, | ||
| @args | ||
| UNION ALL | ||
| SELECT 'flagtypes.name' AS field_name, | ||
| (SELECT description FROM fielddefs WHERE name = 'flagtypes.name') AS field_desc, | ||
| fsa.flag_when AS bug_when, | ||
| CASE WHEN prev.id IS NULL THEN '' | ||
| WHEN prev.status = '?' AND preq.login_name IS NOT NULL | ||
| THEN $flag_old_req | ||
| ELSE $flag_old | ||
| END AS old, | ||
| CASE WHEN fsa.status = 'X' THEN '' | ||
| WHEN fsa.status = '?' AND req.login_name IS NOT NULL | ||
| THEN $flag_new_req | ||
| ELSE $flag_new | ||
| END AS new, | ||
| fsa.attachment_id AS attach_id, | ||
| NULL AS comment_id, | ||
| fsa.who AS who, | ||
| fsa.id AS activity_id | ||
| FROM flag_activity fsa | ||
| JOIN flagtypes ft ON ft.id = fsa.type_id | ||
| LEFT JOIN profiles req ON req.userid = fsa.requestee_id | ||
| LEFT JOIN flag_activity prev ON prev.id = $flag_prev_id | ||
| LEFT JOIN profiles preq ON preq.userid = prev.requestee_id | ||
| WHERE fsa.bug_id = ? | ||
| AND $flag_newer | ||
| AND $flag_last | ||
| $flag_when_restriction | ||
| ORDER BY bug_when, field_desc, activity_id", {Slice => {}}, @args, | ||
| $bug->id, ($bug->lastdiffed ? ($bug->lastdiffed, $end) : ()) | ||
| ); | ||
|
|
||
| # As in history, skip a request that left a flag as it was, such as a flag | ||
| # created and removed at once. | ||
| @$diffs | ||
| = grep { $_->{field_name} ne 'flagtypes.name' || $_->{old} ne $_->{new} } | ||
| @$diffs; | ||
| my $referenced_bugs = []; | ||
|
|
||
| foreach my $diff (@$diffs) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.