Page MenuHomePhabricator

sell_private_user_data_to_the_highest_bidder.diff

Authored By
epriestley
Feb 13 2017, 4:24 PM
Size
1 KB
Referenced Files
None
Subscribers
None

sell_private_user_data_to_the_highest_bidder.diff

diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
index 415c46bb27..1814355cfd 100644
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -313,6 +313,38 @@ final class DifferentialDiff
}
}
+ // If we were unable to pull authorship data from commit metadata and
+ // this diff is associated with a revision, use the revision author's
+ // account details instead.
+ if (!strlen(idx($dict, 'authorEmail'))) {
+ if ($this->hasRevision()) {
+ $viewer = PhabricatorUser::getOmnipotentUser();
+
+ $revision = $this->getRevision();
+ $author_phid = $revision->getAuthorPHID();
+
+ $author = id(new PhabricatorUserQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($author_phid))
+ ->executeOne();
+ if ($author) {
+ $email = id(new PhabricatorUserEmail())->loadOneWhere(
+ 'userPHID = %s AND isPrimary = 1',
+ $author->getPHID());
+ if ($email) {
+ $author_name = $author->getRealName();
+ if (!strlen($author_name)) {
+ $author_name = $author->getUsername();
+ }
+ $author_email = $email->getAddress();
+
+ $dict['authorName'] = $author_name;
+ $dict['authorEmail'] = $author_email;
+ }
+ }
+ }
+ }
+
return $dict;
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
480793
Default Alt Text
sell_private_user_data_to_the_highest_bidder.diff (1 KB)

Event Timeline