mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Remove subprojects from the Projects UI and API
Summary: These are currently useless and confusing (they have no application impact), and should be migrated to edges if we want to restore them in some form. I left the actual storage so this doesn't destroy any data, it just removes all traces of this feature from the UI. Test Plan: Looked at and edited projects. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D3183
This commit is contained in:
parent
fbf6d967ff
commit
f01c89f8de
5 changed files with 1 additions and 160 deletions
|
@ -906,7 +906,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php',
|
||||
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
||||
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
|
||||
'PhabricatorProjectSubproject' => 'applications/project/storage/PhabricatorProjectSubproject.php',
|
||||
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
|
||||
'PhabricatorProjectTransactionType' => 'applications/project/constants/PhabricatorProjectTransactionType.php',
|
||||
'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php',
|
||||
|
@ -1941,7 +1940,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
|
||||
'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController',
|
||||
'PhabricatorProjectQuery' => 'PhabricatorOffsetPagedQuery',
|
||||
'PhabricatorProjectSubproject' => 'PhabricatorProjectDAO',
|
||||
'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO',
|
||||
'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants',
|
||||
'PhabricatorProjectUpdateController' => 'PhabricatorProjectController',
|
||||
|
|
|
@ -152,10 +152,7 @@ final class PhabricatorProjectProfileController
|
|||
$blurb = phutil_escape_html($blurb);
|
||||
$blurb = str_replace("\n", '<br />', $blurb);
|
||||
|
||||
$phids = array_merge(
|
||||
array($project->getAuthorPHID()),
|
||||
$project->getSubprojectPHIDs()
|
||||
);
|
||||
$phids = array($project->getAuthorPHID());
|
||||
$phids = array_unique($phids);
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
@ -187,23 +184,6 @@ final class PhabricatorProjectProfileController
|
|||
</div>
|
||||
</div>';
|
||||
|
||||
if ($project->getSubprojectPHIDs()) {
|
||||
$table = $this->renderSubprojectTable(
|
||||
$handles,
|
||||
$project->getSubprojectPHIDs());
|
||||
$subproject_list = $table->render();
|
||||
} else {
|
||||
$subproject_list = '<p><em>No subprojects.</em></p>';
|
||||
}
|
||||
|
||||
$about .=
|
||||
'<div class="phabricator-profile-info-group">'.
|
||||
'<h1 class="phabricator-profile-info-header">Subprojects</h1>'.
|
||||
'<div class="phabricator-profile-info-pane">'.
|
||||
$subproject_list.
|
||||
'</div>'.
|
||||
'</div>';
|
||||
|
||||
return $about;
|
||||
}
|
||||
|
||||
|
@ -327,39 +307,4 @@ final class PhabricatorProjectProfileController
|
|||
return $content;
|
||||
}
|
||||
|
||||
private function renderSubprojectTable(
|
||||
array $handles,
|
||||
array $subprojects_phids) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
|
||||
$rows = array();
|
||||
foreach ($subprojects_phids as $subproject_phid) {
|
||||
$phid = $handles[$subproject_phid]->getPHID();
|
||||
|
||||
$rows[] = array(
|
||||
phutil_escape_html($handles[$phid]->getFullName()),
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'small grey button',
|
||||
'href' => $handles[$phid]->getURI(),
|
||||
),
|
||||
'View Project Profile'),
|
||||
);
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'Name',
|
||||
'',
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
'pri',
|
||||
'action right',
|
||||
));
|
||||
|
||||
return $table;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,15 +39,6 @@ final class PhabricatorProjectProfileEditController
|
|||
|
||||
$img_src = $profile->loadProfileImageURI();
|
||||
|
||||
if ($project->getSubprojectPHIDs()) {
|
||||
$phids = $project->getSubprojectPHIDs();
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
$subprojects = mpull($handles, 'getFullName', 'getPHID');
|
||||
} else {
|
||||
$subprojects = array();
|
||||
}
|
||||
|
||||
$options = PhabricatorProjectStatus::getStatusMap();
|
||||
|
||||
$affiliations = $project->loadAffiliations();
|
||||
|
@ -84,7 +75,6 @@ final class PhabricatorProjectProfileEditController
|
|||
$errors[] = $ex->getMessage();
|
||||
}
|
||||
|
||||
$project->setSubprojectPHIDs($request->getArr('set_subprojects'));
|
||||
$profile->setBlurb($request->getStr('blurb'));
|
||||
|
||||
if (!strlen($project->getName())) {
|
||||
|
@ -249,12 +239,6 @@ final class PhabricatorProjectProfileEditController
|
|||
->setLabel('Blurb')
|
||||
->setName('blurb')
|
||||
->setValue($profile->getBlurb()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource('/typeahead/common/projects/')
|
||||
->setLabel('Subprojects')
|
||||
->setName('set_subprojects')
|
||||
->setValue($subprojects))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel('Profile Image')
|
||||
|
|
|
@ -25,7 +25,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO {
|
|||
protected $subprojectPHIDs = array();
|
||||
protected $phrictionSlug;
|
||||
|
||||
private $subprojectsNeedUpdate;
|
||||
private $affiliations;
|
||||
|
||||
public function getConfiguration() {
|
||||
|
@ -42,12 +41,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO {
|
|||
PhabricatorPHIDConstants::PHID_TYPE_PROJ);
|
||||
}
|
||||
|
||||
public function setSubprojectPHIDs(array $phids) {
|
||||
$this->subprojectPHIDs = $phids;
|
||||
$this->subprojectsNeedUpdate = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function loadProfile() {
|
||||
$profile = id(new PhabricatorProjectProfile())->loadOneWhere(
|
||||
'projectPHID = %s',
|
||||
|
@ -95,17 +88,4 @@ final class PhabricatorProject extends PhabricatorProjectDAO {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$result = parent::save();
|
||||
|
||||
if ($this->subprojectsNeedUpdate) {
|
||||
// If we've changed the project PHIDs for this task, update the link
|
||||
// table.
|
||||
PhabricatorProjectSubproject::updateProjectSubproject($this);
|
||||
$this->subprojectsNeedUpdate = false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a DAO for the Project -> subproject table, which
|
||||
* denormalizes the relationship between projects and subprojects into
|
||||
* a link table so it can be efficiently queried. This table is not
|
||||
* authoritative; the subprojectPHIDs field of PhabricatorProject is.
|
||||
* The rows in this table are regenerated when subprojects of a project
|
||||
* are updated.
|
||||
*/
|
||||
final class PhabricatorProjectSubproject extends PhabricatorProjectDAO {
|
||||
|
||||
protected $projectPHID;
|
||||
protected $subprojectPHID;
|
||||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_IDS => self::IDS_MANUAL,
|
||||
self::CONFIG_TIMESTAMPS => false,
|
||||
);
|
||||
}
|
||||
|
||||
public static function updateProjectSubproject(PhabricatorProject $project) {
|
||||
$dao = new PhabricatorProjectSubproject();
|
||||
$conn = $dao->establishConnection('w');
|
||||
|
||||
$sql = array();
|
||||
foreach ($project->getSubprojectPHIDs() as $subproject_phid) {
|
||||
$sql[] = qsprintf(
|
||||
$conn,
|
||||
'(%s, %s)',
|
||||
$project->getPHID(),
|
||||
$subproject_phid);
|
||||
}
|
||||
|
||||
queryfx(
|
||||
$conn,
|
||||
'DELETE FROM %T WHERE projectPHID = %s',
|
||||
$dao->getTableName(),
|
||||
$project->getPHID());
|
||||
if ($sql) {
|
||||
queryfx(
|
||||
$conn,
|
||||
'INSERT INTO %T (projectPHID, subprojectPHID) VALUES %Q',
|
||||
$dao->getTableName(),
|
||||
implode(', ', $sql));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue