1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

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
This commit is contained in:
epriestley 2017-02-17 07:18:44 -08:00
parent 7448cb0c3a
commit 81a9726fa1
6 changed files with 81 additions and 10 deletions

View file

@ -103,6 +103,8 @@ abstract class PhabricatorPeopleProfileController
if ($user->getIsDisabled()) { if ($user->getIsDisabled()) {
$header->setStatus('fa-ban', 'red', pht('Disabled')); $header->setStatus('fa-ban', 'red', pht('Disabled'));
} else if (!$user->getIsEmailVerified()) {
$header->setStatus('fa-envelope', 'red', pht('Email Not Verified'));
} else { } else {
$header->setStatus($profile_icon, 'bluegrey', $profile_title); $header->setStatus($profile_icon, 'bluegrey', $profile_title);
} }

View file

@ -150,7 +150,7 @@ final class PhabricatorMentionRemarkupRule extends PhutilRemarkupRule {
$tag->addClass('phabricator-remarkup-mention-nopermission'); $tag->addClass('phabricator-remarkup-mention-nopermission');
} }
if (!$user->isUserActivated()) { if (!$user->isResponsive()) {
$tag->setDotColor(PHUITagView::COLOR_GREY); $tag->setDotColor(PHUITagView::COLOR_GREY);
} else { } else {
if ($user->getAwayUntil()) { if ($user->getAwayUntil()) {

View file

@ -61,7 +61,7 @@ final class PhabricatorPeopleUserPHIDType extends PhabricatorPHIDType {
} }
$availability = null; $availability = null;
if (!$user->isUserActivated()) { if (!$user->isResponsive()) {
$availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; $availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED;
} else { } else {
$until = $user->getAwayUntil(); $until = $user->getAwayUntil();

View file

@ -120,6 +120,32 @@ final class PhabricatorUser
return true; return true;
} }
/**
* Is this a user who we can reasonably expect to respond to requests?
*
* This is used to provide a grey "disabled/unresponsive" dot cue when
* rendering handles and tags, so it isn't a surprise if you get ignored
* when you ask things of users who will not receive notifications or could
* not respond to them (because they are disabled, unapproved, do not have
* verified email addresses, etc).
*
* @return bool True if this user can receive and respond to requests from
* other humans.
*/
public function isResponsive() {
if (!$this->isUserActivated()) {
return false;
}
if (!$this->getIsEmailVerified()) {
return false;
}
return true;
}
public function canEstablishWebSessions() { public function canEstablishWebSessions() {
if ($this->getIsMailingList()) { if ($this->getIsMailingList()) {
return false; return false;

View file

@ -52,17 +52,44 @@ final class PhabricatorUserCardView extends AphrontTagView {
require_celerity_resource('project-card-view-css'); require_celerity_resource('project-card-view-css');
$profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); // We don't have a ton of room on the hovercard, so we're trying to show
$profile_title = $profile->getDisplayTitle(); // the most important tag. Users can click through to the profile to get
// more details.
if ($user->getIsDisabled()) {
$tag_icon = 'fa-ban';
$tag_title = pht('Disabled');
$tag_shade = PHUITagView::COLOR_RED;
} else if (!$user->getIsApproved()) {
$tag_icon = 'fa-ban';
$tag_title = pht('Unapproved Account');
$tag_shade = PHUITagView::COLOR_RED;
} else if (!$user->getIsEmailVerified()) {
$tag_icon = 'fa-envelope';
$tag_title = pht('Email Not Verified');
$tag_shade = PHUITagView::COLOR_RED;
} else if ($user->getIsAdmin()) {
$tag_icon = 'fa-star';
$tag_title = pht('Administrator');
$tag_shade = PHUITagView::COLOR_INDIGO;
} else {
$tag_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
$tag_title = $profile->getDisplayTitle();
$tag_shade = null;
}
$tag = id(new PHUITagView()) $tag = id(new PHUITagView())
->setIcon($profile_icon) ->setIcon($tag_icon)
->setName($profile_title) ->setName($tag_title)
->addClass('project-view-header-tag')
->setType(PHUITagView::TYPE_SHADE); ->setType(PHUITagView::TYPE_SHADE);
if ($tag_shade !== null) {
$tag->setShade($tag_shade);
}
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(array($user->getFullName(), $tag)) ->setHeader($user->getFullName())
->addTag($tag)
->setUser($viewer) ->setUser($viewer)
->setImage($picture); ->setImage($picture);
@ -70,7 +97,7 @@ final class PhabricatorUserCardView extends AphrontTagView {
$body[] = $this->addItem( $body[] = $this->addItem(
pht('User Since'), pht('User Since'),
phabricator_date($profile->getDateCreated(), $viewer)); phabricator_date($user->getDateCreated(), $viewer));
if (PhabricatorApplication::isClassInstalledForViewer( if (PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorCalendarApplication', 'PhabricatorCalendarApplication',

View file

@ -9,7 +9,23 @@ final class PhabricatorSearchHovercardController
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$phids = $request->getArr('phids'); $phids = $request->getStrList('phids');
// If object names are provided, look them up and pretend they were
// passed as additional PHIDs. This is primarily useful for debugging,
// since you don't have to go look up user PHIDs to preview their
// hovercards.
$names = $request->getStrList('names');
if ($names) {
$named_objects = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withNames($names)
->execute();
foreach ($named_objects as $object) {
$phids[] = $object->getPHID();
}
}
$handles = id(new PhabricatorHandleQuery()) $handles = id(new PhabricatorHandleQuery())
->setViewer($viewer) ->setViewer($viewer)