Add "Flags" to allow users to collect the things they love
Summary: Flags are a personal collection of things you want to take a look at later. You can use several different colors and add notes. Not really sure if this is actually a good idea or not but it was easy to build. Planned features: - Allow Herald rules to add flags. - In the "edit flag" dialog, have a "[x] Subscribe Me" checkbox that CCs you. - Support Diffusion. - Support Phriction. - Always show flags on an object if you have them (in every view)? - Edit dialog feels a little heavy? - More filtering in /flag/ tool. - Add a top-level links somewhere? Test Plan: Added, edited and removed flags from things. Viewed flags in flag view. Reviewers: aran, btrahan Reviewed By: btrahan CC: aran, epriestley, Koolvin Maniphest Tasks: T1041 Differential Revision: https://secure.phabricator.com/D2024
This commit is contained in:
@@ -358,7 +358,8 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
}
|
||||
|
||||
private function getRevisionActions(DifferentialRevision $revision) {
|
||||
$viewer_phid = $this->getRequest()->getUser()->getPHID();
|
||||
$user = $this->getRequest()->getUser();
|
||||
$viewer_phid = $user->getPHID();
|
||||
$viewer_is_owner = ($revision->getAuthorPHID() == $viewer_phid);
|
||||
$viewer_is_reviewer = in_array($viewer_phid, $revision->getReviewers());
|
||||
$viewer_is_cc = in_array($viewer_phid, $revision->getCCPHIDs());
|
||||
@@ -378,6 +379,28 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
}
|
||||
|
||||
if (!$viewer_is_anonymous) {
|
||||
|
||||
require_celerity_resource('phabricator-flag-css');
|
||||
|
||||
$flag = PhabricatorFlagQuery::loadUserFlag($user, $revision_phid);
|
||||
if ($flag) {
|
||||
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
|
||||
$color = PhabricatorFlagColor::getColorName($flag->getColor());
|
||||
$links[] = array(
|
||||
'class' => 'flag-clear '.$class,
|
||||
'href' => '/flag/delete/'.$flag->getID().'/',
|
||||
'name' => phutil_escape_html('Remove '.$color.' Flag'),
|
||||
'sigil' => 'workflow',
|
||||
);
|
||||
} else {
|
||||
$links[] = array(
|
||||
'class' => 'flag-add phabricator-flag-ghost',
|
||||
'href' => '/flag/edit/'.$revision_phid.'/',
|
||||
'name' => 'Flag Revision',
|
||||
'sigil' => 'workflow',
|
||||
);
|
||||
}
|
||||
|
||||
if (!$viewer_is_owner && !$viewer_is_reviewer) {
|
||||
$action = $viewer_is_cc ? 'rem' : 'add';
|
||||
$links[] = array(
|
||||
|
||||
@@ -28,6 +28,8 @@ phutil_require_module('phabricator', 'applications/differential/view/revisioncom
|
||||
phutil_require_module('phabricator', 'applications/differential/view/revisiondetail');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
|
||||
phutil_require_module('phabricator', 'applications/draft/storage/draft');
|
||||
phutil_require_module('phabricator', 'applications/flag/constants/color');
|
||||
phutil_require_module('phabricator', 'applications/flag/query/flag');
|
||||
phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
|
||||
Reference in New Issue
Block a user