Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php b/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php
index 147414f520..dbed85b61f 100644
--- a/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php
+++ b/src/applications/feed/builder/feed/PhabricatorFeedBuilder.php
@@ -1,93 +1,100 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorFeedBuilder {
private $stories;
+ private $framed;
public function __construct(array $stories) {
$this->stories = $stories;
}
+ public function setFramed($framed) {
+ $this->framed = $framed;
+ return $this;
+ }
+
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function buildView() {
if (!$this->user) {
throw new Exception('Call setUser() before buildView()!');
}
$user = $this->user;
$stories = $this->stories;
$handles = array();
$objects = array();
if ($stories) {
$handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs'));
$object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs'));
$handles = id(new PhabricatorObjectHandleData($handle_phids))
->loadHandles();
$objects = id(new PhabricatorObjectHandleData($object_phids))
->loadObjects();
}
$null_view = new AphrontNullView();
require_celerity_resource('phabricator-feed-css');
$last_date = null;
$today = phabricator_date(time(), $user);
foreach ($stories as $story) {
$story->setHandles($handles);
$story->setObjects($objects);
+ $story->setFramed($this->framed);
$date = phabricator_date($story->getEpoch(), $user);
if ($date == $today) {
$date = 'Today';
}
if ($date !== $last_date) {
if ($last_date !== null) {
$null_view->appendChild(
'<div class="phabricator-feed-story-date-separator"></div>');
}
$last_date = $date;
$null_view->appendChild(
phutil_render_tag(
'div',
array(
'class' => 'phabricator-feed-story-date',
),
phutil_escape_html($date)));
}
$view = $story->renderView();
$view->setViewer($user);
$null_view->appendChild($view);
}
return id(new AphrontNullView())->appendChild(
'<div class="phabricator-feed-frame">'.
$null_view->render().
'</div>');
}
}
diff --git a/src/applications/feed/controller/publicstream/PhabricatorFeedPublicStreamController.php b/src/applications/feed/controller/publicstream/PhabricatorFeedPublicStreamController.php
index a90fd28cf3..af5ba6b5da 100644
--- a/src/applications/feed/controller/publicstream/PhabricatorFeedPublicStreamController.php
+++ b/src/applications/feed/controller/publicstream/PhabricatorFeedPublicStreamController.php
@@ -1,52 +1,53 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorFeedPublicStreamController
extends PhabricatorFeedController {
public function shouldRequireLogin() {
return false;
}
public function processRequest() {
if (!PhabricatorEnv::getEnvConfig('feed.public')) {
return new Aphront404Response();
}
// TODO: Profile images won't render correctly for logged-out users.
$request = $this->getRequest();
$query = new PhabricatorFeedQuery();
$stories = $query->execute();
$builder = new PhabricatorFeedBuilder($stories);
$builder
+ ->setFramed(true)
->setUser($request->getUser());
$view = $builder->buildView();
return $this->buildStandardPageResponse(
$view,
array(
'title' => 'Public Feed',
'public' => true,
));
}
}
diff --git a/src/applications/feed/story/base/PhabricatorFeedStory.php b/src/applications/feed/story/base/PhabricatorFeedStory.php
index 15209925f6..630ff28537 100644
--- a/src/applications/feed/story/base/PhabricatorFeedStory.php
+++ b/src/applications/feed/story/base/PhabricatorFeedStory.php
@@ -1,88 +1,118 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
abstract class PhabricatorFeedStory {
private $data;
private $handles;
private $objects;
+ private $framed;
final public function __construct(PhabricatorFeedStoryData $data) {
$this->data = $data;
}
abstract public function renderView();
public function getRequiredHandlePHIDs() {
return array();
}
public function getRequiredObjectPHIDs() {
return array();
}
+ final public function setFramed($framed) {
+ $this->framed = $framed;
+ return $this;
+ }
+
final public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
final public function setObjects(array $objects) {
$this->objects = $objects;
return $this;
}
final protected function getHandles() {
return $this->handles;
}
final protected function getHandle($phid) {
if (isset($this->handles[$phid])) {
if ($this->handles[$phid] instanceof PhabricatorObjectHandle) {
return $this->handles[$phid];
}
}
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setName("Unloaded Object '{$phid}'");
return $handle;
}
final protected function getObjects() {
return $this->objects;
}
final protected function getStoryData() {
return $this->data;
}
final public function getEpoch() {
return $this->getStoryData()->getEpoch();
}
final protected function renderHandleList(array $phids) {
$list = array();
foreach ($phids as $phid) {
- $list[] = '<strong>'.$this->getHandle($phid)->renderLink().'</strong>';
+ $list[] = $this->linkTo($phid);
}
return implode(', ', $list);
}
+ final protected function linkTo($phid) {
+ $handle = $this->getHandle($phid);
+
+ // NOTE: We render our own link here to customize the styling and add
+ // the '_top' target for framed feeds.
+
+ return phutil_render_tag(
+ 'a',
+ array(
+ 'href' => $handle->getURI(),
+ 'target' => $this->framed ? '_top' : null,
+ ),
+ phutil_escape_html($handle->getLinkName()));
+ }
+
+ final protected function renderSummary($text, $len = 128) {
+ if ($len) {
+ $text = phutil_utf8_shorten($text, $len);
+ }
+ $text = phutil_escape_html($text);
+ $text = str_replace("\n", '<br />', $text);
+ return $text;
+ }
+
}
diff --git a/src/applications/feed/story/base/__init__.php b/src/applications/feed/story/base/__init__.php
index 7949b484f2..889bac7664 100644
--- a/src/applications/feed/story/base/__init__.php
+++ b/src/applications/feed/story/base/__init__.php
@@ -1,12 +1,15 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/phid/handle');
+phutil_require_module('phutil', 'markup');
+phutil_require_module('phutil', 'utils');
+
phutil_require_source('PhabricatorFeedStory.php');
diff --git a/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php
index 87b974b97a..dbe713d2ea 100644
--- a/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php
+++ b/src/applications/feed/story/differential/PhabricatorFeedStoryDifferential.php
@@ -1,85 +1,78 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
$data = $this->getStoryData();
return array(
$this->getStoryData()->getAuthorPHID(),
$data->getValue('revision_phid'),
$data->getValue('revision_author_phid'),
);
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
- $handles = $this->getHandles();
$author_phid = $data->getAuthorPHID();
$objects = $this->getObjects();
$view = new PhabricatorFeedStoryView();
$revision_phid = $data->getValue('revision_phid');
$action = $data->getValue('action');
$verb = DifferentialAction::getActionPastTenseVerb($action);
$view->setTitle(
- '<strong>'.$handles[$author_phid]->renderLink().'</strong>'.
- ' '.$verb.' revision '.
- '<strong>'.$handles[$revision_phid]->renderLink().'</strong>.');
+ $this->linkTo($author_phid).
+ " {$verb} revision ".
+ $this->linkTo($revision_phid).'.');
$view->setEpoch($data->getEpoch());
$action = $data->getValue('action');
switch ($action) {
case DifferentialAction::ACTION_CREATE:
case DifferentialAction::ACTION_COMMIT:
$full_size = true;
break;
default:
$full_size = false;
break;
}
if ($full_size) {
- if (!empty($handles[$author_phid])) {
- $image_uri = $handles[$author_phid]->getImageURI();
- $view->setImage($image_uri);
- }
-
- $content = phutil_escape_html($data->getValue('feedback_content'));
- $content = str_replace("\n", '<br />', $content);
-
+ $view->setImage($this->getHandle($author_phid)->getImageURI());
+ $content = $this->renderSummary($data->getValue('feedback_content'));
$view->appendChild($content);
} else {
$view->setOneLineStory(true);
}
return $view;
}
}
diff --git a/src/applications/feed/story/differential/__init__.php b/src/applications/feed/story/differential/__init__.php
index d875c8aafd..976b78b011 100644
--- a/src/applications/feed/story/differential/__init__.php
+++ b/src/applications/feed/story/differential/__init__.php
@@ -1,16 +1,14 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/differential/constants/action');
phutil_require_module('phabricator', 'applications/feed/story/base');
phutil_require_module('phabricator', 'applications/feed/view/story');
-phutil_require_module('phutil', 'markup');
-
phutil_require_source('PhabricatorFeedStoryDifferential.php');
diff --git a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
index 4961ec2116..4aaaf7d1fd 100644
--- a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
+++ b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
@@ -1,103 +1,95 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
$data = $this->getStoryData();
return array_filter(
array(
$this->getStoryData()->getAuthorPHID(),
$data->getValue('taskPHID'),
$data->getValue('ownerPHID'),
));
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
$author_phid = $data->getAuthorPHID();
$owner_phid = $data->getValue('ownerPHID');
$task_phid = $data->getValue('taskPHID');
$objects = $this->getObjects();
- $handles = $this->getHandles();
$action = $data->getValue('action');
$view = new PhabricatorFeedStoryView();
$verb = ManiphestAction::getActionPastTenseVerb($action);
$extra = null;
switch ($action) {
case ManiphestAction::ACTION_ASSIGN:
if ($owner_phid) {
$extra =
' to '.
- '<strong>'.$this->getHandle($owner_phid)->renderLink().'</strong>';
+ $this->linkTo($owner_phid);
} else {
$verb = 'placed';
$extra = ' up for grabs';
}
break;
}
$title =
- '<strong>'.$this->getHandle($author_phid)->renderLink().'</strong>'.
+ $this->linkTo($author_phid).
" {$verb} task ".
- '<strong>'.$this->getHandle($task_phid)->renderLink().'</strong>';
+ $this->linkTo($task_phid);
$title .= $extra;
$title .= '.';
$view->setTitle($title);
switch ($action) {
case ManiphestAction::ACTION_CREATE:
$full_size = true;
break;
default:
$full_size = false;
break;
}
$view->setEpoch($data->getEpoch());
if ($full_size) {
- if (!empty($handles[$author_phid])) {
- $image_uri = $handles[$author_phid]->getImageURI();
- $view->setImage($image_uri);
- }
-
- $content = phutil_escape_html(
- phutil_utf8_shorten($data->getValue('description'), 128));
- $content = str_replace("\n", '<br />', $content);
-
+ $view->setImage($this->getHandle($author_phid)->getImageURI());
+ $content = $this->renderSummary($data->getValue('description'));
$view->appendChild($content);
} else {
$view->setOneLineStory(true);
}
return $view;
}
}
diff --git a/src/applications/feed/story/maniphest/__init__.php b/src/applications/feed/story/maniphest/__init__.php
index e7e720c831..395a992f3c 100644
--- a/src/applications/feed/story/maniphest/__init__.php
+++ b/src/applications/feed/story/maniphest/__init__.php
@@ -1,17 +1,14 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/feed/story/base');
phutil_require_module('phabricator', 'applications/feed/view/story');
phutil_require_module('phabricator', 'applications/maniphest/constants/action');
-phutil_require_module('phutil', 'markup');
-phutil_require_module('phutil', 'utils');
-
phutil_require_source('PhabricatorFeedStoryManiphest.php');
diff --git a/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php b/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php
index c55b8ccabb..35867a0d9a 100644
--- a/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php
+++ b/src/applications/feed/story/phriction/PhabricatorFeedStoryPhriction.php
@@ -1,81 +1,74 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
$this->getStoryData()->getValue('phid'),
);
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
- $handles = $this->getHandles();
$author_phid = $data->getAuthorPHID();
$document_phid = $data->getValue('phid');
$objects = $this->getObjects();
$view = new PhabricatorFeedStoryView();
$action = $data->getValue('action');
$verb = PhrictionActionConstants::getActionPastTenseVerb($action);
$view->setTitle(
- '<strong>'.$handles[$author_phid]->renderLink().'</strong>'.
- ' '.$verb.' the document '.
- '<strong>'.$handles[$document_phid]->renderLink().'</strong>.');
+ $this->linkTo($author_phid).
+ " {$verb} the document ".
+ $this->linkTo($document_phid).'.');
$view->setEpoch($data->getEpoch());
$action = $data->getValue('action');
switch ($action) {
case PhrictionActionConstants::ACTION_CREATE:
$full_size = true;
break;
default:
$full_size = false;
break;
}
if ($full_size) {
- if (!empty($handles[$author_phid])) {
- $image_uri = $handles[$author_phid]->getImageURI();
- $view->setImage($image_uri);
- }
-
- $content = phutil_escape_html($data->getValue('content'));
- $content = str_replace("\n", '<br />', $content);
-
+ $view->setImage($this->getHandle($author_phid)->getImageURI());
+ $content = $this->renderSummary($data->getValue('content'));
$view->appendChild($content);
} else {
$view->setOneLineStory(true);
}
return $view;
}
}
diff --git a/src/applications/feed/story/phriction/__init__.php b/src/applications/feed/story/phriction/__init__.php
index a78d7ce3ec..1a1549a37c 100644
--- a/src/applications/feed/story/phriction/__init__.php
+++ b/src/applications/feed/story/phriction/__init__.php
@@ -1,16 +1,14 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/feed/story/base');
phutil_require_module('phabricator', 'applications/feed/view/story');
phutil_require_module('phabricator', 'applications/phriction/constants/action');
-phutil_require_module('phutil', 'markup');
-
phutil_require_source('PhabricatorFeedStoryPhriction.php');
diff --git a/src/applications/feed/story/project/PhabricatorFeedStoryProject.php b/src/applications/feed/story/project/PhabricatorFeedStoryProject.php
index e8fb85e661..82ee6718e0 100644
--- a/src/applications/feed/story/project/PhabricatorFeedStoryProject.php
+++ b/src/applications/feed/story/project/PhabricatorFeedStoryProject.php
@@ -1,98 +1,97 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryProject extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
$this->getStoryData()->getValue('projectPHID'),
);
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
$view = new PhabricatorFeedStoryView();
$type = $data->getValue('type');
$old = $data->getValue('old');
$new = $data->getValue('new');
- $proj = $this->getHandle($data->getValue('projectPHID'));
+ $proj_phid = $data->getValue('projectPHID');
$author_phid = $data->getAuthorPHID();
- $author = $this->getHandle($author_phid);
switch ($type) {
case PhabricatorProjectTransactionType::TYPE_NAME:
if (strlen($old)) {
$action = 'renamed project '.
- '<strong>'.$proj->renderLink().'</strong>'.
+ $this->linkTo($proj_phid).
' from '.
'<strong>'.phutil_escape_html($old).'</strong>'.
' to '.
'<strong>'.phutil_escape_html($new).'</strong>.';
} else {
$action = 'created project '.
- '<strong>'.$proj->renderLink().'</strong>'.
+ $this->linkTo($proj_phid).
' (as '.
'<strong>'.phutil_escape_html($new).'</strong>).';
}
break;
case PhabricatorProjectTransactionType::TYPE_MEMBERS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
if ((count($add) == 1) && (count($rem) == 0) &&
(head($add) == $author_phid)) {
- $action = 'joined project <strong>'.$proj->renderLink().'</strong>.';
+ $action = 'joined project '.$this->linkTo($proj_phid).'.';
} else if ((count($add) == 0) && (count($rem) == 1) &&
(head($rem) == $author_phid)) {
- $action = 'left project <strong>'.$proj->renderLink().'</strong>.';
+ $action = 'left project '.$this->linkTo($proj_phid).'.';
} else if (empty($rem)) {
$action = 'added members to project '.
- '<strong>'.$proj->renderLink().'</strong>: '.
+ $this->linkTo($proj_phid).': '.
$this->renderHandleList($add).'.';
} else if (empty($add)) {
$action = 'removed members from project '.
- '<strong>'.$proj->renderLink().'</strong>: '.
+ $this->linkTo($proj_phid).': '.
$this->renderHandleList($rem).'.';
} else {
$action = 'changed members of project '.
- '<strong>'.$proj->renderLink().'</strong>, added: '.
+ $this->linkTo($proj_phid).', added: '.
$this->renderHandleList($add).'; removed: '.
$this->renderHandleList($rem).'.';
}
break;
default:
- $action = 'updated project <strong>'.$proj->renderLink().'</strong>.';
+ $action = 'updated project '.$this->linkTo($proj_phid).'.';
break;
}
- $view->setTitle('<strong>'.$author->renderLink().'</strong> '.$action);
+ $view->setTitle($this->linkTo($author_phid).' '.$action);
$view->setOneLineStory(true);
return $view;
}
}
diff --git a/src/applications/feed/story/status/PhabricatorFeedStoryStatus.php b/src/applications/feed/story/status/PhabricatorFeedStoryStatus.php
index 5051106402..4550b653dc 100644
--- a/src/applications/feed/story/status/PhabricatorFeedStoryStatus.php
+++ b/src/applications/feed/story/status/PhabricatorFeedStoryStatus.php
@@ -1,61 +1,50 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorFeedStoryStatus extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
- $handles = $this->getHandles();
$author_phid = $data->getAuthorPHID();
- $objects = $this->getObjects();
-
$view = new PhabricatorFeedStoryView();
- $view->setTitle(
- '<strong>'.$handles[$author_phid]->renderLink().'</strong>');
+ $view->setTitle($this->linkTo($author_phid));
$view->setEpoch($data->getEpoch());
+ $view->setImage($this->getHandle($author_phid)->getImageURI());
- if (!empty($handles[$author_phid])) {
- $image_uri = $handles[$author_phid]->getImageURI();
- $view->setImage($image_uri);
- }
-
- $content = phutil_escape_html($data->getValue('content'));
- $content = str_replace("\n", '<br />', $content);
-
+ $content = $this->renderSummary($data->getValue('content'), $len = null);
$view->appendChild($content);
-
return $view;
}
}
diff --git a/src/applications/feed/story/status/__init__.php b/src/applications/feed/story/status/__init__.php
index 56ccbac488..6963c98bf8 100644
--- a/src/applications/feed/story/status/__init__.php
+++ b/src/applications/feed/story/status/__init__.php
@@ -1,15 +1,13 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/feed/story/base');
phutil_require_module('phabricator', 'applications/feed/view/story');
-phutil_require_module('phutil', 'markup');
-
phutil_require_source('PhabricatorFeedStoryStatus.php');
diff --git a/src/applications/phid/handle/PhabricatorObjectHandle.php b/src/applications/phid/handle/PhabricatorObjectHandle.php
index 6ef910501a..08dd34d347 100644
--- a/src/applications/phid/handle/PhabricatorObjectHandle.php
+++ b/src/applications/phid/handle/PhabricatorObjectHandle.php
@@ -1,226 +1,229 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorObjectHandle {
private $uri;
private $phid;
private $type;
private $name;
private $email;
private $fullName;
private $imageURI;
private $timestamp;
private $alternateID;
private $status = 'open';
private $complete;
private $disabled;
public function setURI($uri) {
$this->uri = $uri;
return $this;
}
public function getURI() {
return $this->uri;
}
public function setPHID($phid) {
$this->phid = $phid;
return $this;
}
public function getPHID() {
return $this->phid;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setStatus($status) {
$this->status = $status;
return $this;
}
public function getStatus() {
return $this->status;
}
public function setFullName($full_name) {
$this->fullName = $full_name;
return $this;
}
public function getFullName() {
if ($this->fullName !== null) {
return $this->fullName;
}
return $this->getName();
}
public function setType($type) {
$this->type = $type;
return $this;
}
public function getType() {
return $this->type;
}
public function setEmail($email) {
$this->email = $email;
return $this;
}
public function getEmail() {
return $this->email;
}
public function setImageURI($uri) {
$this->imageURI = $uri;
return $this;
}
public function getImageURI() {
return $this->imageURI;
}
public function setTimestamp($timestamp) {
$this->timestamp = $timestamp;
return $this;
}
public function getTimestamp() {
return $this->timestamp;
}
public function setAlternateID($alternate_id) {
$this->alternateID = $alternate_id;
return $this;
}
public function getAlternateID() {
return $this->alternateID;
}
public function getTypeName() {
static $map = array(
PhabricatorPHIDConstants::PHID_TYPE_USER => 'User',
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Task',
PhabricatorPHIDConstants::PHID_TYPE_DREV => 'Revision',
PhabricatorPHIDConstants::PHID_TYPE_CMIT => 'Commit',
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction',
);
return idx($map, $this->getType());
}
/**
* Set whether or not the underlying object is complete. See
* @{method:getComplete} for an explanation of what it means to be complete.
*
* @param bool True if the handle represents a complete object.
* @return this
*/
public function setComplete($complete) {
$this->complete = $complete;
return $this;
}
/**
* Determine if the handle represents an object which was completely loaded
* (i.e., the underlying object exists) vs an object which could not be
* completely loaded (e.g., the type or data for the PHID could not be
* identified or located).
*
* Basically, @{class:PhabricatorObjectHandleData} gives you back a handle for
* any PHID you give it, but it gives you a complete handle only for valid
* PHIDs.
*
* @return bool True if the handle represents a complete object.
*/
public function isComplete() {
return $this->complete;
}
/**
* Set whether or not the underlying object is disabled. See
* @{method:getDisabled} for an explanation of what it means to be disabled.
*
* @param bool True if the handle represents a disabled object.
* @return this
*/
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
/**
* Determine if the handle represents an object which has been disabled --
* for example, disabled users, archived projects, etc. These objects are
* complete and exist, but should be excluded from some system interactions
* (for instance, they usually should not appear in typeaheads, and should
* not have mail/notifications delivered to or about them).
*
* @return bool True if the handle represents a disabled object.
*/
public function isDisabled() {
return $this->disabled;
}
public function renderLink() {
-
- switch ($this->getType()) {
- case PhabricatorPHIDConstants::PHID_TYPE_USER:
- $name = $this->getName();
- break;
- default:
- $name = $this->getFullName();
- }
-
+ $name = $this->getLinkName();
$class = null;
if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) {
$class .= ' handle-status-'.$this->status;
}
if ($this->disabled) {
$class .= ' handle-disabled';
}
return phutil_render_tag(
'a',
array(
'href' => $this->getURI(),
'class' => $class,
),
phutil_escape_html($name));
}
+ public function getLinkName() {
+ switch ($this->getType()) {
+ case PhabricatorPHIDConstants::PHID_TYPE_USER:
+ $name = $this->getName();
+ break;
+ default:
+ $name = $this->getFullName();
+ }
+ return $name;
+ }
+
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jul 27, 2:01 PM (1 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
185785
Default Alt Text
(33 KB)

Event Timeline