1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Write a "resign" audit relationship even if actor has no relationship

Summary: Ref T4896. I got this logic slightly wrong when porting it over: we always want to write this relationship, to allow members of a project with an audit request against a commit to resign and get it out of their queue.

Test Plan:
  - Resigned from a commit with an existing relationship.
  - Resigned from a commit with no existing relationship, saw one added.

Reviewers: btrahan, joshuaspence, mbishopim3

Reviewed By: mbishopim3

Subscribers: epriestley

Maniphest Tasks: T4896

Differential Revision: https://secure.phabricator.com/D10137
This commit is contained in:
epriestley 2014-08-04 12:03:48 -07:00
parent 86dbf1d17d
commit 725e2fa410

View file

@ -161,11 +161,23 @@ final class PhabricatorAuditEditor
$requests = mpull($requests, null, 'getAuditorPHID');
$actor_request = idx($requests, $actor_phid);
if ($actor_request) {
$actor_request
->setAuditStatus($status_resigned)
->save();
// If the actor doesn't currently have a relationship to the
// commit, add one explicitly. For example, this allows members
// of a project to resign from a commit and have it drop out of
// their queue.
if (!$actor_request) {
$actor_request = id(new PhabricatorRepositoryAuditRequest())
->setCommitPHID($object->getPHID())
->setAuditorPHID($actor_phid);
$requests[] = $actor_request;
$object->attachAudits($requests);
}
$actor_request
->setAuditStatus($status_resigned)
->save();
break;
case PhabricatorAuditActionConstants::ACCEPT:
case PhabricatorAuditActionConstants::CONCERN: