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:
parent
1888a84b7e
commit
7ef2eac29f
1 changed files with 33 additions and 11 deletions
|
@ -170,18 +170,37 @@ 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) {
|
||||||
|
$change_type = pht(
|
||||||
|
'%s moved %s from elsewhere',
|
||||||
|
$author,
|
||||||
|
$document_link);
|
||||||
|
} else {
|
||||||
|
$change_type = pht(
|
||||||
|
'%s moved %s to elsewhere',
|
||||||
|
$author,
|
||||||
|
$document_link);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ref_doc_slug = PhrictionDocument::getSlugURI($ref_doc->getSlug());
|
||||||
$ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug);
|
$ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug);
|
||||||
|
|
||||||
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
|
if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) {
|
||||||
$change_type = pht('%s moved %s from %s', $author, $document_link,
|
$change_type = pht(
|
||||||
|
'%s moved %s from %s',
|
||||||
|
$author,
|
||||||
|
$document_link,
|
||||||
$ref_doc_link);
|
$ref_doc_link);
|
||||||
} else {
|
} else {
|
||||||
$change_type = pht('%s moved %s to %s', $author, $document_link,
|
$change_type = pht(
|
||||||
|
'%s moved %s to %s',
|
||||||
|
$author,
|
||||||
|
$document_link,
|
||||||
$ref_doc_link);
|
$ref_doc_link);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception("Unknown change type!");
|
throw new Exception("Unknown change type!");
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue