Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15404991
D17338.id41697.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Referenced Files
None
Subscribers
None
D17338.id41697.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2466,7 +2466,6 @@
'PhabricatorDashboardArchiveController' => 'applications/dashboard/controller/PhabricatorDashboardArchiveController.php',
'PhabricatorDashboardArrangeController' => 'applications/dashboard/controller/PhabricatorDashboardArrangeController.php',
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
- 'PhabricatorDashboardCopyController' => 'applications/dashboard/controller/PhabricatorDashboardCopyController.php',
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php',
'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php',
@@ -2518,7 +2517,6 @@
'PhabricatorDashboardTransaction' => 'applications/dashboard/storage/PhabricatorDashboardTransaction.php',
'PhabricatorDashboardTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php',
'PhabricatorDashboardTransactionQuery' => 'applications/dashboard/query/PhabricatorDashboardTransactionQuery.php',
- 'PhabricatorDashboardUninstallController' => 'applications/dashboard/controller/PhabricatorDashboardUninstallController.php',
'PhabricatorDashboardViewController' => 'applications/dashboard/controller/PhabricatorDashboardViewController.php',
'PhabricatorDataCacheSpec' => 'applications/cache/spec/PhabricatorDataCacheSpec.php',
'PhabricatorDataNotAttachedException' => 'infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php',
@@ -7475,7 +7473,6 @@
'PhabricatorDashboardArchiveController' => 'PhabricatorDashboardController',
'PhabricatorDashboardArrangeController' => 'PhabricatorDashboardProfileController',
'PhabricatorDashboardController' => 'PhabricatorController',
- 'PhabricatorDashboardCopyController' => 'PhabricatorDashboardController',
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType',
'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType',
@@ -7538,7 +7535,6 @@
'PhabricatorDashboardTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorDashboardTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorDashboardTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
- 'PhabricatorDashboardUninstallController' => 'PhabricatorDashboardController',
'PhabricatorDashboardViewController' => 'PhabricatorDashboardProfileController',
'PhabricatorDataCacheSpec' => 'PhabricatorCacheSpec',
'PhabricatorDataNotAttachedException' => 'Exception',
diff --git a/src/applications/dashboard/application/PhabricatorDashboardApplication.php b/src/applications/dashboard/application/PhabricatorDashboardApplication.php
--- a/src/applications/dashboard/application/PhabricatorDashboardApplication.php
+++ b/src/applications/dashboard/application/PhabricatorDashboardApplication.php
@@ -29,9 +29,7 @@
'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
'arrange/(?P<id>\d+)/' => 'PhabricatorDashboardArrangeController',
'create/' => 'PhabricatorDashboardEditController',
- 'copy/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardCopyController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
- 'uninstall/(?P<id>\d+)/' => 'PhabricatorDashboardUninstallController',
'addpanel/(?P<id>\d+)/' => 'PhabricatorDashboardAddPanelController',
'movepanel/(?P<id>\d+)/' => 'PhabricatorDashboardMovePanelController',
'removepanel/(?P<id>\d+)/'
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php b/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php
@@ -34,8 +34,7 @@
$info_view = null;
if (!$can_edit) {
$no_edit = pht(
- 'You do not have permission to edit this dashboard. If you want to '.
- 'make changes, make a copy first.');
+ 'You do not have permission to edit this dashboard.');
$info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardCopyController.php b/src/applications/dashboard/controller/PhabricatorDashboardCopyController.php
deleted file mode 100644
--- a/src/applications/dashboard/controller/PhabricatorDashboardCopyController.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-final class PhabricatorDashboardCopyController
- extends PhabricatorDashboardController {
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->getViewer();
- $id = $request->getURIData('id');
-
- $dashboard = id(new PhabricatorDashboardQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->needPanels(true)
- ->executeOne();
- if (!$dashboard) {
- return new Aphront404Response();
- }
-
- $cancel_uri = $this->getApplicationURI('manage/'.$dashboard->getID().'/');
-
- if ($request->isFormPost()) {
-
- $copy = PhabricatorDashboard::initializeNewDashboard($viewer);
- $copy = PhabricatorDashboard::copyDashboard($copy, $dashboard);
-
- $copy->setName(pht('Copy of %s', $copy->getName()));
-
- // Set up all the edges for the new dashboard.
-
- $xactions = array();
- $xactions[] = id(new PhabricatorDashboardTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
- ->setMetadataValue(
- 'edge:type',
- PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST)
- ->setNewValue(
- array(
- '=' => array_fuse($dashboard->getPanelPHIDs()),
- ));
-
- $editor = id(new PhabricatorDashboardTransactionEditor())
- ->setActor($viewer)
- ->setContentSourceFromRequest($request)
- ->setContinueOnMissingFields(true)
- ->setContinueOnNoEffect(true)
- ->applyTransactions($copy, $xactions);
-
- $cancel_uri = $this->getApplicationURI('edit/'.$copy->getID().'/');
- return id(new AphrontRedirectResponse())->setURI($cancel_uri);
- }
-
- return $this->newDialog()
- ->setTitle(pht('Copy Dashboard'))
- ->appendParagraph(
- pht(
- 'Create a copy of the dashboard "%s"?',
- phutil_tag('strong', array(), $dashboard->getName())))
- ->addCancelButton($cancel_uri)
- ->addSubmitButton(pht('Create Copy'));
- }
-
-}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
@@ -47,8 +47,7 @@
$info_view = null;
if (!$can_edit) {
$no_edit = pht(
- 'You do not have permission to edit this dashboard. If you want to '.
- 'make changes, make a copy first.');
+ 'You do not have permission to edit this dashboard.');
$info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
@@ -110,13 +109,6 @@
->setWorkflow($can_edit));
}
- $curtain->addAction(
- id(new PhabricatorActionView())
- ->setName(pht('Copy Dashboard'))
- ->setIcon('fa-files-o')
- ->setHref($this->getApplicationURI("copy/{$id}/"))
- ->setWorkflow(true));
-
return $curtain;
}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
@@ -52,25 +52,6 @@
return new Aphront404Response();
}
- if ($dashboard) {
- $can_edit = PhabricatorPolicyFilter::hasCapability(
- $viewer,
- $panel,
- PhabricatorPolicyCapability::CAN_EDIT);
- if (!$can_edit) {
- if ($request->isFormPost() && $request->getBool('copy')) {
- $panel = $this->copyPanel(
- $request,
- $dashboard,
- $panel);
- } else {
- return $this->processPanelCloneRequest(
- $request,
- $dashboard,
- $panel);
- }
- }
- }
} else {
$is_create = true;
@@ -365,79 +346,5 @@
->appendChild($view);
}
- private function processPanelCloneRequest(
- AphrontRequest $request,
- PhabricatorDashboard $dashboard,
- PhabricatorDashboardPanel $panel) {
-
- $viewer = $request->getUser();
-
- $manage_uri = $this->getApplicationURI('arrange/'.$dashboard->getID().'/');
-
- return $this->newDialog()
- ->setTitle(pht('Copy Panel?'))
- ->addHiddenInput('copy', true)
- ->addHiddenInput('dashboardID', $request->getInt('dashboardID'))
- ->addHiddenInput('column', $request->getInt('column'))
- ->appendParagraph(
- pht(
- 'You do not have permission to edit this dashboard panel, but you '.
- 'can make a copy and edit that instead. If you choose to copy the '.
- 'panel, the original will be replaced with the new copy on this '.
- 'dashboard.'))
- ->appendParagraph(
- pht(
- 'Do you want to make a copy of this panel?'))
- ->addCancelButton($manage_uri)
- ->addSubmitButton(pht('Copy Panel'));
- }
-
- private function copyPanel(
- AphrontRequest $request,
- PhabricatorDashboard $dashboard,
- PhabricatorDashboardPanel $panel) {
-
- $viewer = $request->getUser();
-
- $copy = PhabricatorDashboardPanel::initializeNewPanel($viewer);
- $copy = PhabricatorDashboardPanel::copyPanel($copy, $panel, $viewer);
-
- $copy->openTransaction();
- $copy->save();
-
- // TODO: This should record a transaction on the panel copy, too.
-
- $xactions = array();
- $xactions[] = id(new PhabricatorDashboardTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
- ->setMetadataValue(
- 'edge:type',
- PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST)
- ->setNewValue(
- array(
- '+' => array(
- $copy->getPHID() => $copy->getPHID(),
- ),
- '-' => array(
- $panel->getPHID() => $panel->getPHID(),
- ),
- ));
-
- $layout_config = $dashboard->getLayoutConfigObject();
- $layout_config->replacePanel($panel->getPHID(), $copy->getPHID());
- $dashboard->setLayoutConfigFromObject($layout_config);
- $dashboard->save();
-
- $editor = id(new PhabricatorDashboardTransactionEditor())
- ->setActor($viewer)
- ->setContentSourceFromRequest($request)
- ->setContinueOnMissingFields(true)
- ->setContinueOnNoEffect(true)
- ->applyTransactions($dashboard, $xactions);
- $copy->saveTransaction();
-
- return $copy;
- }
-
}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardUninstallController.php b/src/applications/dashboard/controller/PhabricatorDashboardUninstallController.php
deleted file mode 100644
--- a/src/applications/dashboard/controller/PhabricatorDashboardUninstallController.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-
-final class PhabricatorDashboardUninstallController
- extends PhabricatorDashboardController {
-
- public function handleRequest(AphrontRequest $request) {
- $viewer = $request->getViewer();
- $id = $request->getURIData('id');
-
- $dashboard = id(new PhabricatorDashboardQuery())
- ->setViewer($viewer)
- ->withIDs(array($id))
- ->executeOne();
- if (!$dashboard) {
- return new Aphront404Response();
- }
- $dashboard_phid = $dashboard->getPHID();
-
- $object_phid = $request->getStr('objectPHID', $viewer->getPHID());
- $object = id(new PhabricatorObjectQuery())
- ->setViewer($viewer)
- ->requireCapabilities(
- array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- ))
- ->withPHIDs(array($object_phid))
- ->executeOne();
- if (!$object) {
- return new Aphront404Response();
- }
-
- $application_class = $request->getStr(
- 'applicationClass',
- 'PhabricatorHomeApplication');
-
- $dashboard_install = id(new PhabricatorDashboardInstall())
- ->loadOneWhere(
- 'objectPHID = %s AND applicationClass = %s',
- $object_phid,
- $application_class);
- if (!$dashboard_install) {
- return new Aphront404Response();
- }
- if ($dashboard_install->getDashboardPHID() != $dashboard_phid) {
- return new Aphront404Response();
- }
-
- $installer_phid = $viewer->getPHID();
-
- if ($request->isFormPost()) {
- $dashboard_install->delete();
- return id(new AphrontRedirectResponse())
- ->setURI($this->getRedirectURI($application_class, $object_phid));
- }
-
- $body = $this->getBodyContent(
- $application_class,
- $object_phid,
- $installer_phid);
-
- $form = id(new AphrontFormView())
- ->setUser($viewer)
- ->appendChild($body);
-
- return $this->newDialog()
- ->setTitle(pht('Uninstall Dashboard'))
- ->appendChild($form->buildLayoutView())
- ->addCancelButton($this->getCancelURI(
- $application_class, $object_phid, $id))
- ->addSubmitButton(pht('Uninstall Dashboard'));
- }
-
- private function getBodyContent(
- $application_class,
- $object_phid,
- $installer_phid) {
-
- $viewer = $this->getViewer();
-
- $body = array();
- switch ($application_class) {
- case 'PhabricatorHomeApplication':
- if ($installer_phid == $object_phid) {
- $body[] = phutil_tag(
- 'p',
- array(),
- pht(
- 'Are you sure you want to uninstall this dashboard as your '.
- 'home page?'));
- $body[] = phutil_tag(
- 'p',
- array(),
- pht(
- 'You will be re-directed to your bland, default home page if '.
- 'you choose to uninstall this dashboard.'));
- } else {
- $body[] = phutil_tag(
- 'p',
- array(),
- pht(
- 'Are you sure you want to uninstall this dashboard as the home '.
- 'page for %s?',
- $viewer->renderHandle($object_phid)));
- }
- break;
- }
- return $body;
- }
-
- private function getCancelURI($application_class, $object_phid, $id) {
- $uri = null;
- switch ($application_class) {
- case 'PhabricatorHomeApplication':
- $uri = '/dashboard/view/'.$id.'/';
- break;
- }
- return $uri;
- }
-
- private function getRedirectURI($application_class, $object_phid) {
- $uri = null;
- switch ($application_class) {
- case 'PhabricatorHomeApplication':
- $uri = '/';
- break;
- }
- return $uri;
- }
-
-}
diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php
--- a/src/applications/dashboard/storage/PhabricatorDashboard.php
+++ b/src/applications/dashboard/storage/PhabricatorDashboard.php
@@ -47,16 +47,6 @@
);
}
- public static function copyDashboard(
- PhabricatorDashboard $dst,
- PhabricatorDashboard $src) {
-
- $dst->name = $src->name;
- $dst->layoutConfig = $src->layoutConfig;
-
- return $dst;
- }
-
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php
--- a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php
+++ b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php
@@ -31,19 +31,6 @@
->setEditPolicy($actor->getPHID());
}
- public static function copyPanel(
- PhabricatorDashboardPanel $dst,
- PhabricatorDashboardPanel $src,
- PhabricatorUser $user) {
-
- $dst->name = $src->name;
- $dst->panelType = $src->panelType;
- $dst->properties = $src->properties;
- $dst->authorPHID = $user->getPHID();
-
- return $dst;
- }
-
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 9:55 AM (5 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7710938
Default Alt Text
D17338.id41697.diff (16 KB)
Attached To
Mode
D17338: Remove Copy Dashboard
Attached
Detach File
Event Timeline
Log In to Comment