mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Fix exception for anonymous viewers on dashboard query panels with user-specific data
Summary: When a viewer is not logged in and opens a public dashboard which embeds a query panel whose data requires a Current Viewer context (e.g. assigned or authored tasks, or joined projects), do not throw an exception but show an explanatory placeholder sentence (similar to already existing 'No tasks found.' or 'No documents found.' strings). ``` EXCEPTION: (Exception) Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80] EXCEPTION: (Exception) Query "joined" is unknown to application search engine "PhabricatorProjectSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80] ``` Closes T15792 Test Plan: While logged in, set up a dashboard query panel with "Search For: Maniphest Tasks" and "Query: Assigned" and add it to a public Dashboard. While logged out, access the Dashboard and see explanation message instead of `Exception: Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"!` on the dashboard. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15792 Differential Revision: https://we.phorge.it/D25598
This commit is contained in:
parent
4d12d014fd
commit
b32b84b645
2 changed files with 8 additions and 0 deletions
|
@ -1798,6 +1798,7 @@ phutil_register_library_map(array(
|
|||
'ManiphestCustomFieldStringIndex' => 'applications/maniphest/storage/ManiphestCustomFieldStringIndex.php',
|
||||
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
|
||||
'ManiphestDefaultEditCapability' => 'applications/maniphest/capability/ManiphestDefaultEditCapability.php',
|
||||
'ManiphestDefaultPriorityEditCapability' => 'applications/maniphest/capability/ManiphestDefaultPriorityEditCapability.php',
|
||||
'ManiphestDefaultViewCapability' => 'applications/maniphest/capability/ManiphestDefaultViewCapability.php',
|
||||
'ManiphestEditConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestEditConduitAPIMethod.php',
|
||||
'ManiphestEditEngine' => 'applications/maniphest/editor/ManiphestEditEngine.php',
|
||||
|
@ -8004,6 +8005,7 @@ phutil_register_library_map(array(
|
|||
'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
|
||||
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
||||
'ManiphestDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
||||
'ManiphestDefaultPriorityEditCapability' => 'PhabricatorPolicyCapability',
|
||||
'ManiphestDefaultViewCapability' => 'PhabricatorPolicyCapability',
|
||||
'ManiphestEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||
'ManiphestEditEngine' => 'PhabricatorEditEngine',
|
||||
|
|
|
@ -77,6 +77,12 @@ final class PhabricatorDashboardQueryPanelType
|
|||
}
|
||||
|
||||
if (!$saved) {
|
||||
if (!$viewer->isLoggedIn()) {
|
||||
// If user is not logged in, authored/assigned/etc queries are empty.
|
||||
return id(new PHUIObjectItemListView())
|
||||
->setUser($viewer)
|
||||
->setNoDataString(pht('You must log in to access this panel.'));
|
||||
}
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Query "%s" is unknown to application search engine "%s"!',
|
||||
|
|
Loading…
Reference in a new issue