1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Fix two issues with Phriction "recent updates" list

Summary:
First, I broke the addIcon() call recently with bad greps.

Second, a user is reporting an issue on GitHub (https://github.com/facebook/phabricator/issues/346) which I can't reproduce but which could reasonably occur for various reasons. Don't depend on being able to find the source/target of a move.

Test Plan: Looked at recent updates in Phriction.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, seungrye

Differential Revision: https://secure.phabricator.com/D6389
This commit is contained in:
epriestley 2013-07-09 16:22:58 -07:00
parent 1888a84b7e
commit 7ef2eac29f

View file

@ -170,17 +170,36 @@ final class PhrictionListController
case PhrictionChangeType::CHANGE_MOVE_HERE: case PhrictionChangeType::CHANGE_MOVE_HERE:
case PhrictionChangeType::CHANGE_MOVE_AWAY: case PhrictionChangeType::CHANGE_MOVE_AWAY:
$change_ref = $content->getChangeRef(); $change_ref = $content->getChangeRef();
$ref_doc = $docs_from_refs[$change_ref]; $ref_doc = idx($docs_from_refs, $change_ref);
$ref_doc_slug = PhrictionDocument::getSlugURI( if (!$ref_doc) {
$ref_doc->getSlug()); if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
$ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug); $change_type = pht(
'%s moved %s from elsewhere',
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) { $author,
$change_type = pht('%s moved %s from %s', $author, $document_link, $document_link);
$ref_doc_link); } else {
$change_type = pht(
'%s moved %s to elsewhere',
$author,
$document_link);
}
} else { } else {
$change_type = pht('%s moved %s to %s', $author, $document_link, $ref_doc_slug = PhrictionDocument::getSlugURI($ref_doc->getSlug());
$ref_doc_link); $ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug);
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
$change_type = pht(
'%s moved %s from %s',
$author,
$document_link,
$ref_doc_link);
} else {
$change_type = pht(
'%s moved %s to %s',
$author,
$document_link,
$ref_doc_link);
}
} }
break; break;
default: default:
@ -200,7 +219,10 @@ final class PhrictionListController
if ($version > 1) { if ($version > 1) {
$diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); $diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/');
$uri = $diff_uri->alter('l', $version - 1)->alter('r', $version); $uri = $diff_uri->alter('l', $version - 1)->alter('r', $version);
$item->addIcon('history', pht('View Change'), $uri); $item->addIcon('history', pht('View Change'),
array(
'href' => $uri,
));
} else { } else {
$item->addIcon('history-grey', pht('No diff available')); $item->addIcon('history-grey', pht('No diff available'));
} }