Page MenuHomePhabricator

Ignore "Auditors: author" when inferring auditors from commit messages
ClosedPublic

Authored by epriestley on Mar 16 2017, 7:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 5:15 PM
Unknown Object (File)
Sat, Nov 16, 7:55 AM
Unknown Object (File)
Tue, Nov 12, 12:57 AM
Unknown Object (File)
Sat, Nov 9, 1:13 PM
Unknown Object (File)
Fri, Nov 8, 9:50 AM
Unknown Object (File)
Thu, Oct 24, 10:06 AM
Unknown Object (File)
Oct 18 2024, 6:30 AM
Unknown Object (File)
Oct 3 2024, 2:03 AM
Subscribers

Details

Summary

Fixes T12406. When importing commits, we automatically add auditors if the message lists "Auditors: username".

If the list of auditors includes the commit author, this edit fails because you can't audit your own commits (previously, you sometimes could and/or we didn't validate).

Instead, just ignore "Auditors: author".

Test Plan
  • Made a commit with "Auditors: epriestley".
  • Pushed it.
  • Saw the HeraldWorker get stuck with the error in T12406.
  • Applied the change; worker now succeeded.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alexmv added inline comments.
src/applications/audit/editor/PhabricatorAuditEditor.php
310–313

It's not clear what this short-circuit accomplishes -- if the array is empty, the foreach does no iterations, and the equivalent short-circuit below it kicks in.

Oh -- it avoids foreach (null as ...) for commits with no "Auditors" field, which emits a warning since foreach (...) wants an array.

This revision is now accepted and ready to land.Mar 16 2017, 8:30 PM

Oh -- it avoids foreach (null as ...) for commits with no "Auditors" field, which emits a warning since foreach (...) wants an array.

Ah -- it's to catch the null case. I was just thinking in terms of the empty list case.

Thanks!

This revision was automatically updated to reflect the committed changes.