2011-01-24 03:09:16 +01:00
|
|
|
<?php
|
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
abstract class PhabricatorPeopleProfileController
|
2012-03-10 00:46:25 +01:00
|
|
|
extends PhabricatorPeopleController {
|
2011-01-24 03:09:16 +01:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
private $user;
|
|
|
|
private $profileMenu;
|
2015-07-22 18:32:54 +02:00
|
|
|
|
2013-03-19 21:48:50 +01:00
|
|
|
public function shouldRequireAdmin() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
public function setUser(PhabricatorUser $user) {
|
|
|
|
$this->user = $user;
|
|
|
|
return $this;
|
2013-02-05 22:46:02 +01:00
|
|
|
}
|
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
public function getUser() {
|
|
|
|
return $this->user;
|
2011-06-18 10:13:56 +02:00
|
|
|
}
|
2011-02-20 02:33:53 +01:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
public function buildApplicationMenu() {
|
|
|
|
$menu = $this->newApplicationMenu();
|
2011-02-20 03:28:41 +01:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
$profile_menu = $this->getProfileMenu();
|
|
|
|
if ($profile_menu) {
|
|
|
|
$menu->setProfileMenu($profile_menu);
|
|
|
|
}
|
2013-07-10 14:09:59 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
return $menu;
|
2011-12-24 03:17:40 +01:00
|
|
|
}
|
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
protected function getProfileMenu() {
|
|
|
|
if (!$this->profileMenu) {
|
|
|
|
$user = $this->getUser();
|
|
|
|
if ($user) {
|
|
|
|
$viewer = $this->getViewer();
|
2015-07-23 20:46:34 +02:00
|
|
|
|
2016-12-11 18:00:44 +01:00
|
|
|
$engine = id(new PhabricatorPeopleProfileMenuEngine())
|
2015-07-23 20:46:34 +02:00
|
|
|
->setViewer($viewer)
|
2016-01-14 15:47:06 +01:00
|
|
|
->setProfileObject($user);
|
2015-07-23 20:46:34 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
$this->profileMenu = $engine->buildNavigation();
|
2015-07-23 20:46:34 +02:00
|
|
|
}
|
2016-01-14 15:47:06 +01:00
|
|
|
}
|
[Redesign] People, Profile, Feed UI
Summary: Ref T8099, Mostly a Feed cleanup, removing old CSS, relying on modern display objects, adds back the feed to profile (I miss it, but maybe you don't).
Test Plan: Visit Feed on Profiles, Projects, Feed, and Dashboards. Same UI Everywhere. TODO, "Public Feed".
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8099
Differential Revision: https://secure.phabricator.com/D13101
2015-06-01 20:28:01 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
return $this->profileMenu;
|
|
|
|
}
|
[Redesign] People, Profile, Feed UI
Summary: Ref T8099, Mostly a Feed cleanup, removing old CSS, relying on modern display objects, adds back the feed to profile (I miss it, but maybe you don't).
Test Plan: Visit Feed on Profiles, Projects, Feed, and Dashboards. Same UI Everywhere. TODO, "Public Feed".
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8099
Differential Revision: https://secure.phabricator.com/D13101
2015-06-01 20:28:01 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
protected function buildApplicationCrumbs() {
|
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
[Redesign] People, Profile, Feed UI
Summary: Ref T8099, Mostly a Feed cleanup, removing old CSS, relying on modern display objects, adds back the feed to profile (I miss it, but maybe you don't).
Test Plan: Visit Feed on Profiles, Projects, Feed, and Dashboards. Same UI Everywhere. TODO, "Public Feed".
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8099
Differential Revision: https://secure.phabricator.com/D13101
2015-06-01 20:28:01 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
$user = $this->getUser();
|
|
|
|
if ($user) {
|
|
|
|
$crumbs->addTextCrumb(
|
|
|
|
$user->getUsername(),
|
|
|
|
urisprintf('/p/%s/', $user->getUsername()));
|
|
|
|
}
|
[Redesign] People, Profile, Feed UI
Summary: Ref T8099, Mostly a Feed cleanup, removing old CSS, relying on modern display objects, adds back the feed to profile (I miss it, but maybe you don't).
Test Plan: Visit Feed on Profiles, Projects, Feed, and Dashboards. Same UI Everywhere. TODO, "Public Feed".
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8099
Differential Revision: https://secure.phabricator.com/D13101
2015-06-01 20:28:01 +02:00
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
return $crumbs;
|
[Redesign] People, Profile, Feed UI
Summary: Ref T8099, Mostly a Feed cleanup, removing old CSS, relying on modern display objects, adds back the feed to profile (I miss it, but maybe you don't).
Test Plan: Visit Feed on Profiles, Projects, Feed, and Dashboards. Same UI Everywhere. TODO, "Public Feed".
Reviewers: btrahan, epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T8099
Differential Revision: https://secure.phabricator.com/D13101
2015-06-01 20:28:01 +02:00
|
|
|
}
|
|
|
|
|
2017-01-31 17:58:33 +01:00
|
|
|
public function buildProfileHeader() {
|
|
|
|
$user = $this->user;
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$profile = $user->loadUserProfile();
|
|
|
|
$picture = $user->getProfileImageURI();
|
|
|
|
|
|
|
|
$profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
|
|
|
|
$profile_title = $profile->getDisplayTitle();
|
|
|
|
|
|
|
|
$roles = array();
|
|
|
|
if ($user->getIsAdmin()) {
|
|
|
|
$roles[] = pht('Administrator');
|
|
|
|
}
|
|
|
|
if ($user->getIsDisabled()) {
|
|
|
|
$roles[] = pht('Disabled');
|
|
|
|
}
|
|
|
|
if (!$user->getIsApproved()) {
|
|
|
|
$roles[] = pht('Not Approved');
|
|
|
|
}
|
|
|
|
if ($user->getIsSystemAgent()) {
|
|
|
|
$roles[] = pht('Bot');
|
|
|
|
}
|
|
|
|
if ($user->getIsMailingList()) {
|
|
|
|
$roles[] = pht('Mailing List');
|
|
|
|
}
|
|
|
|
|
|
|
|
$tag = null;
|
|
|
|
if ($roles) {
|
|
|
|
$tag = id(new PHUITagView())
|
|
|
|
->setName(implode(', ', $roles))
|
|
|
|
->addClass('project-view-header-tag')
|
|
|
|
->setType(PHUITagView::TYPE_SHADE);
|
|
|
|
}
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
|
|
->setHeader(array($user->getFullName(), $tag))
|
|
|
|
->setImage($picture)
|
2017-02-02 06:21:08 +01:00
|
|
|
->setProfileHeader(true)
|
|
|
|
->addClass('people-profile-header');
|
2017-01-31 17:58:33 +01:00
|
|
|
|
|
|
|
if ($user->getIsDisabled()) {
|
|
|
|
$header->setStatus('fa-ban', 'red', pht('Disabled'));
|
Make the new "Unverified Email" behavior more clear to other users
Summary:
Ref T12268. Ref T12157. When you mention or interact with a user who is unlikely to be able to respond (for example, because their account is disabled), we try to show a colored dot to provide a hint about this.
Recently, we no longer send any normal mail to unverified addresses. However, the rules for showing a dot haven't been updated yet, so they only care about this if `auth.require-verification` is set. This can be misleading, because if you say `Hey @alice, what do you think about this?` and she hasn't verified her email, you may not get a response.
Update the rule so users with unverified email addresses get a grey dot in all cases. The hint is basically "you shouldn't expect a response from this user".
Make the meaning of this hint more clear on the hovercard and profile.
Also:
- Allow the non-ajax version of the hovercard page (which is basically only useful for testing hovercards) accept `?names=...` so you can just plug usernames, hashtags, etc., in there.
- Fix a bug where the user's join date was based on their profile creation date instead of account creation date on the hovercard. Users may not have a profile creation date (if they never changed any account details), and it may be different from their account creation date.
Test Plan: {F2998517}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T12268, T12157
Differential Revision: https://secure.phabricator.com/D17374
2017-02-17 16:18:44 +01:00
|
|
|
} else if (!$user->getIsEmailVerified()) {
|
|
|
|
$header->setStatus('fa-envelope', 'red', pht('Email Not Verified'));
|
2017-01-31 17:58:33 +01:00
|
|
|
} else {
|
|
|
|
$header->setStatus($profile_icon, 'bluegrey', $profile_title);
|
|
|
|
}
|
|
|
|
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$viewer,
|
|
|
|
$user,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
|
|
|
if ($can_edit) {
|
|
|
|
$id = $user->getID();
|
|
|
|
$header->setImageEditURL($this->getApplicationURI("picture/{$id}/"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $header;
|
|
|
|
}
|
|
|
|
|
2011-01-24 03:09:16 +01:00
|
|
|
}
|