@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.

Provide more information from diffusion.querycommits

Summary:
Ref T2783. Fixes T6039.

- Provide `authorPHID` and `committerPHID` to resolve T6039.
- In message parser, store author/email strings.
- In cached results, emit author/email strings.

Test Plan: Called method with and without bypassCache. Used `reparse.php` to repopulate data on an old commit.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2783, T6039

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

+24 -16
+16 -16
src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php
··· 35 35 $bypass_cache = $request->getValue('bypassCache'); 36 36 37 37 $query = id(new DiffusionCommitQuery()) 38 - ->setViewer($request->getUser()); 39 - 40 - if ($need_messages) { 41 - $query->needCommitData(true); 42 - } 38 + ->setViewer($request->getUser()) 39 + ->needCommitData(true); 43 40 44 41 $repository_phid = $request->getValue('repositoryPHID'); 45 42 if ($repository_phid) { ··· 75 72 76 73 $data = array(); 77 74 foreach ($commits as $commit) { 75 + $commit_data = $commit->getCommitData(); 76 + 78 77 $callsign = $commit->getRepository()->getCallsign(); 79 78 $identifier = $commit->getCommitIdentifier(); 80 79 $uri = '/r'.$callsign.$identifier; ··· 89 88 'uri' => $uri, 90 89 'isImporting' => !$commit->isImported(), 91 90 'summary' => $commit->getSummary(), 92 - 'authorName' => '', 93 - 'authorEmail' => '', 94 - 'committerName' => '', 95 - 'committerEmail' => '', 91 + 'authorPHID' => $commit->getAuthorPHID(), 92 + 'committerPHID' => $commit_data->getCommitDetail('committerPHID'), 93 + 'author' => $commit_data->getAuthorName(), 94 + 'authorName' => $commit_data->getCommitDetail('authorName'), 95 + 'authorEmail' => $commit_data->getCommitDetail('authorEmail'), 96 + 'committer' => $commit_data->getCommitDetail('committer'), 97 + 'committerName' => $commit_data->getCommitDetail('committerName'), 98 + 'committerEmail' => $commit_data->getCommitDetail('committerEmail'), 96 99 'hashes' => array(), 97 100 ); 98 101 ··· 102 105 ->withIdentifier($commit->getCommitIdentifier()) 103 106 ->execute(); 104 107 108 + $dict['author'] = $lowlevel_commitref->getAuthor(); 105 109 $dict['authorName'] = $lowlevel_commitref->getAuthorName(); 106 110 $dict['authorEmail'] = $lowlevel_commitref->getAuthorEmail(); 111 + $dict['committer'] = $lowlevel_commitref->getCommitter(); 107 112 $dict['committerName'] = $lowlevel_commitref->getCommitterName(); 108 113 $dict['committerEmail'] = $lowlevel_commitref->getCommitterEmail(); 109 114 ··· 118 123 } 119 124 } 120 125 121 - if ($need_messages) { 122 - $commit_data = $commit->getCommitData(); 123 - if ($commit_data) { 124 - $dict['message'] = $commit_data->getCommitMessage(); 125 - } else { 126 - $dict['message'] = null; 127 - } 126 + if ($need_messages && !$bypass_cache) { 127 + $dict['message'] = $commit_data->getCommitMessage(); 128 128 } 129 129 130 130 $data[$commit->getPHID()] = $dict;
+8
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 18 18 } 19 19 $data->setCommitID($commit->getID()); 20 20 $data->setAuthorName((string)$author); 21 + 22 + $data->setCommitDetail('authorName', $ref->getAuthorName()); 23 + $data->setCommitDetail('authorEmail', $ref->getAuthorEmail()); 24 + 21 25 $data->setCommitDetail( 22 26 'authorPHID', 23 27 $this->resolveUserPHID($commit, $author)); ··· 26 30 27 31 if (strlen($committer)) { 28 32 $data->setCommitDetail('committer', $committer); 33 + 34 + $data->setCommitDetail('committerName', $ref->getCommitterName()); 35 + $data->setCommitDetail('committerEmail', $ref->getCommitterEmail()); 36 + 29 37 $data->setCommitDetail( 30 38 'committerPHID', 31 39 $this->resolveUserPHID($commit, $committer));