From f497b93e4311b424b24599f23c272ecb912ab5a6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Oct 2019 09:39:26 -0700 Subject: [PATCH] Fix a fatal in the "Projects" curtain extension when a project edge connects an object to a non-project Summary: Ref T13429. It's currently possible to write "TYPE_EDGE" relationships for the "object has project" edge to PHIDs which may not actually be projects. Today, this fatals. As a first step, unfatal it. T13429 discusses general improvements and greater context. Test Plan: Used "maniphest.edit" to write a "project" edge to a user PHID, viewed the task in the UI. Previously it fataled; now it renders unusually (the object is "tagged" with a user) but faithfully reflects database state. {F6957606} Maniphest Tasks: T13429 Differential Revision: https://secure.phabricator.com/D20860 --- src/__phutil_library_map__.php | 2 ++ .../project/engine/PhabricatorBoardLayoutEngine.php | 6 ++++++ .../project/interface/PhabricatorWorkboardInterface.php | 3 +++ src/applications/project/storage/PhabricatorProject.php | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/applications/project/interface/PhabricatorWorkboardInterface.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 41befc5ce3..189ecdf0bf 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5044,6 +5044,7 @@ phutil_register_library_map(array( 'PhabricatorWeekStartDaySetting' => 'applications/settings/setting/PhabricatorWeekStartDaySetting.php', 'PhabricatorWildConfigType' => 'applications/config/type/PhabricatorWildConfigType.php', 'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php', + 'PhabricatorWorkboardInterface' => 'applications/project/interface/PhabricatorWorkboardInterface.php', 'PhabricatorWorkboardViewState' => 'applications/project/state/PhabricatorWorkboardViewState.php', 'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php', 'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php', @@ -10748,6 +10749,7 @@ phutil_register_library_map(array( 'PhabricatorColumnProxyInterface', 'PhabricatorSpacesInterface', 'PhabricatorEditEngineSubtypeInterface', + 'PhabricatorWorkboardInterface', ), 'PhabricatorProjectActivityChartEngine' => 'PhabricatorChartEngine', 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', diff --git a/src/applications/project/engine/PhabricatorBoardLayoutEngine.php b/src/applications/project/engine/PhabricatorBoardLayoutEngine.php index 22aaed2d4b..a0be7e5775 100644 --- a/src/applications/project/engine/PhabricatorBoardLayoutEngine.php +++ b/src/applications/project/engine/PhabricatorBoardLayoutEngine.php @@ -301,6 +301,12 @@ final class PhabricatorBoardLayoutEngine extends Phobject { ->execute(); $boards = mpull($boards, null, 'getPHID'); + foreach ($boards as $key => $board) { + if (!($board instanceof PhabricatorWorkboardInterface)) { + unset($boards[$key]); + } + } + if (!$this->fetchAllBoards) { foreach ($boards as $key => $board) { if (!$board->getHasWorkboard()) { diff --git a/src/applications/project/interface/PhabricatorWorkboardInterface.php b/src/applications/project/interface/PhabricatorWorkboardInterface.php new file mode 100644 index 0000000000..2b760b4875 --- /dev/null +++ b/src/applications/project/interface/PhabricatorWorkboardInterface.php @@ -0,0 +1,3 @@ +