diff --git a/conf/default.conf.php b/conf/default.conf.php index 26f76dd3ce..b22e053827 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -1015,17 +1015,6 @@ return array( // interact with the revisions. 'differential.anonymous-access' => false, - // If you set this to true, revision author email address information will - // be exposed in Conduit. This is useful for Arcanist. - // - // For example, consider the "arc patch DX" workflow which needs to ask - // Differential for the revision DX. This data often should contain - // the author's email address, eg "George Washington - // " when DX is a git or mercurial revision. If this - // option is false, Differential defaults to the best it can, something like - // "George Washington" or "gwashington". - 'differential.expose-emails-prudently' => false, - // List of file regexps that should be treated as if they are generated by // an automatic process, and thus get hidden by default in differential. 'differential.generated-paths' => array( diff --git a/src/applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php index 5f2719691d..55872bec32 100644 --- a/src/applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php +++ b/src/applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php @@ -72,7 +72,6 @@ final class ConduitAPI_differential_getdiff_Method extends ConduitAPIMethod { $project_name = null; } $basic_dict['projectName'] = $project_name; - $basic_dict['author'] = $diff->loadAuthorInformation(); return $basic_dict; } diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php index 9f077e1c85..f16bfbfc98 100644 --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -127,28 +127,6 @@ final class PhabricatorDifferentialConfigOptions "If you set this to true, users won't need to login to view ". "Differential revisions. Anonymous users will have read-only ". "access and won't be able to interact with the revisions.")), - $this->newOption('differential.expose-emails-prudently', 'bool', false) - ->setBoolOptions( - array( - pht("Expose revision author email address via Conduit"), - pht("Don't expose revision author email address via Conduit"), - )) - ->setSummary( - pht( - "Determines whether or not the author's email address should be ". - "exposed via Conduit.")) - ->setDescription( - pht( - "If you set this to true, revision author email address ". - "information will be exposed in Conduit. This is useful for ". - "Arcanist.\n\n". - "For example, consider the 'arc patch DX' workflow which needs ". - "to ask Differential for the revision DX. This data often should ". - "contain the author's email address, eg 'George Washington ". - "' when DX is a git or mercurial ". - "revision. If this option is false, Differential defaults to the ". - "best it can, something like 'George Washington' or ". - "'gwashington'.")), $this->newOption('differential.generated-paths', 'list', array()) ->setSummary(pht("File regexps to treat as automatically generated.")) ->setDescription( diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index 11e4a754b2..1acf8f5508 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -240,55 +240,17 @@ final class DifferentialDiff extends DifferentialDAO { $this->getID()); foreach ($properties as $property) { $dict['properties'][$property->getName()] = $property->getData(); + + if ($property->getName() == 'local:commits') { + foreach ($property->getData() as $commit) { + $dict['authorName'] = $commit['author']; + $dict['authorEmail'] = $commit['authorEmail']; + break; + } + } } return $dict; } - /** - * Figures out the right author information for a given diff based on the - * repository and Phabricator configuration settings. - * - * Git is particularly finicky as it requires author information to be in - * the format "George Washington " to - * consistently work. If the Phabricator instance isn't configured to - * expose emails prudently, then we are unable to get any author information - * for git. - */ - public function loadAuthorInformation() { - $author = id(new PhabricatorUser()) - ->loadOneWhere('phid = %s', $this->getAuthorPHID()); - - $use_emails = - PhabricatorEnv::getEnvConfig('differential.expose-emails-prudently'); - - switch ($this->getSourceControlSystem()) { - case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: - if (!$use_emails) { - $author_info = ''; - } else { - $author_info = $this->getFullAuthorInfo($author); - } - break; - case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: - if (!$use_emails) { - $author_info = $author->getUsername(); - } else { - $author_info = $this->getFullAuthorInfo($author); - } - break; - case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: - default: - $author_info = $author->getUsername(); - break; - } - - return $author_info; - } - - private function getFullAuthorInfo(PhabricatorUser $author) { - return sprintf('%s <%s>', - $author->getRealName(), - $author->loadPrimaryEmailAddress()); - } }