mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-12 07:41:04 +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;
|
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() {
|
final protected function getObjects() {
|
||||||
return $this->objects;
|
return $this->objects;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,12 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
||||||
|
|
||||||
public function getRequiredHandlePHIDs() {
|
public function getRequiredHandlePHIDs() {
|
||||||
$data = $this->getStoryData();
|
$data = $this->getStoryData();
|
||||||
return array(
|
return array_filter(
|
||||||
$this->getStoryData()->getAuthorPHID(),
|
array(
|
||||||
$data->getValue('taskPHID'),
|
$this->getStoryData()->getAuthorPHID(),
|
||||||
$data->getValue('ownerPHID'),
|
$data->getValue('taskPHID'),
|
||||||
);
|
$data->getValue('ownerPHID'),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredObjectPHIDs() {
|
public function getRequiredObjectPHIDs() {
|
||||||
|
@ -36,7 +37,6 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
||||||
public function renderView() {
|
public function renderView() {
|
||||||
$data = $this->getStoryData();
|
$data = $this->getStoryData();
|
||||||
|
|
||||||
$handles = $this->getHandles();
|
|
||||||
$author_phid = $data->getAuthorPHID();
|
$author_phid = $data->getAuthorPHID();
|
||||||
$owner_phid = $data->getValue('ownerPHID');
|
$owner_phid = $data->getValue('ownerPHID');
|
||||||
$task_phid = $data->getValue('taskPHID');
|
$task_phid = $data->getValue('taskPHID');
|
||||||
|
@ -47,18 +47,27 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
||||||
$view = new PhabricatorFeedStoryView();
|
$view = new PhabricatorFeedStoryView();
|
||||||
|
|
||||||
$verb = ManiphestAction::getActionPastTenseVerb($action);
|
$verb = ManiphestAction::getActionPastTenseVerb($action);
|
||||||
$title =
|
$extra = null;
|
||||||
'<strong>'.$handles[$author_phid]->renderLink().'</strong>'.
|
|
||||||
" {$verb} task ".
|
|
||||||
'<strong>'.$handles[$task_phid]->renderLink().'</strong>';
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case ManiphestAction::ACTION_ASSIGN:
|
case ManiphestAction::ACTION_ASSIGN:
|
||||||
$title .=
|
if ($owner_phid) {
|
||||||
' to '.
|
$extra =
|
||||||
'<strong>'.$handles[$owner_phid]->renderLink().'</strong>';
|
' to '.
|
||||||
|
'<strong>'.$this->getHandle($owner_phid)->renderLink().'</strong>';
|
||||||
|
} else {
|
||||||
|
$verb = 'placed';
|
||||||
|
$extra = ' up for grabs';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title =
|
||||||
|
'<strong>'.$this->getHandle($author_phid)->renderLink().'</strong>'.
|
||||||
|
" {$verb} task ".
|
||||||
|
'<strong>'.$this->getHandle($task_phid)->renderLink().'</strong>';
|
||||||
|
$title .= $extra;
|
||||||
$title .= '.';
|
$title .= '.';
|
||||||
|
|
||||||
$view->setTitle($title);
|
$view->setTitle($title);
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
Loading…
Reference in a new issue