1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 05:42:40 +01:00

Merge branch 'master' into redesign-2015

This commit is contained in:
epriestley 2015-07-01 15:07:16 -07:00
commit 10ba64e892
9 changed files with 21 additions and 139 deletions

View file

@ -1889,7 +1889,6 @@ phutil_register_library_map(array(
'PhabricatorFeedListController' => 'applications/feed/controller/PhabricatorFeedListController.php', 'PhabricatorFeedListController' => 'applications/feed/controller/PhabricatorFeedListController.php',
'PhabricatorFeedManagementRepublishWorkflow' => 'applications/feed/management/PhabricatorFeedManagementRepublishWorkflow.php', 'PhabricatorFeedManagementRepublishWorkflow' => 'applications/feed/management/PhabricatorFeedManagementRepublishWorkflow.php',
'PhabricatorFeedManagementWorkflow' => 'applications/feed/management/PhabricatorFeedManagementWorkflow.php', 'PhabricatorFeedManagementWorkflow' => 'applications/feed/management/PhabricatorFeedManagementWorkflow.php',
'PhabricatorFeedPublicStreamController' => 'applications/feed/controller/PhabricatorFeedPublicStreamController.php',
'PhabricatorFeedQuery' => 'applications/feed/query/PhabricatorFeedQuery.php', 'PhabricatorFeedQuery' => 'applications/feed/query/PhabricatorFeedQuery.php',
'PhabricatorFeedSearchEngine' => 'applications/feed/query/PhabricatorFeedSearchEngine.php', 'PhabricatorFeedSearchEngine' => 'applications/feed/query/PhabricatorFeedSearchEngine.php',
'PhabricatorFeedStory' => 'applications/feed/story/PhabricatorFeedStory.php', 'PhabricatorFeedStory' => 'applications/feed/story/PhabricatorFeedStory.php',
@ -5527,7 +5526,6 @@ phutil_register_library_map(array(
'PhabricatorFeedListController' => 'PhabricatorFeedController', 'PhabricatorFeedListController' => 'PhabricatorFeedController',
'PhabricatorFeedManagementRepublishWorkflow' => 'PhabricatorFeedManagementWorkflow', 'PhabricatorFeedManagementRepublishWorkflow' => 'PhabricatorFeedManagementWorkflow',
'PhabricatorFeedManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorFeedManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorFeedPublicStreamController' => 'PhabricatorFeedController',
'PhabricatorFeedQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorFeedQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorFeedSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorFeedSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorFeedStory' => array( 'PhabricatorFeedStory' => array(

View file

@ -81,14 +81,14 @@ final class PhabricatorCalendarEventCancelController
if ($is_cancelled) { if ($is_cancelled) {
if ($sequence || $is_parent_cancelled) { if ($sequence || $is_parent_cancelled) {
$title = pht('Cannot Reinstate Instance'); $title = pht('Cannot Reinstate Instance');
$paragraph = pht('Cannot reinstate an instance of a $paragraph = pht('Cannot reinstate an instance of a ' .
cancelled recurring event.'); 'cancelled recurring event.');
$cancel = pht('Cancel'); $cancel = pht('Cancel');
$submit = null; $submit = null;
} else if ($is_parent) { } else if ($is_parent) {
$title = pht('Reinstate Recurrence'); $title = pht('Reinstate Recurrence');
$paragraph = pht('Reinstate the entire series $paragraph = pht('Reinstate the entire series ' .
of recurring events?'); 'of recurring events?');
$cancel = pht('Don\'t Reinstate Recurrence'); $cancel = pht('Don\'t Reinstate Recurrence');
$submit = pht('Reinstate Recurrence'); $submit = pht('Reinstate Recurrence');
} else { } else {
@ -100,20 +100,20 @@ final class PhabricatorCalendarEventCancelController
} else { } else {
if ($sequence) { if ($sequence) {
$title = pht('Cancel Instance'); $title = pht('Cancel Instance');
$paragraph = pht('Cancel just this instance $paragraph = pht('Cancel just this instance ' .
of a recurring event.'); 'of a recurring event.');
$cancel = pht('Don\'t Cancel Instance'); $cancel = pht('Don\'t Cancel Instance');
$submit = pht('Cancel Instance'); $submit = pht('Cancel Instance');
} else if ($is_parent) { } else if ($is_parent) {
$title = pht('Cancel Recurrence'); $title = pht('Cancel Recurrence');
$paragraph = pht('Cancel the entire series $paragraph = pht('Cancel the entire series ' .
of recurring events?'); 'of recurring events?');
$cancel = pht('Don\'t Cancel Recurrence'); $cancel = pht('Don\'t Cancel Recurrence');
$submit = pht('Cancel Recurrence'); $submit = pht('Cancel Recurrence');
} else { } else {
$title = pht('Cancel Event'); $title = pht('Cancel Event');
$paragraph = pht('You can always reinstate $paragraph = pht('You can always reinstate ' .
the event later.'); 'the event later.');
$cancel = pht('Don\'t Cancel Event'); $cancel = pht('Don\'t Cancel Event');
$submit = pht('Cancel Event'); $submit = pht('Cancel Event');
} }

View file

@ -238,7 +238,7 @@ final class PhabricatorCalendarEventTransaction
} else if ($count_added > 0 && $count_uninvited > 0) { } else if ($count_added > 0 && $count_uninvited > 0) {
$added_text = $this->renderHandleList($added); $added_text = $this->renderHandleList($added);
$uninvited_text = $this->renderHandleList($uninvited); $uninvited_text = $this->renderHandleList($uninvited);
$text = pht('%s invited %s and uninvited: %s', $text = pht('%s invited %s and uninvited %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$added_text, $added_text,
$uninvited_text); $uninvited_text);
@ -303,7 +303,7 @@ final class PhabricatorCalendarEventTransaction
case self::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created %s', '%s created %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} else { } else {
@ -445,7 +445,7 @@ final class PhabricatorCalendarEventTransaction
} else if ($count_added > 0 && $count_uninvited > 0) { } else if ($count_added > 0 && $count_uninvited > 0) {
$added_text = $this->renderHandleList($added); $added_text = $this->renderHandleList($added);
$uninvited_text = $this->renderHandleList($uninvited); $uninvited_text = $this->renderHandleList($uninvited);
$text = pht('%s invited %s and uninvited %s to %s', $text = pht('%s invited %s and uninvited %s to %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$added_text, $added_text,
$uninvited_text, $uninvited_text,

View file

@ -274,6 +274,8 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'security.allow-conduit-act-as-user' => pht( 'security.allow-conduit-act-as-user' => pht(
'Impersonating users over the API is no longer supported.'), 'Impersonating users over the API is no longer supported.'),
'feed.public' => pht('The framable public feed is no longer supported.'),
); );
return $ancient_config; return $ancient_config;

View file

@ -25,7 +25,6 @@ final class PhabricatorFeedApplication extends PhabricatorApplication {
public function getRoutes() { public function getRoutes() {
return array( return array(
'/feed/' => array( '/feed/' => array(
'public/' => 'PhabricatorFeedPublicStreamController',
'(?P<id>\d+)/' => 'PhabricatorFeedDetailController', '(?P<id>\d+)/' => 'PhabricatorFeedDetailController',
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorFeedListController', '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorFeedListController',
), ),

View file

@ -4,7 +4,6 @@ final class PhabricatorFeedBuilder extends Phobject {
private $user; private $user;
private $stories; private $stories;
private $framed;
private $hovercards = false; private $hovercards = false;
private $noDataString; private $noDataString;
@ -13,11 +12,6 @@ final class PhabricatorFeedBuilder extends Phobject {
$this->stories = $stories; $this->stories = $stories;
} }
public function setFramed($framed) {
$this->framed = $framed;
return $this;
}
public function setUser(PhabricatorUser $user) { public function setUser(PhabricatorUser $user) {
$this->user = $user; $this->user = $user;
return $this; return $this;
@ -47,7 +41,6 @@ final class PhabricatorFeedBuilder extends Phobject {
$last_date = null; $last_date = null;
foreach ($stories as $story) { foreach ($stories as $story) {
$story->setFramed($this->framed);
$story->setHovercard($this->hovercards); $story->setHovercard($this->hovercards);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));

View file

@ -21,24 +21,6 @@ final class PhabricatorFeedConfigOptions
public function getOptions() { public function getOptions() {
return array( return array(
$this->newOption('feed.public', 'bool', false)
->setLocked(true)
->setBoolOptions(
array(
pht('Allow anyone to view the feed'),
pht('Require authentication'),
))
->setSummary(pht('Should the feed be public?'))
->setDescription(
pht(
"If you set this to true, you can embed Phabricator activity ".
"feeds in other pages using iframes. These feeds are completely ".
"public, and a login is not required to view them! This is ".
"intended for things like open source projects that want to ".
"expose an activity feed on the project homepage.\n\n".
"NOTE: You must also set `%s` to true for this ".
"setting to work properly.",
'policy.allow-public')),
$this->newOption('feed.http-hooks', 'list<string>', array()) $this->newOption('feed.http-hooks', 'list<string>', array())
->setLocked(true) ->setLocked(true)
->setSummary(pht('POST notifications of feed events.')) ->setSummary(pht('POST notifications of feed events.'))

View file

@ -1,39 +0,0 @@
<?php
final class PhabricatorFeedPublicStreamController
extends PhabricatorFeedController {
public function shouldRequireLogin() {
return false;
}
public function processRequest() {
if (!PhabricatorEnv::getEnvConfig('feed.public')) {
return new Aphront404Response();
}
$request = $this->getRequest();
$viewer = PhabricatorUser::getOmnipotentUser();
$query = new PhabricatorFeedQuery();
$query->setViewer($viewer);
$query->setLimit(100);
$stories = $query->execute();
$builder = new PhabricatorFeedBuilder($stories);
$builder
->setFramed(true)
->setUser($viewer);
$view = phutil_tag_div(
'phabricator-public-feed-frame',
$builder->buildView());
return $this->buildStandardPageResponse(
$view,
array(
'title' => pht('Public Feed'),
'public' => true,
));
}
}

View file

@ -16,7 +16,6 @@ abstract class PhabricatorFeedStory
private $data; private $data;
private $hasViewed; private $hasViewed;
private $framed;
private $hovercard = false; private $hovercard = false;
private $renderingTarget = PhabricatorApplicationTransaction::TARGET_HTML; private $renderingTarget = PhabricatorApplicationTransaction::TARGET_HTML;
@ -289,11 +288,6 @@ abstract class PhabricatorFeedStory
return $this->hasViewed; return $this->hasViewed;
} }
final public function setFramed($framed) {
$this->framed = $framed;
return $this;
}
final public function setHandles(array $handles) { final public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle'); assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles; $this->handles = $handles;
@ -367,24 +361,7 @@ abstract class PhabricatorFeedStory
return $handle->getLinkName(); return $handle->getLinkName();
} }
// NOTE: We render our own link here to customize the styling and add return $handle->renderLink();
// the '_top' target for framed feeds.
$class = null;
if ($handle->getType() == PhabricatorPeopleUserPHIDType::TYPECONST) {
$class = 'phui-link-person';
}
return javelin_tag(
'a',
array(
'href' => $handle->getURI(),
'target' => $this->framed ? '_top' : null,
'sigil' => $this->hovercard ? 'hovercard' : null,
'meta' => $this->hovercard ? array('hoverPHID' => $phid) : null,
'class' => $class,
),
$handle->getLinkName());
} }
final protected function renderString($str) { final protected function renderString($str) {
@ -462,16 +439,10 @@ abstract class PhabricatorFeedStory
* @task policy * @task policy
*/ */
public function getPolicy($capability) { public function getPolicy($capability) {
$policy_object = $this->getPrimaryPolicyObject(); // NOTE: We enforce that a user can see all the objects a story is about
if ($policy_object) { // when loading it, so we don't need to perform a equivalent secondary
return $policy_object->getPolicy($capability); // policy check later.
} return PhabricatorPolicies::getMostOpenPolicy();
// TODO: Remove this once all objects are policy-aware. For now, keep
// respecting the `feed.public` setting.
return PhabricatorEnv::getEnvConfig('feed.public')
? PhabricatorPolicies::POLICY_PUBLIC
: PhabricatorPolicies::POLICY_USER;
} }
@ -479,39 +450,15 @@ abstract class PhabricatorFeedStory
* @task policy * @task policy
*/ */
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
$policy_object = $this->getPrimaryPolicyObject();
if ($policy_object) {
return $policy_object->hasAutomaticCapability($capability, $viewer);
}
return false; return false;
} }
public function describeAutomaticCapability($capability) { public function describeAutomaticCapability($capability) {
return null; return null;
} }
/**
* Get the policy object this story is about, if such a policy object
* exists.
*
* @return PhabricatorPolicyInterface|null Policy object, if available.
* @task policy
*/
private function getPrimaryPolicyObject() {
$primary_phid = $this->getPrimaryObjectPHID();
if (empty($this->objects[$primary_phid])) {
$object = $this->objects[$primary_phid];
if ($object instanceof PhabricatorPolicyInterface) {
return $object;
}
}
return null;
}
/* -( PhabricatorMarkupInterface Implementation )--------------------------- */ /* -( PhabricatorMarkupInterface Implementation )--------------------------- */