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:
@@ -170,17 +170,36 @@ final class PhrictionListController
|
||||
case PhrictionChangeType::CHANGE_MOVE_HERE:
|
||||
case PhrictionChangeType::CHANGE_MOVE_AWAY:
|
||||
$change_ref = $content->getChangeRef();
|
||||
$ref_doc = $docs_from_refs[$change_ref];
|
||||
$ref_doc_slug = PhrictionDocument::getSlugURI(
|
||||
$ref_doc->getSlug());
|
||||
$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);
|
||||
$ref_doc = idx($docs_from_refs, $change_ref);
|
||||
if (!$ref_doc) {
|
||||
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
|
||||
$change_type = pht(
|
||||
'%s moved %s from elsewhere',
|
||||
$author,
|
||||
$document_link);
|
||||
} else {
|
||||
$change_type = pht(
|
||||
'%s moved %s to elsewhere',
|
||||
$author,
|
||||
$document_link);
|
||||
}
|
||||
} else {
|
||||
$change_type = pht('%s moved %s to %s', $author, $document_link,
|
||||
$ref_doc_link);
|
||||
$ref_doc_slug = PhrictionDocument::getSlugURI($ref_doc->getSlug());
|
||||
$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;
|
||||
default:
|
||||
@@ -200,7 +219,10 @@ final class PhrictionListController
|
||||
if ($version > 1) {
|
||||
$diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/');
|
||||
$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 {
|
||||
$item->addIcon('history-grey', pht('No diff available'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user