]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1594844 - Automatically set the bug's assignee when they upload a revision to...
authorbyron jones <byron@glob.com.au>
Wed, 13 Nov 2019 20:23:55 +0000 (04:23 +0800)
committerdklawren <dklawren@users.noreply.github.com>
Wed, 13 Nov 2019 20:23:55 +0000 (15:23 -0500)
extensions/PhabBugz/lib/Util.pm

index c81069367d0bbccb71246ea055855113ce046035..d61f47a80ba8f9039dbab0cd02138fbf27f1bfd4 100644 (file)
@@ -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->(@_);