@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use initializeNewLog rather than instantiate the UserLog

Summary:
Use initializeNewLog rather than instantiate the UserLog,
Closes T4912

Test Plan: Run install-certificate

Reviewers: #blessed_reviewers, btrahan

Reviewed By: #blessed_reviewers, btrahan

Subscribers: epriestley

Maniphest Tasks: T4912

Differential Revision: https://secure.phabricator.com/D8887

+13 -10
+13 -10
src/applications/conduit/method/ConduitAPI_conduit_getcertificate_Method.php
··· 46 46 60 * 5); 47 47 48 48 if (count($failed_attempts) > 5) { 49 - $this->logFailure(); 49 + $this->logFailure($request); 50 50 throw new ConduitException('ERR-RATE-LIMIT'); 51 51 } 52 52 ··· 56 56 trim($token)); 57 57 58 58 if (!$info || $info->getDateCreated() < time() - (60 * 15)) { 59 - $this->logFailure(); 59 + $this->logFailure($request, $info); 60 60 throw new ConduitException('ERR-BAD-TOKEN'); 61 61 } else { 62 - $log = id(new PhabricatorUserLog()) 63 - ->setActorPHID($info->getUserPHID()) 64 - ->setUserPHID($info->getUserPHID()) 65 - ->setAction(PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE) 62 + $log = PhabricatorUserLog::initializeNewLog( 63 + $request->getUser(), 64 + $info->getUserPHID(), 65 + PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE) 66 66 ->save(); 67 67 } 68 68 ··· 79 79 ); 80 80 } 81 81 82 - private function logFailure() { 82 + private function logFailure( 83 + ConduitAPIRequest $request, 84 + PhabricatorConduitCertificateToken $info = null) { 83 85 84 - $log = id(new PhabricatorUserLog()) 85 - ->setUserPHID('-') 86 - ->setAction(PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE) 86 + $log = PhabricatorUserLog::initializeNewLog( 87 + $request->getUser(), 88 + $info ? $info->getUserPHID() : '-', 89 + PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE) 87 90 ->save(); 88 91 } 89 92