mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Conpherence - add edit control for rooms
Summary: Fixes T7582. Basically if its a room we should be able to change title + policy and if its a thread just the title. T7582 had ideas to do a dropdown but "view in column" doesn't make sense from conpherence afaik - what would the page you'd end up with the column be? (maybe home?) Anyway, that is iteration we can add laters Test Plan: edited room metadata successfully from main and column view. edtied thread title from main and column view. Reviewers: epriestley, chad Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7582 Differential Revision: https://secure.phabricator.com/D12252
This commit is contained in:
parent
2b3d3cf7e4
commit
7e0c516276
2 changed files with 52 additions and 13 deletions
|
@ -120,26 +120,29 @@ final class ConpherenceUpdateController
|
||||||
->setContent($result);
|
->setContent($result);
|
||||||
break;
|
break;
|
||||||
case ConpherenceUpdateActions::METADATA:
|
case ConpherenceUpdateActions::METADATA:
|
||||||
$updated = false;
|
|
||||||
// all metadata updates are continue requests
|
// all metadata updates are continue requests
|
||||||
if (!$request->isContinueRequest()) {
|
if (!$request->isContinueRequest()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = $request->getStr('title');
|
$title = $request->getStr('title');
|
||||||
if ($title != $conpherence->getTitle()) {
|
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
|
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
|
||||||
->setNewValue($title);
|
->setNewValue($title);
|
||||||
$updated = true;
|
if ($conpherence->getIsRoom()) {
|
||||||
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
||||||
|
->setNewValue($request->getStr('viewPolicy'));
|
||||||
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
|
||||||
|
->setNewValue($request->getStr('editPolicy'));
|
||||||
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
|
||||||
|
->setNewValue($request->getStr('joinPolicy'));
|
||||||
|
}
|
||||||
if (!$request->getExists('force_ajax')) {
|
if (!$request->getExists('force_ajax')) {
|
||||||
$response_mode = 'redirect';
|
$response_mode = 'redirect';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!$updated) {
|
|
||||||
$errors[] = pht(
|
|
||||||
'That was a non-update. Try cancel.');
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ConpherenceUpdateActions::LOAD:
|
case ConpherenceUpdateActions::LOAD:
|
||||||
$updated = false;
|
$updated = false;
|
||||||
|
@ -164,6 +167,11 @@ final class ConpherenceUpdateController
|
||||||
->setCancelURI($this->getApplicationURI($conpherence_id.'/'))
|
->setCancelURI($this->getApplicationURI($conpherence_id.'/'))
|
||||||
->setException($ex);
|
->setException($ex);
|
||||||
}
|
}
|
||||||
|
// xactions had no effect...!
|
||||||
|
if (empty($xactions)) {
|
||||||
|
$errors[] = pht(
|
||||||
|
'That was a non-update. Try cancel.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($xactions || ($action == ConpherenceUpdateActions::LOAD)) {
|
if ($xactions || ($action == ConpherenceUpdateActions::LOAD)) {
|
||||||
|
@ -293,6 +301,8 @@ final class ConpherenceUpdateController
|
||||||
$error_view) {
|
$error_view) {
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
$form = id(new PHUIFormLayoutView())
|
$form = id(new PHUIFormLayoutView())
|
||||||
->appendChild($error_view)
|
->appendChild($error_view)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
|
@ -301,9 +311,38 @@ final class ConpherenceUpdateController
|
||||||
->setName('title')
|
->setName('title')
|
||||||
->setValue($conpherence->getTitle()));
|
->setValue($conpherence->getTitle()));
|
||||||
|
|
||||||
|
if ($conpherence->getIsRoom()) {
|
||||||
|
$title = pht('Update Room');
|
||||||
|
$policies = id(new PhabricatorPolicyQuery())
|
||||||
|
->setViewer($user)
|
||||||
|
->setObject($conpherence)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$form->appendChild(
|
||||||
|
id(new AphrontFormPolicyControl())
|
||||||
|
->setName('viewPolicy')
|
||||||
|
->setPolicyObject($conpherence)
|
||||||
|
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
|
||||||
|
->setPolicies($policies))
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormPolicyControl())
|
||||||
|
->setName('editPolicy')
|
||||||
|
->setPolicyObject($conpherence)
|
||||||
|
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
|
||||||
|
->setPolicies($policies))
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormPolicyControl())
|
||||||
|
->setName('joinPolicy')
|
||||||
|
->setPolicyObject($conpherence)
|
||||||
|
->setCapability(PhabricatorPolicyCapability::CAN_JOIN)
|
||||||
|
->setPolicies($policies));
|
||||||
|
} else {
|
||||||
|
$title = pht('Update Thread');
|
||||||
|
}
|
||||||
|
|
||||||
require_celerity_resource('conpherence-update-css');
|
require_celerity_resource('conpherence-update-css');
|
||||||
$view = id(new AphrontDialogView())
|
$view = id(new AphrontDialogView())
|
||||||
->setTitle(pht('Update Conpherence'))
|
->setTitle($title)
|
||||||
->addHiddenInput('action', 'metadata')
|
->addHiddenInput('action', 'metadata')
|
||||||
->addHiddenInput(
|
->addHiddenInput(
|
||||||
'latest_transaction_id',
|
'latest_transaction_id',
|
||||||
|
|
|
@ -381,7 +381,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
|
||||||
|
|
||||||
private function getHeaderActionsConfig(ConpherenceThread $conpherence) {
|
private function getHeaderActionsConfig(ConpherenceThread $conpherence) {
|
||||||
if ($conpherence->getIsRoom()) {
|
if ($conpherence->getIsRoom()) {
|
||||||
$rename_label = pht('Rename Room');
|
$rename_label = pht('Edit Room');
|
||||||
} else {
|
} else {
|
||||||
$rename_label = pht('Rename Thread');
|
$rename_label = pht('Rename Thread');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue