Page MenuHomePhabricator

D11630.diff
No OneTemporary

D11630.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3071,7 +3071,6 @@
'UserDisableConduitAPIMethod' => 'applications/people/conduit/UserDisableConduitAPIMethod.php',
'UserEnableConduitAPIMethod' => 'applications/people/conduit/UserEnableConduitAPIMethod.php',
'UserFindConduitAPIMethod' => 'applications/people/conduit/UserFindConduitAPIMethod.php',
- 'UserInfoConduitAPIMethod' => 'applications/people/conduit/UserInfoConduitAPIMethod.php',
'UserQueryConduitAPIMethod' => 'applications/people/conduit/UserQueryConduitAPIMethod.php',
'UserRemoveStatusConduitAPIMethod' => 'applications/people/conduit/UserRemoveStatusConduitAPIMethod.php',
'UserWhoAmIConduitAPIMethod' => 'applications/people/conduit/UserWhoAmIConduitAPIMethod.php',
@@ -6487,7 +6486,6 @@
'UserDisableConduitAPIMethod' => 'UserConduitAPIMethod',
'UserEnableConduitAPIMethod' => 'UserConduitAPIMethod',
'UserFindConduitAPIMethod' => 'UserConduitAPIMethod',
- 'UserInfoConduitAPIMethod' => 'UserConduitAPIMethod',
'UserQueryConduitAPIMethod' => 'UserConduitAPIMethod',
'UserRemoveStatusConduitAPIMethod' => 'UserConduitAPIMethod',
'UserWhoAmIConduitAPIMethod' => 'UserConduitAPIMethod',
diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php
--- a/src/applications/people/application/PhabricatorPeopleApplication.php
+++ b/src/applications/people/application/PhabricatorPeopleApplication.php
@@ -126,7 +126,12 @@
$items = array();
if ($user->isLoggedIn() && $user->isUserActivated()) {
- $image = $user->loadProfileImageURI();
+ $profile = id(new PhabricatorPeopleQuery())
+ ->setViewer($user)
+ ->needProfileImage(true)
+ ->withPHIDs(array($user->getPHID()))
+ ->executeOne();
+ $image = $profile->getProfileImageURI();
$item = id(new PHUIListItemView())
->setName($user->getUsername())
diff --git a/src/applications/people/conduit/UserConduitAPIMethod.php b/src/applications/people/conduit/UserConduitAPIMethod.php
--- a/src/applications/people/conduit/UserConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserConduitAPIMethod.php
@@ -40,7 +40,7 @@
'phid' => $user->getPHID(),
'userName' => $user->getUserName(),
'realName' => $user->getRealName(),
- 'image' => $user->loadProfileImageURI(),
+ 'image' => $user->getProfileImageURI(),
'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'),
'roles' => $roles,
);
diff --git a/src/applications/people/conduit/UserInfoConduitAPIMethod.php b/src/applications/people/conduit/UserInfoConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/people/conduit/UserInfoConduitAPIMethod.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-final class UserInfoConduitAPIMethod extends UserConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'user.info';
- }
-
- public function getMethodStatus() {
- return self::METHOD_STATUS_DEPRECATED;
- }
-
- public function getMethodStatusDescription() {
- return "Replaced by 'user.query'.";
- }
-
- public function getMethodDescription() {
- return 'Retrieve information about a user by PHID.';
- }
-
- public function defineParamTypes() {
- return array(
- 'phid' => 'required phid',
- );
- }
-
- public function defineReturnType() {
- return 'nonempty dict<string, wild>';
- }
-
- public function defineErrorTypes() {
- return array(
- 'ERR-BAD-USER' => 'No such user exists.',
- );
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $user = id(new PhabricatorUser())->loadOneWhere(
- 'phid = %s',
- $request->getValue('phid'));
-
- if (!$user) {
- throw new ConduitException('ERR-BAD-USER');
- }
-
- return $this->buildUserInformationDictionary($user);
- }
-
-}
diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
--- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
@@ -41,8 +41,9 @@
$offset = $request->getValue('offset', 0);
$limit = $request->getValue('limit', 100);
- $query = new PhabricatorPeopleQuery();
- $query->setViewer($request->getUser());
+ $query = id(new PhabricatorPeopleQuery())
+ ->setViewer($request->getUser())
+ ->needProfileImage(true);
if ($usernames) {
$query->withUsernames($usernames);
diff --git a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
--- a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
@@ -27,7 +27,13 @@
}
protected function execute(ConduitAPIRequest $request) {
- return $this->buildUserInformationDictionary($request->getUser());
+ $person = id(new PhabricatorPeopleQuery())
+ ->setViewer($request->getUser())
+ ->needProfileImage(true)
+ ->withPHIDs(array($request->getUser()->getPHID()))
+ ->executeOne();
+
+ return $this->buildUserInformationDictionary($person);
}
}
diff --git a/src/applications/people/controller/PhabricatorPeopleCalendarController.php b/src/applications/people/controller/PhabricatorPeopleCalendarController.php
--- a/src/applications/people/controller/PhabricatorPeopleCalendarController.php
+++ b/src/applications/people/controller/PhabricatorPeopleCalendarController.php
@@ -25,7 +25,7 @@
return new Aphront404Response();
}
- $picture = $user->loadProfileImageURI();
+ $picture = $user->getProfileImageURI();
$now = time();
$request = $this->getRequest();
diff --git a/src/applications/people/controller/PhabricatorPeopleLogsController.php b/src/applications/people/controller/PhabricatorPeopleLogsController.php
--- a/src/applications/people/controller/PhabricatorPeopleLogsController.php
+++ b/src/applications/people/controller/PhabricatorPeopleLogsController.php
@@ -18,7 +18,7 @@
return $this->delegateToController($controller);
}
- public function buildSideNavView() {
+ public function buildSideNavView($for_app = false) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php
@@ -30,7 +30,7 @@
$profile = $user->loadUserProfile();
$username = phutil_escape_uri($user->getUserName());
- $picture = $user->loadProfileImageURI();
+ $picture = $user->getProfileImageURI();
$header = id(new PHUIHeaderView())
->setHeader($user->getFullName())
diff --git a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
--- a/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
+++ b/src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
@@ -42,7 +42,7 @@
$handle->setName($user->getUsername());
$handle->setURI('/p/'.$user->getUsername().'/');
$handle->setFullName($user->getFullName());
- $handle->setImageURI($user->loadProfileImageURI());
+ $handle->setImageURI($user->getProfileImageURI());
$handle->setDisabled(!$user->isUserActivated());
if ($user->hasStatus()) {
$status = $user->getStatus();
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -683,27 +683,6 @@
return $this->assertAttached($this->profileImage);
}
- public function loadProfileImageURI() {
- if ($this->profileImage && ($this->profileImage !== self::ATTACHABLE)) {
- return $this->profileImage;
- }
-
- $src_phid = $this->getProfileImagePHID();
-
- if ($src_phid) {
- // TODO: (T603) Can we get rid of this entirely and move it to
- // PeopleQuery with attach/attachable?
- $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
- if ($file) {
- $this->profileImage = $file->getBestURI();
- return $this->profileImage;
- }
- }
-
- $this->profileImage = self::getDefaultProfileImageURI();
- return $this->profileImage;
- }
-
public function getFullName() {
if (strlen($this->getRealName())) {
return $this->getUsername().' ('.$this->getRealName().')';

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 25, 8:11 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726992
Default Alt Text
D11630.diff (8 KB)

Event Timeline