From eb3d69cc66c02f4fb99969eb69e4a9914b9061d1 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Wed, 10 Sep 2025 15:08:01 +0200 Subject: [PATCH] Files: Do not show "Available Transforms" when none are supported Summary: Showing "Available Transforms" for files which cannot have transforms is useless and slightly misleading until you spot the "Supported" table column. Instead just do not list transforms which are not supported for this file type. Closes T16260 Test Plan: * Upload an iamge file, a movie file, a text file. * Go to their corresponding file page and select "View Transforms". * Look at the "Available Transforms" table before and after applying this patch. Reviewers: O1 Blessed Committers, mainframe98, valerio.bozzolan Reviewed By: O1 Blessed Committers, mainframe98, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T16260 Differential Revision: https://we.phorge.it/D26336 --- ...PhabricatorFileTransformListController.php | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/applications/files/controller/PhabricatorFileTransformListController.php b/src/applications/files/controller/PhabricatorFileTransformListController.php index 7b5bc9299d..adb39d5aa0 100644 --- a/src/applications/files/controller/PhabricatorFileTransformListController.php +++ b/src/applications/files/controller/PhabricatorFileTransformListController.php @@ -57,7 +57,6 @@ final class PhabricatorFileTransformListController $dst_phid = idx($xsrc, $xform->getTransformKey()); if ($xform->canApplyTransform($file)) { - $can_apply = pht('Yes'); $view_href = $file->getURIForTransform($xform); $view_href = new PhutilURI($view_href); @@ -72,32 +71,29 @@ final class PhabricatorFileTransformListController 'href' => $view_href, ), $view_text); - } else { - $can_apply = phutil_tag('em', array(), pht('No')); - $view_link = phutil_tag('em', array(), pht('None')); - } - if ($dst_phid) { - $dst_link = $viewer->renderHandle($dst_phid); - } else { - $dst_link = phutil_tag('em', array(), pht('None')); + if ($dst_phid) { + $dst_link = $viewer->renderHandle($dst_phid); + } else { + $dst_link = phutil_tag('em', array(), pht('None')); + } + + $src_rows[] = array( + $xform->getTransformName(), + $xform->getTransformKey(), + $dst_link, + $view_link, + ); } - - $src_rows[] = array( - $xform->getTransformName(), - $xform->getTransformKey(), - $can_apply, - $dst_link, - $view_link, - ); } $src_table = id(new AphrontTableView($src_rows)) + ->setNoDataString( + pht('No supported transforms are available for this file format.')) ->setHeaders( array( pht('Name'), pht('Key'), - pht('Supported'), pht('Transform'), pht('View'), )) @@ -106,7 +102,6 @@ final class PhabricatorFileTransformListController 'wide', '', '', - '', 'action', )); -- 2.51.2