Page MenuHomePhabricator

D8266.diff
No OneTemporary

D8266.diff

Index: resources/celerity/map.php
===================================================================
--- resources/celerity/map.php
+++ resources/celerity/map.php
@@ -344,7 +344,7 @@
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '845731b8',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '69bb5094',
- 'rsrc/js/application/conpherence/behavior-menu.js' => '872bc8ff',
+ 'rsrc/js/application/conpherence/behavior-menu.js' => '7ff0b011',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '53f6f2dd',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'd8ef8659',
'rsrc/js/application/countdown/timer.js' => '8454ce4f',
@@ -531,7 +531,7 @@
'javelin-behavior-audit-preview' => 'be81801d',
'javelin-behavior-balanced-payment-form' => '3b3e1664',
'javelin-behavior-config-reorder-fields' => '69bb5094',
- 'javelin-behavior-conpherence-menu' => '872bc8ff',
+ 'javelin-behavior-conpherence-menu' => '7ff0b011',
'javelin-behavior-conpherence-pontificate' => '53f6f2dd',
'javelin-behavior-conpherence-widget-pane' => 'd8ef8659',
'javelin-behavior-countdown-timer' => '8454ce4f',
@@ -1291,6 +1291,18 @@
0 => 'javelin-behavior',
1 => 'javelin-history',
),
+ '7ff0b011' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-dom',
+ 2 => 'javelin-util',
+ 3 => 'javelin-stratcom',
+ 4 => 'javelin-workflow',
+ 5 => 'javelin-behavior-device',
+ 6 => 'javelin-history',
+ 7 => 'javelin-vector',
+ 8 => 'phabricator-shaped-request',
+ ),
'828a2eed' =>
array(
0 => 'javelin-behavior',
@@ -1348,17 +1360,6 @@
1 => 'javelin-dom',
2 => 'javelin-stratcom',
),
- '872bc8ff' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- 2 => 'javelin-util',
- 3 => 'javelin-stratcom',
- 4 => 'javelin-workflow',
- 5 => 'javelin-behavior-device',
- 6 => 'javelin-history',
- 7 => 'javelin-vector',
- ),
'89889fe7' =>
array(
0 => 'javelin-install',
Index: src/applications/conpherence/constants/ConpherenceUpdateActions.php
===================================================================
--- src/applications/conpherence/constants/ConpherenceUpdateActions.php
+++ src/applications/conpherence/constants/ConpherenceUpdateActions.php
@@ -4,6 +4,7 @@
const METADATA = 'metadata';
const MESSAGE = 'message';
+ const DRAFT = 'draft';
const ADD_PERSON = 'add_person';
const REMOVE_PERSON = 'remove_person';
const NOTIFICATIONS = 'notifications';
Index: src/applications/conpherence/controller/ConpherenceUpdateController.php
===================================================================
--- src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group conpherence
- */
final class ConpherenceUpdateController
extends ConpherenceController {
@@ -39,6 +36,7 @@
$error_view = null;
$e_file = array();
$errors = array();
+ $delete_draft = false;
if ($request->isFormPost()) {
$editor = id(new ConpherenceEditor())
->setContinueOnNoEffect($request->isContinueRequest())
@@ -46,11 +44,19 @@
->setActor($user);
switch ($action) {
+ case ConpherenceUpdateActions::DRAFT:
+ $draft = PhabricatorDraft::newFromUserAndKey(
+ $user,
+ $conpherence->getPHID());
+ $draft->setDraft($request->getStr('text'));
+ $draft->replaceOrDelete();
+ break;
case ConpherenceUpdateActions::MESSAGE:
$message = $request->getStr('text');
$xactions = $editor->generateTransactionsFromText(
$conpherence,
$message);
+ $delete_draft = true;
break;
case ConpherenceUpdateActions::ADD_PERSON:
$xactions = array();
@@ -116,6 +122,12 @@
if ($xactions) {
try {
$xactions = $editor->applyTransactions($conpherence, $xactions);
+ if ($delete_draft) {
+ $draft = PhabricatorDraft::newFromUserAndKey(
+ $user,
+ $conpherence->getPHID());
+ $draft->delete();
+ }
} catch (PhabricatorApplicationTransactionNoEffectException $ex) {
return id(new PhabricatorApplicationTransactionNoEffectResponse())
->setCancelURI($this->getApplicationURI($conpherence_id.'/'))
Index: src/applications/conpherence/controller/ConpherenceViewController.php
===================================================================
--- src/applications/conpherence/controller/ConpherenceViewController.php
+++ src/applications/conpherence/controller/ConpherenceViewController.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group conpherence
- */
final class ConpherenceViewController extends
ConpherenceController {
@@ -130,9 +127,12 @@
$conpherence = $this->getConpherence();
$user = $this->getRequest()->getUser();
+ $draft = PhabricatorDraft::newFromUserAndKey(
+ $user,
+ $conpherence->getPHID());
$update_uri = $this->getApplicationURI('update/'.$conpherence->getID().'/');
- Javelin::initBehavior('conpherence-pontificate');
+ $this->initBehavior('conpherence-pontificate');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$form =
@@ -145,7 +145,8 @@
->appendChild(
id(new PhabricatorRemarkupControl())
->setUser($user)
- ->setName('text'))
+ ->setName('text')
+ ->setValue($draft->getDraft()))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(
Index: src/applications/conpherence/view/ConpherenceLayoutView.php
===================================================================
--- src/applications/conpherence/view/ConpherenceLayoutView.php
+++ src/applications/conpherence/view/ConpherenceLayoutView.php
@@ -62,7 +62,7 @@
$selected_id = $this->thread->getPHID() . '-nav-item';
$selected_thread_id = $this->thread->getID();
}
- Javelin::initBehavior('conpherence-menu',
+ $this->initBehavior('conpherence-menu',
array(
'baseURI' => $this->baseURI,
'layoutID' => $layout_id,
@@ -74,7 +74,7 @@
'hasWidgets' => false,
));
- Javelin::initBehavior(
+ $this->initBehavior(
'conpherence-widget-pane',
array(
'widgetBaseUpdateURI' => $this->baseURI . 'update/',
Index: webroot/rsrc/js/application/conpherence/behavior-menu.js
===================================================================
--- webroot/rsrc/js/application/conpherence/behavior-menu.js
+++ webroot/rsrc/js/application/conpherence/behavior-menu.js
@@ -8,6 +8,7 @@
* javelin-behavior-device
* javelin-history
* javelin-vector
+ * phabricator-shaped-request
*/
JX.behavior('conpherence-menu', function(config) {
@@ -527,4 +528,23 @@
handleThreadScrollers
);
+ var onkeydownDraft = function (e) {
+ var form = e.getNode('tag:form');
+ var uri = config.baseURI + 'update/' + _thread.selected + '/';
+ var draftRequest = new JX.PhabricatorShapedRequest(
+ uri,
+ JX.bag,
+ function () {
+ var data = JX.DOM.convertFormToDictionary(form);
+ data.action = 'draft';
+ return data;
+ });
+ draftRequest.start();
+ };
+
+ JX.Stratcom.listen(
+ ['keydown'],
+ 'conpherence-pontificate',
+ onkeydownDraft);
+
});

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 12:42 AM (2 h, 58 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6787537
Default Alt Text
D8266.diff (7 KB)

Event Timeline