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)
Mon, Apr 15, 10:03 AM
Unknown Object (File)
Thu, Apr 11, 10:00 AM
Unknown Object (File)
Mon, Apr 8, 2:02 PM
Unknown Object (File)
Sun, Mar 31, 6:32 PM
Unknown Object (File)
Mar 10 2024, 12:22 AM
Unknown Object (File)
Jan 26 2024, 7:06 PM
Unknown Object (File)
Jan 23 2024, 8:11 PM
Unknown Object (File)
Dec 25 2023, 7:28 PM
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.