From: byron jones Date: Wed, 13 Nov 2019 20:23:55 +0000 (+0800) Subject: Bug 1594844 - Automatically set the bug's assignee when they upload a revision to... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afb023eeb58d317ea0ddc1fe870011c33e09312d;p=thirdparty%2Fbugzilla.git Bug 1594844 - Automatically set the bug's assignee when they upload a revision to an unassigned bug --- diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index c81069367..d61f47a80 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -90,6 +90,9 @@ sub create_revision_attachment { ); delete $bug->{attachments}; + # Assign the bug to the submitter if it isn't already owned. + $bug->set_assigned_to($submitter) unless is_bug_assigned($bug); + return $attachment; } @@ -104,8 +107,7 @@ sub get_bug_role_phids { my ($bug) = $check->(@_); my @bug_users = ($bug->reporter); - push(@bug_users, $bug->assigned_to) - if $bug->assigned_to->email !~ /^nobody\@mozilla\.org$/; + push(@bug_users, $bug->assigned_to) if is_bug_assigned($bug); push(@bug_users, $bug->qa_contact) if $bug->qa_contact; push(@bug_users, @{$bug->cc_users}) if @{$bug->cc_users}; @@ -115,6 +117,10 @@ sub get_bug_role_phids { return [map { $_->phid } @{$phab_users}]; } +sub is_bug_assigned { + return $_[0]->assigned_to->email ne 'nobody@mozilla.org'; +} + sub is_attachment_phab_revision { state $check = compile(Attachment); my ($attachment) = $check->(@_);