@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 an issue where any diff which could possibly be rendered as Jupyter decided to render as Jupyter

Summary:
See PHI1468. Engine selection for diffs is currently too aggressive in trying to find a shared engine and will fall back a shared engine with a very low score, causing all ".json" files to render as Jupyter files.

Only pick an engine as a difference engine by default if it's the highest-scoring engine for the new file.

Test Plan: Viewed ".json" files and ".ipynb" files in a revision. Before, both rendered as Jupyter. Now, the former rendered as JSON and the latter rendered as Jupyter.

Differential Revision: https://secure.phabricator.com/D20850

+13 -2
+13 -2
src/applications/differential/parser/DifferentialChangesetParser.php
··· 1718 1718 $viewer, 1719 1719 $new_ref); 1720 1720 1721 - $shared_engines = array_intersect_key($old_engines, $new_engines); 1721 + $shared_engines = array_intersect_key($new_engines, $old_engines); 1722 + $default_engine = head_key($new_engines); 1722 1723 1723 1724 foreach ($shared_engines as $key => $shared_engine) { 1724 1725 if (!$shared_engine->canDiffDocuments($old_ref, $new_ref)) { ··· 1734 1735 $document_engine = null; 1735 1736 } 1736 1737 } else { 1737 - $document_engine = head($shared_engines); 1738 + // If we aren't rendering with a specific engine, only use a default 1739 + // engine if the best engine for the new file is a shared engine which 1740 + // can diff files. If we're less picky (for example, by accepting any 1741 + // shared engine) we can end up with silly behavior (like ".json" files 1742 + // rendering as Jupyter documents). 1743 + 1744 + if (isset($shared_engines[$default_engine])) { 1745 + $document_engine = $shared_engines[$default_engine]; 1746 + } else { 1747 + $document_engine = null; 1748 + } 1738 1749 } 1739 1750 1740 1751 if ($document_engine) {