1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 12:41:19 +01:00
phorge-phorge/src/applications/macro/editor/PhabricatorMacroEditEngine.php
Chad Little 0a87881e98 Fix file attach bug in Macro
Summary: This was mis-tested by only using one account, which could always see the image. External transaction moved file attachment to the modular transaction for file and audio instead.

Test Plan: Test adding audio and a macro on a pleb account, visit with normal account and see macro fine.

Reviewers: epriestley, amckinley

Reviewed By: amckinley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17836
2017-05-05 19:50:12 -07:00

88 lines
2.3 KiB
PHP

<?php
final class PhabricatorMacroEditEngine
extends PhabricatorEditEngine {
const ENGINECONST = 'macro.image';
public function getEngineName() {
return pht('Macro Image');
}
public function getSummaryHeader() {
return pht('Configure Macro Image Forms');
}
public function getSummaryText() {
return pht('Configure creation and editing of Macro images.');
}
public function getEngineApplicationClass() {
return 'PhabricatorMacroApplication';
}
protected function newEditableObject() {
$viewer = $this->getViewer();
return PhabricatorFileImageMacro::initializeNewFileImageMacro($viewer);
}
protected function newObjectQuery() {
return new PhabricatorMacroQuery();
}
protected function getObjectCreateTitleText($object) {
return pht('Create New Macro');
}
protected function getObjectEditTitleText($object) {
return pht('Edit %s', $object->getName());
}
protected function getObjectEditShortText($object) {
return $object->getName();
}
protected function getObjectCreateShortText() {
return pht('Create Macro');
}
protected function getObjectName() {
return pht('Macro');
}
protected function getObjectViewURI($object) {
return $object->getViewURI();
}
protected function getEditorURI() {
return $this->getApplication()->getApplicationURI('edit/');
}
protected function getCreateNewObjectPolicy() {
return $this->getApplication()->getPolicy(
PhabricatorMacroManageCapability::CAPABILITY);
}
protected function buildCustomEditFields($object) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setDescription(pht('Macro name.'))
->setConduitDescription(pht('Rename the macro.'))
->setConduitTypeDescription(pht('New macro name.'))
->setTransactionType(PhabricatorMacroNameTransaction::TRANSACTIONTYPE)
->setValue($object->getName()),
id(new PhabricatorFileEditField())
->setKey('filePHID')
->setLabel(pht('Image File'))
->setDescription(pht('Image file to import.'))
->setTransactionType(PhabricatorMacroFileTransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('File PHID to import.'))
->setConduitTypeDescription(pht('File PHID.')),
);
}
}