From eb73c50e87fc3c1fd127d77cbe5324b99c19e4ad Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sun, 5 Mar 2017 08:20:35 -0800 Subject: [PATCH 01/24] Auto-generate profile images for sad psyducks Summary: Fixes T10319. This looks for custom profile image, then falls back to a generated profile image. Test Plan: Create a new user, log in, and see new profile image. Note this seems to break `bin/lipsum generate user` Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T10319 Differential Revision: https://secure.phabricator.com/D17467 --- .../PhabricatorUserProfileImageCacheType.php | 42 +++++++++++++++++- ...bricatorPeopleProfilePictureController.php | 43 +++++-------------- .../PhabricatorPeopleProfileImageWorkflow.php | 8 +++- .../people/storage/PhabricatorUserProfile.php | 4 +- 4 files changed, 61 insertions(+), 36 deletions(-) diff --git a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php index b3f944a3ed..e2a535cdd4 100644 --- a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php +++ b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php @@ -24,8 +24,43 @@ final class PhabricatorUserProfileImageCacheType public function newValueForUsers($key, array $users) { $viewer = $this->getViewer(); - $file_phids = mpull($users, 'getProfileImagePHID'); - $file_phids = array_filter($file_phids); + $file_phids = array(); + $generate_users = array(); + foreach ($users as $user) { + $user_phid = $user->getPHID(); + $custom_phid = $user->getProfileImagePHID(); + $default_phid = $user->getDefaultProfileImagePHID(); + $version = $user->getDefaultProfileImageVersion(); + + if ($custom_phid) { + $file_phids[$user_phid] = $custom_phid; + continue; + } + if ($default_phid) { + if ($version == PhabricatorFilesComposeAvatarBuiltinFile::VERSION) { + $file_phids[$user_phid] = $default_phid; + continue; + } + } + $generate_users[] = $user; + } + + // Generate Files for anyone without a default + foreach ($generate_users as $generate_user) { + $generate_user_phid = $generate_user->getPHID(); + $generate_username = $generate_user->getUsername(); + $generate_version = PhabricatorFilesComposeAvatarBuiltinFile::VERSION; + $generate_file = id(new PhabricatorFilesComposeAvatarBuiltinFile()) + ->getUserProfileImageFile($generate_username); + + $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); + $generate_user->setDefaultProfileImagePHID($generate_file->getPHID()); + $generate_user->setDefaultProfileImageVersion($generate_version); + $generate_user->save(); + unset($unguarded); + + $file_phids[$generate_user_phid] = $generate_file->getPHID(); + } if ($file_phids) { $files = id(new PhabricatorFileQuery()) @@ -40,8 +75,11 @@ final class PhabricatorUserProfileImageCacheType $results = array(); foreach ($users as $user) { $image_phid = $user->getProfileImagePHID(); + $default_phid = $user->getDefaultProfileImagePHID(); if (isset($files[$image_phid])) { $image_uri = $files[$image_phid]->getBestURI(); + } else if (isset($files[$default_phid])) { + $image_uri = $files[$default_phid]->getBestURI(); } else { $image_uri = PhabricatorUser::getDefaultProfileImageURI(); } diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php index 1532003122..cff833aa51 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php @@ -30,22 +30,12 @@ final class PhabricatorPeopleProfilePictureController $e_file = true; $errors = array(); - // Verify install has GD extension, otherwise default to avatar.png - $gd = function_exists('imagecreatefromstring'); - if ($request->isFormPost()) { $phid = $request->getStr('phid'); $is_default = false; if ($phid == PhabricatorPHIDConstants::PHID_VOID) { - // Compose the builtin unique image - if ($gd) { - $file = id(new PhabricatorFilesComposeAvatarBuiltinFile()) - ->getUserProfileImageFile($name); - } else { - $phid = null; - $is_default = true; - } - + $phid = null; + $is_default = true; } else if ($phid) { $file = id(new PhabricatorFileQuery()) ->setViewer($viewer) @@ -96,13 +86,15 @@ final class PhabricatorPeopleProfilePictureController $form = id(new PHUIFormLayoutView()) ->setUser($viewer); - if ($gd) { - $unique_default = id(new PhabricatorFilesComposeAvatarBuiltinFile()) - ->getUniqueProfileImage($name); - $default_image = PhabricatorFile::loadBuiltin( - $viewer, $unique_default['icon']); - } else { - $unique_default = null; + $default_image = $user->getDefaultProfileImagePHID(); + if ($default_image) { + $default_image = id(new PhabricatorFileQuery()) + ->setViewer($viewer) + ->withPHIDs(array($default_image)) + ->executeOne(); + } + + if (!$default_image) { $default_image = PhabricatorFile::loadBuiltin($viewer, 'profile.png'); } @@ -181,21 +173,9 @@ final class PhabricatorPeopleProfilePictureController } } - $default_style = array(); - if ($unique_default) { - $border_color = implode(', ', $unique_default['border']); - $default_style = array( - 'background-color: '.$unique_default['color'].';', - 'border: 4px solid rgba('.$border_color.');', - 'height: 42px;', - 'width: 42px', - ); - } - $images[PhabricatorPHIDConstants::PHID_VOID] = array( 'uri' => $default_image->getBestURI(), 'tip' => pht('Default Picture'), - 'style' => implode(' ', $default_style), ); require_celerity_resource('people-profile-css'); @@ -223,7 +203,6 @@ final class PhabricatorPeopleProfilePictureController 'height' => 50, 'width' => 50, 'src' => $spec['uri'], - 'style' => $style, ))); $button = array( diff --git a/src/applications/people/management/PhabricatorPeopleProfileImageWorkflow.php b/src/applications/people/management/PhabricatorPeopleProfileImageWorkflow.php index 1e594017ff..358756cecd 100644 --- a/src/applications/people/management/PhabricatorPeopleProfileImageWorkflow.php +++ b/src/applications/people/management/PhabricatorPeopleProfileImageWorkflow.php @@ -55,8 +55,14 @@ final class PhabricatorPeopleProfileImageWorkflow foreach ($iterator as $user) { $username = $user->getUsername(); $default_phid = $user->getDefaultProfileImagePHID(); + $gen_version = $user->getDefaultProfileImageVersion(); - if ($default_phid == null || $is_force) { + $generate = false; + if ($gen_version != $version) { + $generate = true; + } + + if ($default_phid == null || $is_force || $generate) { $file = id(new PhabricatorFilesComposeAvatarBuiltinFile()) ->getUserProfileImageFile($username); $user->setDefaultProfileImagePHID($file->getPHID()); diff --git a/src/applications/people/storage/PhabricatorUserProfile.php b/src/applications/people/storage/PhabricatorUserProfile.php index edfa24d78e..da447410f5 100644 --- a/src/applications/people/storage/PhabricatorUserProfile.php +++ b/src/applications/people/storage/PhabricatorUserProfile.php @@ -13,7 +13,9 @@ final class PhabricatorUserProfile extends PhabricatorUserDAO { return id(new self()) ->setUserPHID($user->getPHID()) - ->setIcon($default_icon); + ->setIcon($default_icon) + ->setTitle('') + ->setBlurb(''); } protected function getConfiguration() { From cd6b284678299f854ab3b3d9016bc85c6722d999 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 09:28:38 -0800 Subject: [PATCH 02/24] Highlight strong tag in document headers Summary: Fixes T12357. Adds some color to highlighted text in headers. Test Plan: == Header with **strong** copy == Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12357 Differential Revision: https://secure.phabricator.com/D17469 --- resources/celerity/map.php | 10 +++++----- webroot/rsrc/css/core/remarkup.css | 1 + webroot/rsrc/css/phui/phui-fontkit.css | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 869f20199f..c0ca58a757 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '52a77c4d', + 'core.pkg.css' => '4cdcf76d', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -108,7 +108,7 @@ return array( 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', 'rsrc/css/core/core.css' => '9f4cb463', - 'rsrc/css/core/remarkup.css' => '4a2de2bb', + 'rsrc/css/core/remarkup.css' => '2d793c5b', 'rsrc/css/core/syntax.css' => '769d3498', 'rsrc/css/core/z-index.css' => '5e72c4e0', 'rsrc/css/diviner/diviner-shared.css' => '896f1d43', @@ -145,7 +145,7 @@ return array( 'rsrc/css/phui/phui-document-summary.css' => '9ca48bdf', 'rsrc/css/phui/phui-document.css' => 'c32e8dec', 'rsrc/css/phui/phui-feed-story.css' => '44a9c8e9', - 'rsrc/css/phui/phui-fontkit.css' => '0b2da2d5', + 'rsrc/css/phui/phui-fontkit.css' => 'b78a0059', 'rsrc/css/phui/phui-form-view.css' => 'adca31ce', 'rsrc/css/phui/phui-form.css' => '5815af7b', 'rsrc/css/phui/phui-head-thing.css' => 'fd311e5f', @@ -805,7 +805,7 @@ return array( 'phabricator-object-selector-css' => '85ee8ce6', 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => '8d40ae75', - 'phabricator-remarkup-css' => '4a2de2bb', + 'phabricator-remarkup-css' => '2d793c5b', 'phabricator-search-results-css' => '64ad079a', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-slowvote-css' => 'a94b7230', @@ -857,7 +857,7 @@ return array( 'phui-document-view-pro-css' => 'f56738ed', 'phui-feed-story-css' => '44a9c8e9', 'phui-font-icon-base-css' => '870a7360', - 'phui-fontkit-css' => '0b2da2d5', + 'phui-fontkit-css' => 'b78a0059', 'phui-form-css' => '5815af7b', 'phui-form-view-css' => 'adca31ce', 'phui-head-thing-view-css' => 'fd311e5f', diff --git a/webroot/rsrc/css/core/remarkup.css b/webroot/rsrc/css/core/remarkup.css index 0317eea718..03479398b3 100644 --- a/webroot/rsrc/css/core/remarkup.css +++ b/webroot/rsrc/css/core/remarkup.css @@ -272,6 +272,7 @@ video.phabricator-media { .phabricator-remarkup .phriction-link-missing { color: {$red}; + text-decoration: underline; } .phabricator-remarkup .phriction-link-lock { diff --git a/webroot/rsrc/css/phui/phui-fontkit.css b/webroot/rsrc/css/phui/phui-fontkit.css index ec711612ad..7bca35d277 100644 --- a/webroot/rsrc/css/phui/phui-fontkit.css +++ b/webroot/rsrc/css/phui/phui-fontkit.css @@ -34,3 +34,7 @@ padding: 0 24px 8px 0; margin: 32px 0 4px; } + +.phui-document-view .phabricator-remarkup .remarkup-header strong { + color: #586BE9; +} From e0918883e7f54c2fa7822b98762fb13fdbc446b4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 10:07:01 -0800 Subject: [PATCH 03/24] Add date awarded to profile badges Summary: Ref T12270. Adds the date the badge was awarded. Test Plan: Award a badge, see date on profile badge when card is flipped. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12270 Differential Revision: https://secure.phabricator.com/D17471 --- .../controller/PhabricatorPeopleProfileBadgesController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php index 73e5459cda..93b1f91ea8 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileBadgesController.php @@ -105,6 +105,7 @@ final class PhabricatorPeopleProfileBadgesController $award = idx($awards, $badge->getPHID(), null); $awarder_phid = $award->getAwarderPHID(); $awarder_handle = $viewer->renderHandle($awarder_phid); + $awarded_date = phabricator_date($award->getDateCreated(), $viewer); $awarder_info = pht( 'Awarded by %s', @@ -116,7 +117,8 @@ final class PhabricatorPeopleProfileBadgesController ->setSubhead($badge->getFlavor()) ->setQuality($badge->getQuality()) ->setHref($badge->getViewURI()) - ->addByLine($awarder_info); + ->addByLine($awarder_info) + ->addByLine($awarded_date); $flex->addItem($item); } From 26d3d41693a27eef82d4be312a346f89e05b8fcf Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 09:54:34 -0800 Subject: [PATCH 04/24] Update tasks/commits, remove diffs from Profile Summary: Mostly a minor nit-pick, but I hate sending users off the profile and disorient them onto application search. These pages are pretty easy to maintain, I don't expect to need to do more here. I dropped Differential outright. Kept Tasks and Commits. Now you can browse everything about a user on their profile without leaving. Maybe add a link to ApplicationSearch? Not sure it's important. Test Plan: Review tasks and commits on mine and other user profiles. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17470 --- src/__phutil_library_map__.php | 8 ++ .../PhabricatorPeopleApplication.php | 4 + ...bricatorPeopleProfileCommitsController.php | 81 +++++++++++++++++ ...habricatorPeopleProfileTasksController.php | 86 +++++++++++++++++++ .../PhabricatorPeopleProfileMenuEngine.php | 40 ++------- ...habricatorPeopleCommitsProfileMenuItem.php | 59 +++++++++++++ .../PhabricatorPeopleTasksProfileMenuItem.php | 59 +++++++++++++ 7 files changed, 303 insertions(+), 34 deletions(-) create mode 100644 src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php create mode 100644 src/applications/people/controller/PhabricatorPeopleProfileTasksController.php create mode 100644 src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php create mode 100644 src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 600f30601c..684116b6c5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3340,6 +3340,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleApplication' => 'applications/people/application/PhabricatorPeopleApplication.php', 'PhabricatorPeopleApproveController' => 'applications/people/controller/PhabricatorPeopleApproveController.php', 'PhabricatorPeopleBadgesProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php', + 'PhabricatorPeopleCommitsProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php', 'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php', 'PhabricatorPeopleCreateController' => 'applications/people/controller/PhabricatorPeopleCreateController.php', 'PhabricatorPeopleCreateGuidanceContext' => 'applications/people/guidance/PhabricatorPeopleCreateGuidanceContext.php', @@ -3365,16 +3366,19 @@ phutil_register_library_map(array( 'PhabricatorPeopleOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php', 'PhabricatorPeoplePictureProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php', 'PhabricatorPeopleProfileBadgesController' => 'applications/people/controller/PhabricatorPeopleProfileBadgesController.php', + 'PhabricatorPeopleProfileCommitsController' => 'applications/people/controller/PhabricatorPeopleProfileCommitsController.php', 'PhabricatorPeopleProfileController' => 'applications/people/controller/PhabricatorPeopleProfileController.php', 'PhabricatorPeopleProfileEditController' => 'applications/people/controller/PhabricatorPeopleProfileEditController.php', 'PhabricatorPeopleProfileImageWorkflow' => 'applications/people/management/PhabricatorPeopleProfileImageWorkflow.php', 'PhabricatorPeopleProfileManageController' => 'applications/people/controller/PhabricatorPeopleProfileManageController.php', 'PhabricatorPeopleProfileMenuEngine' => 'applications/people/engine/PhabricatorPeopleProfileMenuEngine.php', 'PhabricatorPeopleProfilePictureController' => 'applications/people/controller/PhabricatorPeopleProfilePictureController.php', + 'PhabricatorPeopleProfileTasksController' => 'applications/people/controller/PhabricatorPeopleProfileTasksController.php', 'PhabricatorPeopleProfileViewController' => 'applications/people/controller/PhabricatorPeopleProfileViewController.php', 'PhabricatorPeopleQuery' => 'applications/people/query/PhabricatorPeopleQuery.php', 'PhabricatorPeopleRenameController' => 'applications/people/controller/PhabricatorPeopleRenameController.php', 'PhabricatorPeopleSearchEngine' => 'applications/people/query/PhabricatorPeopleSearchEngine.php', + 'PhabricatorPeopleTasksProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php', 'PhabricatorPeopleTestDataGenerator' => 'applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php', 'PhabricatorPeopleTransactionQuery' => 'applications/people/query/PhabricatorPeopleTransactionQuery.php', 'PhabricatorPeopleUserFunctionDatasource' => 'applications/people/typeahead/PhabricatorPeopleUserFunctionDatasource.php', @@ -8528,6 +8532,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleApplication' => 'PhabricatorApplication', 'PhabricatorPeopleApproveController' => 'PhabricatorPeopleController', 'PhabricatorPeopleBadgesProfileMenuItem' => 'PhabricatorProfileMenuItem', + 'PhabricatorPeopleCommitsProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorPeopleController' => 'PhabricatorController', 'PhabricatorPeopleCreateController' => 'PhabricatorPeopleController', 'PhabricatorPeopleCreateGuidanceContext' => 'PhabricatorGuidanceContext', @@ -8553,16 +8558,19 @@ phutil_register_library_map(array( 'PhabricatorPeopleOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorPeoplePictureProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorPeopleProfileBadgesController' => 'PhabricatorPeopleProfileController', + 'PhabricatorPeopleProfileCommitsController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileController' => 'PhabricatorPeopleController', 'PhabricatorPeopleProfileEditController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileImageWorkflow' => 'PhabricatorPeopleManagementWorkflow', 'PhabricatorPeopleProfileManageController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileMenuEngine' => 'PhabricatorProfileMenuEngine', 'PhabricatorPeopleProfilePictureController' => 'PhabricatorPeopleProfileController', + 'PhabricatorPeopleProfileTasksController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleProfileViewController' => 'PhabricatorPeopleProfileController', 'PhabricatorPeopleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorPeopleRenameController' => 'PhabricatorPeopleController', 'PhabricatorPeopleSearchEngine' => 'PhabricatorApplicationSearchEngine', + 'PhabricatorPeopleTasksProfileMenuItem' => 'PhabricatorProfileMenuItem', 'PhabricatorPeopleTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorPeopleTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorPeopleUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php index d295319b71..f2bb70e423 100644 --- a/src/applications/people/application/PhabricatorPeopleApplication.php +++ b/src/applications/people/application/PhabricatorPeopleApplication.php @@ -66,6 +66,10 @@ final class PhabricatorPeopleApplication extends PhabricatorApplication { 'PhabricatorPeopleProfileEditController', 'badges/(?P[1-9]\d*)/' => 'PhabricatorPeopleProfileBadgesController', + 'tasks/(?P[1-9]\d*)/' => + 'PhabricatorPeopleProfileTasksController', + 'commits/(?P[1-9]\d*)/' => + 'PhabricatorPeopleProfileCommitsController', 'picture/(?P[1-9]\d*)/' => 'PhabricatorPeopleProfilePictureController', 'manage/(?P[1-9]\d*)/' => diff --git a/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php new file mode 100644 index 0000000000..2089bf00eb --- /dev/null +++ b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php @@ -0,0 +1,81 @@ +getViewer(); + $id = $request->getURIData('id'); + + $user = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withIDs(array($id)) + ->needProfile(true) + ->needProfileImage(true) + ->needAvailability(true) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + )) + ->executeOne(); + if (!$user) { + return new Aphront404Response(); + } + + $class = 'PhabricatorDiffusionApplication'; + if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + return new Aphront404Response(); + } + + $this->setUser($user); + $title = array(pht('Recent Commits'), $user->getUsername()); + $header = $this->buildProfileHeader(); + $commits = $this->buildCommitsView($user); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb(pht('Recent Commits')); + $crumbs->setBorder(true); + + $nav = $this->getProfileMenu(); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_COMMITS); + + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->addClass('project-view-home') + ->addClass('project-view-people-home') + ->setFooter(array( + $commits, + )); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->setNavigation($nav) + ->appendChild($view); + } + + private function buildCommitsView(PhabricatorUser $user) { + $viewer = $this->getViewer(); + + $commits = id(new DiffusionCommitQuery()) + ->setViewer($viewer) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + )) + ->setLimit(100) + ->execute(); + + $list = id(new PhabricatorAuditListView()) + ->setViewer($viewer) + ->setCommits($commits) + ->setNoDataString(pht('No recent commits.')); + + $view = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Recent Commits')) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->appendChild($list); + + return $view; + } +} diff --git a/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php new file mode 100644 index 0000000000..293c50aa82 --- /dev/null +++ b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php @@ -0,0 +1,86 @@ +getViewer(); + $id = $request->getURIData('id'); + + $user = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withIDs(array($id)) + ->needProfile(true) + ->needProfileImage(true) + ->needAvailability(true) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + )) + ->executeOne(); + if (!$user) { + return new Aphront404Response(); + } + + $class = 'PhabricatorManiphestApplication'; + if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { + return new Aphront404Response(); + } + + $this->setUser($user); + $title = array(pht('Assigned Tasks'), $user->getUsername()); + $header = $this->buildProfileHeader(); + $tasks = $this->buildTasksView($user); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb(pht('Assigned Tasks')); + $crumbs->setBorder(true); + + $nav = $this->getProfileMenu(); + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_TASKS); + + $view = id(new PHUITwoColumnView()) + ->setHeader($header) + ->addClass('project-view-home') + ->addClass('project-view-people-home') + ->setFooter(array( + $tasks, + )); + + return $this->newPage() + ->setTitle($title) + ->setCrumbs($crumbs) + ->setNavigation($nav) + ->appendChild($view); + } + + private function buildTasksView(PhabricatorUser $user) { + $viewer = $this->getViewer(); + + $tasks = id(new ManiphestTaskQuery()) + ->setViewer($viewer) + ->withOwners(array($user->getPHID())) + ->needProjectPHIDs(true) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + )) + ->setLimit(100) + ->execute(); + + $handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks); + + $list = id(new ManiphestTaskListView()) + ->setUser($viewer) + ->setHandles($handles) + ->setTasks($tasks) + ->setNoDataString(pht('No assigned tasks.')); + + $view = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Assigned Tasks')) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) + ->appendChild($list); + + return $view; + } +} diff --git a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php index 9e4bbba874..e5f25eb4a0 100644 --- a/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php +++ b/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php @@ -7,6 +7,8 @@ final class PhabricatorPeopleProfileMenuEngine const ITEM_MANAGE = 'people.manage'; const ITEM_PICTURE = 'people.picture'; const ITEM_BADGES = 'people.badges'; + const ITEM_TASKS = 'people.tasks'; + const ITEM_COMMITS = 'people.commits'; protected function isMenuEngineConfigurable() { return false; @@ -45,48 +47,18 @@ final class PhabricatorPeopleProfileMenuEngine 'PhabricatorManiphestApplication', $viewer); if ($have_maniphest) { - $uri = urisprintf( - '/maniphest/?statuses=open()&assigned=%s#R', - $object->getPHID()); - $items[] = $this->newItem() - ->setBuiltinKey('tasks') - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) - ->setMenuItemProperty('icon', 'maniphest') - ->setMenuItemProperty('name', pht('Open Tasks')) - ->setMenuItemProperty('uri', $uri); - } - - $have_differential = PhabricatorApplication::isClassInstalledForViewer( - 'PhabricatorDifferentialApplication', - $viewer); - if ($have_differential) { - $uri = urisprintf( - '/differential/?authors=%s#R', - $object->getPHID()); - - $items[] = $this->newItem() - ->setBuiltinKey('revisions') - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) - ->setMenuItemProperty('icon', 'differential') - ->setMenuItemProperty('name', pht('Revisions')) - ->setMenuItemProperty('uri', $uri); + ->setBuiltinKey(self::ITEM_TASKS) + ->setMenuItemKey(PhabricatorPeopleTasksProfileMenuItem::MENUITEMKEY); } $have_diffusion = PhabricatorApplication::isClassInstalledForViewer( 'PhabricatorDiffusionApplication', $viewer); if ($have_diffusion) { - $uri = urisprintf( - '/diffusion/commit/?authors=%s#R', - $object->getPHID()); - $items[] = $this->newItem() - ->setBuiltinKey('commits') - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) - ->setMenuItemProperty('icon', 'diffusion') - ->setMenuItemProperty('name', pht('Commits')) - ->setMenuItemProperty('uri', $uri); + ->setBuiltinKey(self::ITEM_COMMITS) + ->setMenuItemKey(PhabricatorPeopleCommitsProfileMenuItem::MENUITEMKEY); } $items[] = $this->newItem() diff --git a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php new file mode 100644 index 0000000000..f1d8be1828 --- /dev/null +++ b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php @@ -0,0 +1,59 @@ +getMenuItemProperty('name'); + + if (strlen($name)) { + return $name; + } + + return $this->getDefaultName(); + } + + public function buildEditEngineFields( + PhabricatorProfileMenuItemConfiguration $config) { + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setPlaceholder($this->getDefaultName()) + ->setValue($config->getMenuItemProperty('name')), + ); + } + + protected function newNavigationMenuItems( + PhabricatorProfileMenuItemConfiguration $config) { + + $user = $config->getProfileObject(); + $id = $user->getID(); + + $item = $this->newItem() + ->setHref("/people/commits/{$id}/") + ->setName($this->getDisplayName($config)) + ->setIcon('fa-code'); + + return array( + $item, + ); + } + +} diff --git a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php new file mode 100644 index 0000000000..c2a5036521 --- /dev/null +++ b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php @@ -0,0 +1,59 @@ +getMenuItemProperty('name'); + + if (strlen($name)) { + return $name; + } + + return $this->getDefaultName(); + } + + public function buildEditEngineFields( + PhabricatorProfileMenuItemConfiguration $config) { + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setPlaceholder($this->getDefaultName()) + ->setValue($config->getMenuItemProperty('name')), + ); + } + + protected function newNavigationMenuItems( + PhabricatorProfileMenuItemConfiguration $config) { + + $user = $config->getProfileObject(); + $id = $user->getID(); + + $item = $this->newItem() + ->setHref("/people/tasks/{$id}/") + ->setName($this->getDisplayName($config)) + ->setIcon('fa-anchor'); + + return array( + $item, + ); + } + +} From 0d12bbb9038c145af73941482f633b3d44551fad Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 10:36:35 -0800 Subject: [PATCH 05/24] Set a max-width on crumbs just in case Summary: Ref D17361. This sets a reasonable width on crumbs just in case a title is super long. Also fixes a weird Safari issue. Test Plan: Set a username to "hector" and check Safari. Create a badge named "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" and test length. {F3771744} {F3771747} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17472 --- resources/celerity/map.php | 6 +++--- webroot/rsrc/css/phui/phui-crumbs-view.css | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c0ca58a757..ef007923a6 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '4cdcf76d', + 'core.pkg.css' => 'aab1d168', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -139,7 +139,7 @@ return array( 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '48fbd65d', 'rsrc/css/phui/phui-comment-panel.css' => 'f50152ad', - 'rsrc/css/phui/phui-crumbs-view.css' => 'b743f73e', + 'rsrc/css/phui/phui-crumbs-view.css' => 'ccbf2a0c', 'rsrc/css/phui/phui-curtain-view.css' => '947bf1a4', 'rsrc/css/phui/phui-document-pro.css' => 'f56738ed', 'rsrc/css/phui/phui-document-summary.css' => '9ca48bdf', @@ -850,7 +850,7 @@ return array( 'phui-cms-css' => '504b4b23', 'phui-comment-form-css' => '48fbd65d', 'phui-comment-panel-css' => 'f50152ad', - 'phui-crumbs-view-css' => 'b743f73e', + 'phui-crumbs-view-css' => 'ccbf2a0c', 'phui-curtain-view-css' => '947bf1a4', 'phui-document-summary-view-css' => '9ca48bdf', 'phui-document-view-css' => 'c32e8dec', diff --git a/webroot/rsrc/css/phui/phui-crumbs-view.css b/webroot/rsrc/css/phui/phui-crumbs-view.css index d2d0744819..3428a9cda0 100644 --- a/webroot/rsrc/css/phui/phui-crumbs-view.css +++ b/webroot/rsrc/css/phui/phui-crumbs-view.css @@ -48,6 +48,17 @@ .phui-crumb-view { float: left; padding: 8px 0; + max-width: 240px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/* Safari Hack, See D17361 */ +.phui-crumb-view:after { + content: "\0000a0"; + display: inline-block; + width: 0; } .device-phone .phui-crumb-view.phabricator-last-crumb .phui-crumb-name, From b28da10336cad5fd2f4524167e8dc4e6864556f2 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 10:48:52 -0800 Subject: [PATCH 06/24] Allow Phrequent to be used in dashboard panels Summary: Probably useful if you use Phrequent. Test Plan: I did not test this beyond lint/unit. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17473 --- src/applications/phrequent/query/PhrequentSearchEngine.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php index 46f7ae769c..d137c40b64 100644 --- a/src/applications/phrequent/query/PhrequentSearchEngine.php +++ b/src/applications/phrequent/query/PhrequentSearchEngine.php @@ -10,11 +10,6 @@ final class PhrequentSearchEngine extends PhabricatorApplicationSearchEngine { return 'PhabricatorPhrequentApplication'; } - public function canUseInPanelContext() { - return false; - } - - public function getPageSize(PhabricatorSavedQuery $saved) { return $saved->getParameter('limit', 1000); } From 814c28d39a81bf300296caf534038a6ddc7228d1 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 6 Mar 2017 19:58:08 +0000 Subject: [PATCH 07/24] Add quality and icon to Badge Lipsum generator Summary: This just adds a few more dimensions to the generator. Test Plan: run `bin/lipsum generate badges`, verify new icons and quality work. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17474 --- ...habricatorBadgesBadgeTestDataGenerator.php | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php index 9b29ecb4f8..8d56e20fa3 100644 --- a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php +++ b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php @@ -12,7 +12,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator public function generateObject() { $author = $this->loadRandomUser(); - list($name, $description) = $this->newLoot(); + list($name, $description, $quality, $icon) = $this->newLoot(); $xactions = array(); @@ -26,6 +26,16 @@ final class PhabricatorBadgesBadgeTestDataGenerator 'value' => $description, ); + $xactions[] = array( + 'type' => 'quality', + 'value' => (string)$quality, + ); + + $xactions[] = array( + 'type' => 'icon', + 'value' => $icon, + ); + $params = array( 'transactions' => $xactions, ); @@ -58,7 +68,17 @@ final class PhabricatorBadgesBadgeTestDataGenerator $drop = preg_replace($effect_pattern, '', $drop); - return array($drop, $description); + $quality_map = PhabricatorBadgesQuality::getQualityMap(); + shuffle($quality_map); + $quality = head($quality_map); + $rarity = $quality['rarity']; + + $icon_map = id(new PhabricatorBadgesIconSet())->getIcons(); + shuffle($icon_map); + $icon_map = head($icon_map); + $icon = $icon_map->getKey(); + + return array($drop, $description, $rarity, $icon); } public function rollDropValue($matches) { From 129483d5eac4a0a25f832f6ce57eebf72d610948 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 01:23:59 +0000 Subject: [PATCH 08/24] Attach commit data to commit list on people Summary: Fixes T12360. I'll probably make a non-audit commit list for this, maybe, eventually, until then add all the needed audit information. Test Plan: Review commits in my profile, see data and not a fatal. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12360 Differential Revision: https://secure.phabricator.com/D17475 --- .../controller/PhabricatorPeopleProfileCommitsController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php index 2089bf00eb..32b3aae237 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php @@ -59,6 +59,9 @@ final class PhabricatorPeopleProfileCommitsController $commits = id(new DiffusionCommitQuery()) ->setViewer($viewer) + ->needAuditRequests(true) + ->needCommitData(true) + ->needDrafts(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, From 0b4ccdade9ab2b31b574f137e86928d8d5bcf24d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 07:34:08 -0800 Subject: [PATCH 09/24] Show only open tasks on Tasks people profile panel Summary: This currently queries all tasks, make it limit to only open tasks. Test Plan: Assign myself an open and a resolved task. See only open on profile. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17476 --- .../PhabricatorPeopleProfileTasksController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php index 293c50aa82..52c88d89fa 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileTasksController.php @@ -57,14 +57,13 @@ final class PhabricatorPeopleProfileTasksController private function buildTasksView(PhabricatorUser $user) { $viewer = $this->getViewer(); + $open = ManiphestTaskStatus::getOpenStatusConstants(); + $tasks = id(new ManiphestTaskQuery()) ->setViewer($viewer) ->withOwners(array($user->getPHID())) + ->withStatuses($open) ->needProjectPHIDs(true) - ->requireCapabilities( - array( - PhabricatorPolicyCapability::CAN_VIEW, - )) ->setLimit(100) ->execute(); @@ -74,7 +73,7 @@ final class PhabricatorPeopleProfileTasksController ->setUser($viewer) ->setHandles($handles) ->setTasks($tasks) - ->setNoDataString(pht('No assigned tasks.')); + ->setNoDataString(pht('No open, assigned tasks.')); $view = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Assigned Tasks')) From 614c8497bb4a33cb02c1c63338aabad081b142e6 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 14:19:26 -0800 Subject: [PATCH 10/24] Add badges to TransactionCommentView Summary: Fixes T10698. This shows badges under the comment preview if the application uses TransactionCommentView. I suspect not everything does, but will pick the fix up for free when modernized. Test Plan: Test commenting on a task with and without a user that has a badge. See badge preview. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T10698 Differential Revision: https://secure.phabricator.com/D17480 --- ...catorApplicationTransactionCommentView.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index 2d4c5e6f95..0847edd666 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -238,11 +238,15 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { 'class' => 'phui-timeline-wedge', ), ''); + + $badge_view = $this->renderBadgeView(); + $comment_box = id(new PHUIObjectBoxView()) ->setFlush(true) ->addClass('phui-comment-form-view') ->addSigil('phui-comment-form') ->appendChild($image) + ->appendChild($badge_view) ->appendChild($wedge) ->appendChild($comment); @@ -512,4 +516,47 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { return $options; } + private function renderBadgeView() { + $user = $this->getUser(); + $can_use_badges = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorBadgesApplication', + $user); + if (!$can_use_badges) { + return null; + } + + $awards = id(new PhabricatorBadgesAwardQuery()) + ->setViewer($this->getUser()) + ->withRecipientPHIDs(array($user->getPHID())) + ->setLimit(2) + ->execute(); + + $badge_view = null; + if ($awards) { + $badges = mpull($awards, 'getBadge'); + $badge_list = array(); + foreach ($badges as $badge) { + $badge_view = id(new PHUIBadgeMiniView()) + ->setIcon($badge->getIcon()) + ->setQuality($badge->getQuality()) + ->setHeader($badge->getName()) + ->setTipDirection('E') + ->setHref('/badges/view/'.$badge->getID()); + + $badge_list[] = $badge_view; + } + $flex = new PHUIBadgeBoxView(); + $flex->addItems($badge_list); + $flex->setCollapsed(true); + $badge_view = phutil_tag( + 'div', + array( + 'class' => 'phui-timeline-badges', + ), + $flex); + } + + return $badge_view; + } + } From 3422b4205b52773e69a0aabf07a0ade0dc2b0aab Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 11:42:45 -0800 Subject: [PATCH 11/24] Fix milestone widget header color on projects profile Summary: This should be blue, not grey. Test Plan: Add a milestone and subproject to a project Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17477 --- .../project/controller/PhabricatorProjectProfileController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index 9e8d4edd49..dae57e55f9 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -244,7 +244,7 @@ final class PhabricatorProjectProfileController return id(new PHUIObjectBoxView()) ->setHeader($header) - ->setBackground(PHUIObjectBoxView::GREY) + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setObjectList($milestone_list); } From 683b0221c33c516c58668276564048919bcead38 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 11:52:38 -0800 Subject: [PATCH 12/24] Fix long project names in policy controls Summary: Fixes T12366. Adds a text-overflow to policy buttons. Test Plan: Set a view policy to MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM Reviewers: epriestley, eliaspro Reviewed By: epriestley, eliaspro Subscribers: eliaspro, Korvin Maniphest Tasks: T12366 Differential Revision: https://secure.phabricator.com/D17478 --- resources/celerity/map.php | 6 +++--- webroot/rsrc/css/phui/phui-button.css | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index ef007923a6..4855aef6a8 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => 'aab1d168', + 'core.pkg.css' => 'bb303011', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -134,7 +134,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => '7eaff361', + 'rsrc/css/phui/phui-button.css' => 'd30999e4', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '48fbd65d', @@ -841,7 +841,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => '7eaff361', + 'phui-button-css' => 'd30999e4', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index d801cdb513..75ad3c09e4 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -235,6 +235,13 @@ a.policy-control .caret { float: right; } +a.policy-control .phui-button-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: block; +} + .caret { display: inline-block; width: 0; From 2ebdf2e080d1b93ef47fecc4d10d1f626ad319a0 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 13:26:28 -0800 Subject: [PATCH 13/24] Remove server side limit on policy control names Summary: Fixes T12367. CSS here already truncates (or should have been) and is generally more effective. Remove the unneeded server side truncation. Any other UI place these render? Test Plan: Set Policy to a group name of "Stanford University: Alumni Association and Friends" and see better truncation. Reviewers: epriestley, eliaspro Reviewed By: epriestley, eliaspro Subscribers: eliaspro, Korvin Maniphest Tasks: T12367 Differential Revision: https://secure.phabricator.com/D17479 --- resources/celerity/map.php | 6 +++--- src/view/form/control/AphrontFormPolicyControl.php | 6 +----- webroot/rsrc/css/phui/phui-action-list.css | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 4855aef6a8..86de05e9bb 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => 'bb303011', + 'core.pkg.css' => '7e10ec60', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -128,7 +128,7 @@ return array( 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '5c383524', 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', - 'rsrc/css/phui/phui-action-list.css' => 'f980c059', + 'rsrc/css/phui/phui-action-list.css' => '29bb1c5e', 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', 'rsrc/css/phui/phui-badge.css' => '22c0cf4f', 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', @@ -780,7 +780,7 @@ return array( 'path-typeahead' => 'f7fc67ec', 'people-picture-menu-item-css' => 'a06f7f34', 'people-profile-css' => '4df76faf', - 'phabricator-action-list-view-css' => 'f980c059', + 'phabricator-action-list-view-css' => '29bb1c5e', 'phabricator-busy' => '59a7976a', 'phabricator-chatlog-css' => 'd295b020', 'phabricator-content-source-view-css' => '4b8b05d4', diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php index 6448b2b8b2..2ce13491af 100644 --- a/src/view/form/control/AphrontFormPolicyControl.php +++ b/src/view/form/control/AphrontFormPolicyControl.php @@ -153,12 +153,8 @@ final class AphrontFormPolicyControl extends AphrontFormControl { } } - $policy_short_name = id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(28) - ->truncateString($policy->getName()); - $options[$policy->getType()][$policy->getPHID()] = array( - 'name' => $policy_short_name, + 'name' => $policy->getName(), 'full' => $policy->getName(), 'icon' => $policy->getIcon(), 'sort' => phutil_utf8_strtolower($policy->getName()), diff --git a/webroot/rsrc/css/phui/phui-action-list.css b/webroot/rsrc/css/phui/phui-action-list.css index 874af5ee42..0a811cbab0 100644 --- a/webroot/rsrc/css/phui/phui-action-list.css +++ b/webroot/rsrc/css/phui/phui-action-list.css @@ -69,6 +69,7 @@ color: {$darkbluetext}; text-overflow: ellipsis; overflow: hidden; + white-space: nowrap; } .action-has-icon button.phabricator-action-view-item, From abff6dc8a9b4e081d74beaf8f062223cb5308ec3 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 7 Mar 2017 22:37:42 -0800 Subject: [PATCH 14/24] Scope commits page on people to just your commits Summary: This is overly broad and I missed it in local testing with just a single account. Let's pull just the author in. Test Plan: Review a commit page that wasn't my own, see other authors commits. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17481 --- .../controller/PhabricatorPeopleProfileCommitsController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php index 32b3aae237..f2adf4b23d 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php @@ -59,6 +59,7 @@ final class PhabricatorPeopleProfileCommitsController $commits = id(new DiffusionCommitQuery()) ->setViewer($viewer) + ->withAuthorPHIDs(array($user->getPHID())) ->needAuditRequests(true) ->needCommitData(true) ->needDrafts(true) From 2fed5b69257ddfde440d13806a938c585cce3340 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 8 Mar 2017 17:52:57 -0800 Subject: [PATCH 15/24] Fourth fix for the magical world of crumbs and text-overflow Summary: The Safari hack in place casued a truncation issue in Firefox, so that hack is now gone. Instead the bug appears to be the creative inclusion of "space". In fiddling with this adding one space inside the span and one space outside the span seems to resolve all cases. Test Plan: Chrome, Safari, Firefox. Test "hector" and copy paste of a Task ID. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17483 --- resources/celerity/map.php | 6 +++--- src/view/phui/PHUICrumbView.php | 6 +++++- webroot/rsrc/css/phui/phui-crumbs-view.css | 7 ------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 86de05e9bb..3e1a4ac992 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '7e10ec60', + 'core.pkg.css' => 'db710bcc', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -139,7 +139,7 @@ return array( 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '48fbd65d', 'rsrc/css/phui/phui-comment-panel.css' => 'f50152ad', - 'rsrc/css/phui/phui-crumbs-view.css' => 'ccbf2a0c', + 'rsrc/css/phui/phui-crumbs-view.css' => '6ece3bbb', 'rsrc/css/phui/phui-curtain-view.css' => '947bf1a4', 'rsrc/css/phui/phui-document-pro.css' => 'f56738ed', 'rsrc/css/phui/phui-document-summary.css' => '9ca48bdf', @@ -850,7 +850,7 @@ return array( 'phui-cms-css' => '504b4b23', 'phui-comment-form-css' => '48fbd65d', 'phui-comment-panel-css' => 'f50152ad', - 'phui-crumbs-view-css' => 'ccbf2a0c', + 'phui-crumbs-view-css' => '6ece3bbb', 'phui-curtain-view-css' => '947bf1a4', 'phui-document-summary-view-css' => '9ca48bdf', 'phui-document-view-css' => 'c32e8dec', diff --git a/src/view/phui/PHUICrumbView.php b/src/view/phui/PHUICrumbView.php index 392a354123..68c43be4e3 100644 --- a/src/view/phui/PHUICrumbView.php +++ b/src/view/phui/PHUICrumbView.php @@ -75,7 +75,7 @@ final class PHUICrumbView extends AphrontView { // Surround the crumb name with spaces so that double clicking it only // selects the crumb itself. - $name = array(' ', $this->name, ' '); + $name = array(' ', $this->name); $name = phutil_tag( 'span', @@ -84,6 +84,10 @@ final class PHUICrumbView extends AphrontView { ), $name); + // Because of text-overflow and safari, put the second space on the + // outside of the element. + $name = array($name, ' '); + $divider = null; if (!$this->isLastCrumb) { $divider = id(new PHUIIconView()) diff --git a/webroot/rsrc/css/phui/phui-crumbs-view.css b/webroot/rsrc/css/phui/phui-crumbs-view.css index 3428a9cda0..6155e9b2b8 100644 --- a/webroot/rsrc/css/phui/phui-crumbs-view.css +++ b/webroot/rsrc/css/phui/phui-crumbs-view.css @@ -54,13 +54,6 @@ text-overflow: ellipsis; } -/* Safari Hack, See D17361 */ -.phui-crumb-view:after { - content: "\0000a0"; - display: inline-block; - width: 0; -} - .device-phone .phui-crumb-view.phabricator-last-crumb .phui-crumb-name, .device-phone .phui-crumb-view.phui-crumb-has-icon, .device-phone .phui-crumb-has-icon + .phui-crumb-divider { From 4c7d464f8bf2627ef7455596fde2ae5667e67a57 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 8 Mar 2017 18:02:16 -0800 Subject: [PATCH 16/24] Fix firefox submenu arrows on action lists Summary: Fixes T12370. Moves this to be absolutely positions so the float doesn't mess up text-overflow layouts. Test Plan: Chrome, Safari, Firefox, mobile and desktop layouts of Maniphest submenus. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12370 Differential Revision: https://secure.phabricator.com/D17484 --- resources/celerity/map.php | 10 ++++---- webroot/rsrc/css/phui/phui-action-list.css | 28 ++++++++++++++++++++++ webroot/rsrc/css/phui/phui-button.css | 26 -------------------- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3e1a4ac992..43bc338457 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => 'db710bcc', + 'core.pkg.css' => '49a02d1f', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -128,13 +128,13 @@ return array( 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '5c383524', 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', - 'rsrc/css/phui/phui-action-list.css' => '29bb1c5e', + 'rsrc/css/phui/phui-action-list.css' => 'c01858f4', 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', 'rsrc/css/phui/phui-badge.css' => '22c0cf4f', 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => 'd30999e4', + 'rsrc/css/phui/phui-button.css' => 'c55204db', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '48fbd65d', @@ -780,7 +780,7 @@ return array( 'path-typeahead' => 'f7fc67ec', 'people-picture-menu-item-css' => 'a06f7f34', 'people-profile-css' => '4df76faf', - 'phabricator-action-list-view-css' => '29bb1c5e', + 'phabricator-action-list-view-css' => 'c01858f4', 'phabricator-busy' => '59a7976a', 'phabricator-chatlog-css' => 'd295b020', 'phabricator-content-source-view-css' => '4b8b05d4', @@ -841,7 +841,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => 'd30999e4', + 'phui-button-css' => 'c55204db', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', diff --git a/webroot/rsrc/css/phui/phui-action-list.css b/webroot/rsrc/css/phui/phui-action-list.css index 0a811cbab0..4569438d5a 100644 --- a/webroot/rsrc/css/phui/phui-action-list.css +++ b/webroot/rsrc/css/phui/phui-action-list.css @@ -165,3 +165,31 @@ margin-top: 8px; border-top: 1px solid {$thinblueborder}; } + +/******* Sub Menu *************************************************************/ + +.phabricator-action-view-submenu .caret-right { + position: absolute; + top: 8px; + right: 8px; + border-left-color: {$alphablue}; +} + +.phabricator-action-view-submenu .caret { + position: absolute; + top: 10px; + right: 8px; + border-top: 7px solid {$lightgreytext}; +} + +.phabricator-action-list-view .phabricator-action-view-submenu.phui-submenu-open + .phabricator-action-view-item { + background-color: rgba({$alphablue}, 0.07); + color: {$sky}; + border-radius: 3px; +} + +.phabricator-action-list-view .phabricator-action-view-submenu.phui-submenu-open + .phabricator-action-view-item .phui-icon-view { + color: {$sky}; +} diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index 75ad3c09e4..eca5a6254c 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -290,32 +290,6 @@ a.policy-control .phui-button-text { border-top-color: #000; } -.phabricator-action-view-submenu .caret-right { - float: right; - margin-top: 4px; - margin-right: 6px; - border-left-color: {$alphablue}; -} - -.phabricator-action-view-submenu .caret { - float: right; - margin-top: 5px; - margin-right: 4px; - border-top: 7px solid {$lightgreytext}; -} - -.phabricator-action-list-view .phabricator-action-view-submenu.phui-submenu-open - .phabricator-action-view-item { - background-color: rgba({$alphablue}, 0.07); - color: {$sky}; - border-radius: 3px; -} - -.phabricator-action-list-view .phabricator-action-view-submenu.phui-submenu-open - .phabricator-action-view-item .phui-icon-view { - color: {$sky}; -} - /* Icons */ .button.has-icon { position: relative; From d0c648dfa53baba49460f379d2f0a8a461b335f8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 9 Mar 2017 08:41:03 -0800 Subject: [PATCH 17/24] Make "Can Interact" and logged-out users interact more gracefully Summary: Fixes T12378. Two minor issues here: - CAN_INTERACT on tasks uses "USER", but should just use the view policy, which may be more permissive ("PUBLIC"). - CAN_INTERACT is currently prevented from being "PUBLIC" by additional safeguards. Define an explicit capability object for the permission which returns `true` from `shouldAllowPublicPolicySetting()`. Test Plan: - Viewed an unlocked task as a logged-out user, saw "login to comment" instead of "locked". - Viewed a locked task as a logged-out user, saw "locked". Reviewers: chad Reviewed By: chad Maniphest Tasks: T12378 Differential Revision: https://secure.phabricator.com/D17485 --- src/__phutil_library_map__.php | 2 ++ .../maniphest/storage/ManiphestTask.php | 2 +- ...PhabricatorPolicyCanInteractCapability.php | 20 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/applications/policy/capability/PhabricatorPolicyCanInteractCapability.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 684116b6c5..455dee187f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3445,6 +3445,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyAwareQuery' => 'infrastructure/query/policy/PhabricatorPolicyAwareQuery.php', 'PhabricatorPolicyAwareTestQuery' => 'applications/policy/__tests__/PhabricatorPolicyAwareTestQuery.php', 'PhabricatorPolicyCanEditCapability' => 'applications/policy/capability/PhabricatorPolicyCanEditCapability.php', + 'PhabricatorPolicyCanInteractCapability' => 'applications/policy/capability/PhabricatorPolicyCanInteractCapability.php', 'PhabricatorPolicyCanJoinCapability' => 'applications/policy/capability/PhabricatorPolicyCanJoinCapability.php', 'PhabricatorPolicyCanViewCapability' => 'applications/policy/capability/PhabricatorPolicyCanViewCapability.php', 'PhabricatorPolicyCapability' => 'applications/policy/capability/PhabricatorPolicyCapability.php', @@ -8654,6 +8655,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyAwareQuery' => 'PhabricatorOffsetPagedQuery', 'PhabricatorPolicyAwareTestQuery' => 'PhabricatorPolicyAwareQuery', 'PhabricatorPolicyCanEditCapability' => 'PhabricatorPolicyCapability', + 'PhabricatorPolicyCanInteractCapability' => 'PhabricatorPolicyCapability', 'PhabricatorPolicyCanJoinCapability' => 'PhabricatorPolicyCapability', 'PhabricatorPolicyCanViewCapability' => 'PhabricatorPolicyCapability', 'PhabricatorPolicyCapability' => 'Phobject', diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 36d0a21b07..f03bc277ac 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -361,7 +361,7 @@ final class ManiphestTask extends ManiphestDAO if ($this->isLocked()) { return PhabricatorPolicies::POLICY_NOONE; } else { - return PhabricatorPolicies::POLICY_USER; + return $this->getViewPolicy(); } case PhabricatorPolicyCapability::CAN_EDIT: return $this->getEditPolicy(); diff --git a/src/applications/policy/capability/PhabricatorPolicyCanInteractCapability.php b/src/applications/policy/capability/PhabricatorPolicyCanInteractCapability.php new file mode 100644 index 0000000000..207fe811c5 --- /dev/null +++ b/src/applications/policy/capability/PhabricatorPolicyCanInteractCapability.php @@ -0,0 +1,20 @@ + Date: Thu, 9 Mar 2017 11:05:13 -0800 Subject: [PATCH 18/24] Use text ellipsis on hovercard tags Summary: Fixes T12326. Users can make really log tag titles, this forces ellipsis if it is too long. Test Plan: Write a super long tag, see ellipisis. Test a small tag, see normal layout. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12326 Differential Revision: https://secure.phabricator.com/D17486 --- resources/celerity/map.php | 4 ++-- .../rsrc/css/application/project/project-card-view.css | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 43bc338457..c97f71e939 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -96,7 +96,7 @@ return array( 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 'rsrc/css/application/policy/policy.css' => '957ea14c', 'rsrc/css/application/ponder/ponder-view.css' => 'fbd45f96', - 'rsrc/css/application/project/project-card-view.css' => '77219296', + 'rsrc/css/application/project/project-card-view.css' => 'e17bf825', 'rsrc/css/application/project/project-view.css' => '792c9057', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', @@ -905,7 +905,7 @@ return array( 'policy-edit-css' => '815c66f7', 'policy-transaction-detail-css' => '82100a43', 'ponder-view-css' => 'fbd45f96', - 'project-card-view-css' => '77219296', + 'project-card-view-css' => 'e17bf825', 'project-view-css' => '792c9057', 'releeph-core' => '9b3c5733', 'releeph-preview-branch' => 'b7a6f4a5', diff --git a/webroot/rsrc/css/application/project/project-card-view.css b/webroot/rsrc/css/application/project/project-card-view.css index 0ad25c5420..53ed3aa9dc 100644 --- a/webroot/rsrc/css/application/project/project-card-view.css +++ b/webroot/rsrc/css/application/project/project-card-view.css @@ -103,6 +103,14 @@ margin-top: 8px; } +.project-card-view .phui-header-subheader .phui-tag-core { + text-overflow: ellipsis; + white-space: nowrap; + max-width: 232px; + overflow: hidden; + display: inline-block; +} + .project-card-view .phui-header-header .phui-tag-view .phui-tag-core { padding: 0; } From fa569c35d30e4c52fe497482de8f42c3fcc1e887 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 9 Mar 2017 11:30:03 -0800 Subject: [PATCH 19/24] Add award and revoke conduit calls to Badges Summary: Allow people to award and remove badges via conduit, but not from the standard badges form. Test Plan: Build a generator and generate awards. Didn't test the revoke yet. {F3857766} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12270 Differential Revision: https://secure.phabricator.com/D17482 --- src/__phutil_library_map__.php | 2 ++ .../editor/PhabricatorBadgesEditEngine.php | 17 +++++++++ ...habricatorBadgesAwardTestDataGenerator.php | 36 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 455dee187f..544b4f2b39 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2018,6 +2018,7 @@ phutil_register_library_map(array( 'PhabricatorBadgesAward' => 'applications/badges/storage/PhabricatorBadgesAward.php', 'PhabricatorBadgesAwardController' => 'applications/badges/controller/PhabricatorBadgesAwardController.php', 'PhabricatorBadgesAwardQuery' => 'applications/badges/query/PhabricatorBadgesAwardQuery.php', + 'PhabricatorBadgesAwardTestDataGenerator' => 'applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php', 'PhabricatorBadgesBadge' => 'applications/badges/storage/PhabricatorBadgesBadge.php', 'PhabricatorBadgesBadgeAwardTransaction' => 'applications/badges/xaction/PhabricatorBadgesBadgeAwardTransaction.php', 'PhabricatorBadgesBadgeDescriptionTransaction' => 'applications/badges/xaction/PhabricatorBadgesBadgeDescriptionTransaction.php', @@ -7000,6 +7001,7 @@ phutil_register_library_map(array( ), 'PhabricatorBadgesAwardController' => 'PhabricatorBadgesController', 'PhabricatorBadgesAwardQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorBadgesAwardTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorBadgesBadge' => array( 'PhabricatorBadgesDAO', 'PhabricatorPolicyInterface', diff --git a/src/applications/badges/editor/PhabricatorBadgesEditEngine.php b/src/applications/badges/editor/PhabricatorBadgesEditEngine.php index 596e70cd13..e7a441343c 100644 --- a/src/applications/badges/editor/PhabricatorBadgesEditEngine.php +++ b/src/applications/badges/editor/PhabricatorBadgesEditEngine.php @@ -124,6 +124,23 @@ final class PhabricatorBadgesEditEngine ->setTransactionType( PhabricatorBadgesBadgeDescriptionTransaction::TRANSACTIONTYPE) ->setValue($object->getDescription()), + id(new PhabricatorUsersEditField()) + ->setKey('award') + ->setIsConduitOnly(true) + ->setDescription(pht('New badge award recipients.')) + ->setConduitTypeDescription(pht('New badge award recipients.')) + ->setTransactionType( + PhabricatorBadgesBadgeAwardTransaction::TRANSACTIONTYPE) + ->setLabel(pht('Award Recipients')), + id(new PhabricatorUsersEditField()) + ->setKey('revoke') + ->setIsConduitOnly(true) + ->setDescription(pht('Revoke badge award recipients.')) + ->setConduitTypeDescription(pht('Revoke badge award recipients.')) + ->setTransactionType( + PhabricatorBadgesBadgeRevokeTransaction::TRANSACTIONTYPE) + ->setLabel(pht('Revoke Recipients')), + ); } diff --git a/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php b/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php new file mode 100644 index 0000000000..ba523a9000 --- /dev/null +++ b/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php @@ -0,0 +1,36 @@ +loadRandomUser(); + $recipient = $this->loadRandomUser(); + $badge_phid = $this->loadRandomPHID(new PhabricatorBadgesBadge()); + + $xactions = array(); + + $xactions[] = array( + 'type' => 'award', + 'value' => array($recipient->getPHID()), + ); + + $params = array( + 'transactions' => $xactions, + 'objectIdentifier' => $badge_phid, + ); + + $result = id(new ConduitCall('badges.edit', $params)) + ->setUser($author) + ->execute(); + + return $result['object']['phid']; + } + +} From d73df58cc6c3e00314b44b26a072ea36169a94c9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 9 Mar 2017 11:32:35 -0800 Subject: [PATCH 20/24] Prevent use of the "quality" constraint in the Badge search API Summary: Ref T12270. This just drops the constraint for now, rather than dealing with all the typecasting stuff and putting us in a position which will almost certainly require backward compatibility breaks in the future. Also renames "badges.*" to "badge.*" for consistency (all other methods are singular: token.*, project.*, differential.revision.*, etc). Test Plan: Saw "qualities" now "Not Supported", while other constraints continue to work: {F3887194} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12270 Differential Revision: https://secure.phabricator.com/D17487 --- .../PhabricatorBadgesEditConduitAPIMethod.php | 2 +- .../PhabricatorBadgesSearchConduitAPIMethod.php | 2 +- .../PhabricatorBadgesAwardTestDataGenerator.php | 2 +- .../PhabricatorBadgesBadgeTestDataGenerator.php | 2 +- .../query/PhabricatorBadgesSearchEngine.php | 1 + .../search/field/PhabricatorSearchField.php | 15 +++++++++++++++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php b/src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php index 42be0c2ba3..2ad0c92d32 100644 --- a/src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php +++ b/src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php @@ -4,7 +4,7 @@ final class PhabricatorBadgesEditConduitAPIMethod extends PhabricatorEditEngineAPIMethod { public function getAPIMethodName() { - return 'badges.edit'; + return 'badge.edit'; } public function newEditEngine() { diff --git a/src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php b/src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php index 5d9fc9c5aa..e71ee9aa71 100644 --- a/src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php +++ b/src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php @@ -4,7 +4,7 @@ final class PhabricatorBadgesSearchConduitAPIMethod extends PhabricatorSearchEngineAPIMethod { public function getAPIMethodName() { - return 'badges.search'; + return 'badge.search'; } public function newSearchEngine() { diff --git a/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php b/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php index ba523a9000..f64a42db83 100644 --- a/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php +++ b/src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php @@ -26,7 +26,7 @@ final class PhabricatorBadgesAwardTestDataGenerator 'objectIdentifier' => $badge_phid, ); - $result = id(new ConduitCall('badges.edit', $params)) + $result = id(new ConduitCall('badge.edit', $params)) ->setUser($author) ->execute(); diff --git a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php index 8d56e20fa3..8d496c18a1 100644 --- a/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php +++ b/src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php @@ -40,7 +40,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator 'transactions' => $xactions, ); - $result = id(new ConduitCall('badges.edit', $params)) + $result = id(new ConduitCall('badge.edit', $params)) ->setUser($author) ->execute(); diff --git a/src/applications/badges/query/PhabricatorBadgesSearchEngine.php b/src/applications/badges/query/PhabricatorBadgesSearchEngine.php index 4db0cdd979..6e84c30bc9 100644 --- a/src/applications/badges/query/PhabricatorBadgesSearchEngine.php +++ b/src/applications/badges/query/PhabricatorBadgesSearchEngine.php @@ -24,6 +24,7 @@ final class PhabricatorBadgesSearchEngine id(new PhabricatorSearchCheckboxesField()) ->setKey('qualities') ->setLabel(pht('Quality')) + ->setEnableForConduit(false) ->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()), id(new PhabricatorSearchCheckboxesField()) ->setKey('statuses') diff --git a/src/applications/search/field/PhabricatorSearchField.php b/src/applications/search/field/PhabricatorSearchField.php index 099fbdcc51..1a038ec665 100644 --- a/src/applications/search/field/PhabricatorSearchField.php +++ b/src/applications/search/field/PhabricatorSearchField.php @@ -19,6 +19,8 @@ abstract class PhabricatorSearchField extends Phobject { private $description; private $isHidden; + private $enableForConduit = true; + /* -( Configuring Fields )------------------------------------------------- */ @@ -333,6 +335,10 @@ abstract class PhabricatorSearchField extends Phobject { * @task conduit */ final public function getConduitParameterType() { + if (!$this->getEnableForConduit()) { + return false; + } + $type = $this->newConduitParameterType(); if ($type) { @@ -367,6 +373,15 @@ abstract class PhabricatorSearchField extends Phobject { $this->getConduitKey()); } + final public function setEnableForConduit($enable) { + $this->enableForConduit = $enable; + return $this; + } + + final public function getEnableForConduit() { + return $this->enableForConduit; + } + /* -( Utility Methods )----------------------------------------------------- */ From 2b5bf4b911eabb32a73cdcd50ed5e3ec7c7af945 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 10 Mar 2017 14:46:51 -0800 Subject: [PATCH 21/24] Allow "bin/mail send-test" to accept raw email addresses via "--to" Summary: Ref T12372. This supports testing the `wordwrap()` patch discussed in that task. Test Plan: - Ran `bin/mail send-test --to email@domain.com` - Ran `bin/mail send-test --to username` Reviewers: chad, lvital Reviewed By: lvital Maniphest Tasks: T12372 Differential Revision: https://secure.phabricator.com/D17489 --- ...abricatorMailManagementSendTestWorkflow.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php index ca1af3a18b..9f4e91ca22 100644 --- a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php @@ -93,7 +93,16 @@ final class PhabricatorMailManagementSendTestWorkflow ->execute(); $users = mpull($users, null, 'getUsername'); + $raw_tos = array(); foreach ($tos as $key => $username) { + // If the recipient has an "@" in any noninitial position, treat this as + // a raw email address. + if (preg_match('/.@/', $username)) { + $raw_tos[] = $username; + unset($tos[$key]); + continue; + } + if (empty($users[$username])) { throw new PhutilArgumentUsageException( pht("No such user '%s' exists.", $username)); @@ -122,13 +131,20 @@ final class PhabricatorMailManagementSendTestWorkflow $body = file_get_contents('php://stdin'); $mail = id(new PhabricatorMetaMTAMail()) - ->addTos($tos) ->addCCs($ccs) ->setSubject($subject) ->setBody($body) ->setIsBulk($is_bulk) ->setMailTags($tags); + if ($tos) { + $mail->addTos($tos); + } + + if ($raw_tos) { + $mail->addRawTos($raw_tos); + } + if ($args->getArg('html')) { $mail->setBody( pht( From 40391d089eefb15ede652315ae275deecf90c7f5 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 10 Mar 2017 19:37:44 -0800 Subject: [PATCH 22/24] Add a sort order to the favorites menu Summary: These were once ordered, but I think we switched to being defined in the Engine and never implemented the sorts there. This adds sort ordering to Tasks, Projects, and Repositories. Test Plan: Review Favorites Menu in local install, see order is now set per the engine. Click Edit Favorites, and re-order. See order sticks. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17490 --- .../diffusion/editor/DiffusionRepositoryEditEngine.php | 4 ++++ src/applications/maniphest/editor/ManiphestEditEngine.php | 4 ++++ .../project/engine/PhabricatorProjectEditEngine.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php index 4f45357956..2459c8c559 100644 --- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php +++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php @@ -24,6 +24,10 @@ final class DiffusionRepositoryEditEngine return true; } + public function getQuickCreateOrderVector() { + return id(new PhutilSortVector())->addInt(300); + } + public function getEngineName() { return pht('Repositories'); } diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php index 0433e8200a..ad0171592c 100644 --- a/src/applications/maniphest/editor/ManiphestEditEngine.php +++ b/src/applications/maniphest/editor/ManiphestEditEngine.php @@ -25,6 +25,10 @@ final class ManiphestEditEngine return true; } + public function getQuickCreateOrderVector() { + return id(new PhutilSortVector())->addInt(100); + } + protected function newEditableObject() { return ManiphestTask::initializeNewTask($this->getViewer()); } diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php index 7a0c11be0e..286e9bab0f 100644 --- a/src/applications/project/engine/PhabricatorProjectEditEngine.php +++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php @@ -30,6 +30,10 @@ final class PhabricatorProjectEditEngine return true; } + public function getQuickCreateOrderVector() { + return id(new PhutilSortVector())->addInt(200); + } + public function getEngineName() { return pht('Projects'); } From 4457c3866b11e26c28fae35ad83523f48e0908c6 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 10 Mar 2017 09:36:35 -0800 Subject: [PATCH 23/24] Fix project hovercard tag alignment Summary: Fix tag alignment on project cards when there are multiple tags. Also fixes T12381. Test Plan: Review a project and people hovercard in sandbox, ensure multiple tags look as expected. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12381 Differential Revision: https://secure.phabricator.com/D17488 --- resources/celerity/map.php | 4 ++-- src/applications/people/view/PhabricatorUserCardView.php | 2 ++ webroot/rsrc/css/application/project/project-card-view.css | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index c97f71e939..46bc9fec6f 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -96,7 +96,7 @@ return array( 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 'rsrc/css/application/policy/policy.css' => '957ea14c', 'rsrc/css/application/ponder/ponder-view.css' => 'fbd45f96', - 'rsrc/css/application/project/project-card-view.css' => 'e17bf825', + 'rsrc/css/application/project/project-card-view.css' => '1be8c87b', 'rsrc/css/application/project/project-view.css' => '792c9057', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', @@ -905,7 +905,7 @@ return array( 'policy-edit-css' => '815c66f7', 'policy-transaction-detail-css' => '82100a43', 'ponder-view-css' => 'fbd45f96', - 'project-card-view-css' => 'e17bf825', + 'project-card-view-css' => '1be8c87b', 'project-view-css' => '792c9057', 'releeph-core' => '9b3c5733', 'releeph-preview-branch' => 'b7a6f4a5', diff --git a/src/applications/people/view/PhabricatorUserCardView.php b/src/applications/people/view/PhabricatorUserCardView.php index 4c45549b77..5b6d34b90c 100644 --- a/src/applications/people/view/PhabricatorUserCardView.php +++ b/src/applications/people/view/PhabricatorUserCardView.php @@ -31,6 +31,7 @@ final class PhabricatorUserCardView extends AphrontTagView { protected function getTagAttributes() { $classes = array(); $classes[] = 'project-card-view'; + $classes[] = 'people-card-view'; if ($this->profile->getIsDisabled()) { $classes[] = 'project-card-disabled'; @@ -120,6 +121,7 @@ final class PhabricatorUserCardView extends AphrontTagView { 'a', array( 'href' => $href, + 'class' => 'project-card-image-href', ), $image); diff --git a/webroot/rsrc/css/application/project/project-card-view.css b/webroot/rsrc/css/application/project/project-card-view.css index 53ed3aa9dc..7d1e9ce746 100644 --- a/webroot/rsrc/css/application/project/project-card-view.css +++ b/webroot/rsrc/css/application/project/project-card-view.css @@ -43,6 +43,10 @@ border-radius: 3px; } +.project-card-view .project-card-image-href { + display: inline-block; +} + .project-card-view .project-card-item div { display: inline; } @@ -103,7 +107,7 @@ margin-top: 8px; } -.project-card-view .phui-header-subheader .phui-tag-core { +.people-card-view .phui-header-subheader .phui-tag-core { text-overflow: ellipsis; white-space: nowrap; max-width: 232px; From 0cc1a5c4d5285d1b0ed34bc873edf62d69e03e5d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 11 Mar 2017 09:23:50 -0800 Subject: [PATCH 24/24] Clean up Space select/dropdown UI alignment Summary: This alignment is off on edit forms, from the new overflow rules. Let's re-align everything for forms too. Test Plan: Add 2 new spaces, go to Maniphest, edit a task, see proper alignment of [Space] [Policy] view dropdowns. Check mobile alignment and Safari/FF. {F3942187} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17491 --- resources/celerity/map.php | 10 +++++----- webroot/rsrc/css/phui/phui-button.css | 6 ++++++ webroot/rsrc/css/phui/phui-form.css | 13 ++++++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 46bc9fec6f..53295dbae9 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -9,7 +9,7 @@ return array( 'names' => array( 'conpherence.pkg.css' => '6875302f', 'conpherence.pkg.js' => '6249a1cf', - 'core.pkg.css' => '49a02d1f', + 'core.pkg.css' => '35645dec', 'core.pkg.js' => '1fa7c0c5', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', @@ -134,7 +134,7 @@ return array( 'rsrc/css/phui/phui-basic-nav-view.css' => 'a0705f53', 'rsrc/css/phui/phui-big-info-view.css' => 'bd903741', 'rsrc/css/phui/phui-box.css' => '269cbc99', - 'rsrc/css/phui/phui-button.css' => 'c55204db', + 'rsrc/css/phui/phui-button.css' => '14bfba79', 'rsrc/css/phui/phui-chart.css' => '6bf6f78e', 'rsrc/css/phui/phui-cms.css' => '504b4b23', 'rsrc/css/phui/phui-comment-form.css' => '48fbd65d', @@ -147,7 +147,7 @@ return array( 'rsrc/css/phui/phui-feed-story.css' => '44a9c8e9', 'rsrc/css/phui/phui-fontkit.css' => 'b78a0059', 'rsrc/css/phui/phui-form-view.css' => 'adca31ce', - 'rsrc/css/phui/phui-form.css' => '5815af7b', + 'rsrc/css/phui/phui-form.css' => 'b62c01d8', 'rsrc/css/phui/phui-head-thing.css' => 'fd311e5f', 'rsrc/css/phui/phui-header-view.css' => 'fef6a54e', 'rsrc/css/phui/phui-hovercard.css' => 'ae091fc5', @@ -841,7 +841,7 @@ return array( 'phui-basic-nav-view-css' => 'a0705f53', 'phui-big-info-view-css' => 'bd903741', 'phui-box-css' => '269cbc99', - 'phui-button-css' => 'c55204db', + 'phui-button-css' => '14bfba79', 'phui-calendar-css' => '477acfaa', 'phui-calendar-day-css' => '572b1893', 'phui-calendar-list-css' => '576be600', @@ -858,7 +858,7 @@ return array( 'phui-feed-story-css' => '44a9c8e9', 'phui-font-icon-base-css' => '870a7360', 'phui-fontkit-css' => 'b78a0059', - 'phui-form-css' => '5815af7b', + 'phui-form-css' => 'b62c01d8', 'phui-form-view-css' => 'adca31ce', 'phui-head-thing-view-css' => 'fd311e5f', 'phui-header-view-css' => 'fef6a54e', diff --git a/webroot/rsrc/css/phui/phui-button.css b/webroot/rsrc/css/phui/phui-button.css index eca5a6254c..21bf741225 100644 --- a/webroot/rsrc/css/phui/phui-button.css +++ b/webroot/rsrc/css/phui/phui-button.css @@ -242,6 +242,12 @@ a.policy-control .phui-button-text { display: block; } +.device-phone a.button.policy-control { + display: block; + float: none; + width: auto; +} + .caret { display: inline-block; width: 0; diff --git a/webroot/rsrc/css/phui/phui-form.css b/webroot/rsrc/css/phui/phui-form.css index bfe5111018..810ad32c2c 100644 --- a/webroot/rsrc/css/phui/phui-form.css +++ b/webroot/rsrc/css/phui/phui-form.css @@ -157,9 +157,20 @@ textarea[disabled], } .aphront-space-select-control-knob { - margin: 2px 8px 2px 0; + margin: 0 8px 0 0; + float: left; +} + +.aphront-form-control-policy .policy-control { + float: left; + margin-right: 8px; } .device .aphront-space-select-control-knob { margin-bottom: 8px; + float: none; +} + +.device .aphront-form-control-policy .policy-control { + margin: 0; }