mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Improve feed robustness for Maniphest
Summary: Rendering of "up for grabs" stories is wrong and sometimes fatals. Test Plan: With @skrul.
This commit is contained in:
parent
890f0ff7fa
commit
fd848cabbd
2 changed files with 36 additions and 13 deletions
|
@ -51,6 +51,20 @@ abstract class PhabricatorFeedStory {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ 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() {
|
||||
|
@ -36,7 +37,6 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
|||
public function renderView() {
|
||||
$data = $this->getStoryData();
|
||||
|
||||
$handles = $this->getHandles();
|
||||
$author_phid = $data->getAuthorPHID();
|
||||
$owner_phid = $data->getValue('ownerPHID');
|
||||
$task_phid = $data->getValue('taskPHID');
|
||||
|
@ -47,18 +47,27 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
|||
$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) {
|
||||
|
|
Loading…
Reference in a new issue