@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+33 -11
+33 -11
src/applications/phriction/controller/PhrictionListController.php
··· 170 170 case PhrictionChangeType::CHANGE_MOVE_HERE: 171 171 case PhrictionChangeType::CHANGE_MOVE_AWAY: 172 172 $change_ref = $content->getChangeRef(); 173 - $ref_doc = $docs_from_refs[$change_ref]; 174 - $ref_doc_slug = PhrictionDocument::getSlugURI( 175 - $ref_doc->getSlug()); 176 - $ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug); 177 - 178 - if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) { 179 - $change_type = pht('%s moved %s from %s', $author, $document_link, 180 - $ref_doc_link); 173 + $ref_doc = idx($docs_from_refs, $change_ref); 174 + if (!$ref_doc) { 175 + if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) { 176 + $change_type = pht( 177 + '%s moved %s from elsewhere', 178 + $author, 179 + $document_link); 180 + } else { 181 + $change_type = pht( 182 + '%s moved %s to elsewhere', 183 + $author, 184 + $document_link); 185 + } 181 186 } else { 182 - $change_type = pht('%s moved %s to %s', $author, $document_link, 183 - $ref_doc_link); 187 + $ref_doc_slug = PhrictionDocument::getSlugURI($ref_doc->getSlug()); 188 + $ref_doc_link = hsprintf('<a href="%s">%1$s</a>', $ref_doc_slug); 189 + 190 + if ($change_type == PhrictionChangeType::CHANGE_MOVE_HERE) { 191 + $change_type = pht( 192 + '%s moved %s from %s', 193 + $author, 194 + $document_link, 195 + $ref_doc_link); 196 + } else { 197 + $change_type = pht( 198 + '%s moved %s to %s', 199 + $author, 200 + $document_link, 201 + $ref_doc_link); 202 + } 184 203 } 185 204 break; 186 205 default: ··· 200 219 if ($version > 1) { 201 220 $diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); 202 221 $uri = $diff_uri->alter('l', $version - 1)->alter('r', $version); 203 - $item->addIcon('history', pht('View Change'), $uri); 222 + $item->addIcon('history', pht('View Change'), 223 + array( 224 + 'href' => $uri, 225 + )); 204 226 } else { 205 227 $item->addIcon('history-grey', pht('No diff available')); 206 228 }