Support Spaces transactions
Summary: Ref T8424. This adds crude integration with Paste's edit/view workflows: you can change the space a Paste appears in, see transactions, and get a policy callout. Lots of rough edges and non-obviousness but it pretty much works. Test Plan: - Created and updated Pastes. - Moved them between spaces, saw policy effects. - Read transactions. - Looked at feed. - Faked query to return no spaces, saw control and other stuff vanish. - Faked query to return no spaces, created pastes. - Tried to submit bad values and got errors. Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8424 Differential Revision: https://secure.phabricator.com/D13159
This commit is contained in:
@@ -15,7 +15,7 @@ final class PhabricatorSpacesApplication extends PhabricatorApplication {
|
||||
}
|
||||
|
||||
public function getFontIcon() {
|
||||
return 'fa-compass';
|
||||
return 'fa-th-large';
|
||||
}
|
||||
|
||||
public function getTitleGlyph() {
|
||||
|
||||
@@ -28,7 +28,10 @@ final class PhabricatorSpacesNamespacePHIDType
|
||||
|
||||
foreach ($handles as $phid => $handle) {
|
||||
$namespace = $objects[$phid];
|
||||
$monogram = $namespace->getMonogram();
|
||||
|
||||
$handle->setName($namespace->getNamespaceName());
|
||||
$handle->setURI('/'.$monogram);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
49
src/applications/spaces/view/PhabricatorSpacesControl.php
Normal file
49
src/applications/spaces/view/PhabricatorSpacesControl.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
final class PhabricatorSpacesControl extends AphrontFormControl {
|
||||
|
||||
private $object;
|
||||
|
||||
protected function shouldRender() {
|
||||
// Render this control only if some Spaces exist.
|
||||
return PhabricatorSpacesNamespaceQuery::getAllSpaces();
|
||||
}
|
||||
|
||||
public function setObject(PhabricatorSpacesInterface $object) {
|
||||
$this->object = $object;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getCustomControlClass() {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function getOptions() {
|
||||
$viewer = $this->getUser();
|
||||
$viewer_spaces = PhabricatorSpacesNamespaceQuery::getViewerSpaces($viewer);
|
||||
|
||||
$map = mpull($viewer_spaces, 'getNamespaceName', 'getPHID');
|
||||
asort($map);
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
public function renderInput() {
|
||||
$viewer = $this->getUser();
|
||||
|
||||
$this->setLabel(pht('Space'));
|
||||
|
||||
$value = $this->getValue();
|
||||
if ($value === null) {
|
||||
$value = $viewer->getDefaultSpacePHID();
|
||||
}
|
||||
|
||||
return AphrontFormSelectControl::renderSelectTag(
|
||||
$value,
|
||||
$this->getOptions(),
|
||||
array(
|
||||
'name' => $this->getName(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user