Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/feed/story/base/PhabricatorFeedStory.php b/src/applications/feed/story/base/PhabricatorFeedStory.php
index a6828d16c5..7cdb665dee 100644
--- a/src/applications/feed/story/base/PhabricatorFeedStory.php
+++ b/src/applications/feed/story/base/PhabricatorFeedStory.php
@@ -1,66 +1,80 @@
<?php
/*
* Copyright 2011 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;
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 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();
}
}
diff --git a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
index a5a45a52e4..91265a9d9c 100644
--- a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
+++ b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
@@ -1,94 +1,103 @@
<?php
/*
* Copyright 2011 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(
- $this->getStoryData()->getAuthorPHID(),
- $data->getValue('taskPHID'),
- $data->getValue('ownerPHID'),
- );
+ 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();
- $handles = $this->getHandles();
$author_phid = $data->getAuthorPHID();
$owner_phid = $data->getValue('ownerPHID');
$task_phid = $data->getValue('taskPHID');
$objects = $this->getObjects();
$action = $data->getValue('action');
$view = new PhabricatorFeedStoryView();
$verb = ManiphestAction::getActionPastTenseVerb($action);
- $title =
- '<strong>'.$handles[$author_phid]->renderLink().'</strong>'.
- " {$verb} task ".
- '<strong>'.$handles[$task_phid]->renderLink().'</strong>';
+ $extra = null;
switch ($action) {
case ManiphestAction::ACTION_ASSIGN:
- $title .=
- ' to '.
- '<strong>'.$handles[$owner_phid]->renderLink().'</strong>';
+ if ($owner_phid) {
+ $extra =
+ ' to '.
+ '<strong>'.$this->getHandle($owner_phid)->renderLink().'</strong>';
+ } else {
+ $verb = 'placed';
+ $extra = ' up for grabs';
+ }
break;
}
+
+ $title =
+ '<strong>'.$this->getHandle($author_phid)->renderLink().'</strong>'.
+ " {$verb} task ".
+ '<strong>'.$this->getHandle($task_phid)->renderLink().'</strong>';
+ $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($objects[$author_phid])) {
$image_phid = $objects[$author_phid]->getProfileImagePHID();
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
$view->setImage($image_uri);
}
$content = phutil_escape_html(
phutil_utf8_shorten($data->getValue('description'), 128));
$content = str_replace("\n", '<br />', $content);
$view->appendChild($content);
} else {
$view->setOneLineStory(true);
}
return $view;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jun 9, 11:06 PM (7 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140159
Default Alt Text
(5 KB)

Event Timeline