1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Conpherence - add draft support to column and refine sending message user workflow

Summary: Ref T7014. This diff adds draft support.

Test Plan: made many comments and they submitted nicely.

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7014

Differential Revision: https://secure.phabricator.com/D12046
This commit is contained in:
Bob Trahan 2015-03-11 15:54:07 -07:00
parent c85c07012e
commit 194a183ea6
6 changed files with 90 additions and 59 deletions

View file

@ -352,9 +352,9 @@ return array(
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b', 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '0324970d',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '016fa2e9', 'rsrc/js/application/conpherence/behavior-durable-column.js' => '8908d403',
'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952', 'rsrc/js/application/conpherence/behavior-menu.js' => 'c4151295',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '2c1cd7f5', 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '2c1cd7f5',
@ -518,7 +518,7 @@ return array(
'conpherence-menu-css' => 'c6ac5299', 'conpherence-menu-css' => 'c6ac5299',
'conpherence-message-pane-css' => '5930260a', 'conpherence-message-pane-css' => '5930260a',
'conpherence-notification-css' => '04a6e10a', 'conpherence-notification-css' => '04a6e10a',
'conpherence-thread-manager' => 'efef202b', 'conpherence-thread-manager' => '0324970d',
'conpherence-update-css' => '1099a660', 'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => '3d575438', 'conpherence-widget-pane-css' => '3d575438',
'differential-changeset-view-css' => '6a8b172a', 'differential-changeset-view-css' => '6a8b172a',
@ -558,7 +558,7 @@ return array(
'javelin-behavior-boards-dropdown' => '0ec56e1d', 'javelin-behavior-boards-dropdown' => '0ec56e1d',
'javelin-behavior-choose-control' => '6153c708', 'javelin-behavior-choose-control' => '6153c708',
'javelin-behavior-config-reorder-fields' => '14a827de', 'javelin-behavior-config-reorder-fields' => '14a827de',
'javelin-behavior-conpherence-menu' => 'e476c952', 'javelin-behavior-conpherence-menu' => 'c4151295',
'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-pontificate' => '21ba5861',
'javelin-behavior-conpherence-widget-pane' => '2c1cd7f5', 'javelin-behavior-conpherence-widget-pane' => '2c1cd7f5',
'javelin-behavior-countdown-timer' => 'e4cc26b3', 'javelin-behavior-countdown-timer' => 'e4cc26b3',
@ -585,7 +585,7 @@ return array(
'javelin-behavior-diffusion-locate-file' => '6d3e1947', 'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192', 'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781', 'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => '016fa2e9', 'javelin-behavior-durable-column' => '8908d403',
'javelin-behavior-error-log' => '6882e80a', 'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-fancy-datepicker' => 'c51ae228', 'javelin-behavior-fancy-datepicker' => 'c51ae228',
'javelin-behavior-global-drag-and-drop' => '07f199d8', 'javelin-behavior-global-drag-and-drop' => '07f199d8',
@ -834,15 +834,6 @@ return array(
'unhandled-exception-css' => '37d4f9a2', 'unhandled-exception-css' => '37d4f9a2',
), ),
'requires' => array( 'requires' => array(
'016fa2e9' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
'0286a1db' => array( '0286a1db' => array(
'javelin-dom', 'javelin-dom',
'javelin-util', 'javelin-util',
@ -854,6 +845,16 @@ return array(
'029a133d' => array( '029a133d' => array(
'aphront-dialog-view-css', 'aphront-dialog-view-css',
), ),
'0324970d' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'03d6ed07' => array( '03d6ed07' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -1504,6 +1505,15 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-vector', 'javelin-vector',
), ),
'8908d403' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'conpherence-thread-manager',
),
'8a41885b' => array( '8a41885b' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
@ -1747,6 +1757,18 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-vector', 'javelin-vector',
), ),
'c4151295' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'c51ae228' => array( 'c51ae228' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-util', 'javelin-util',
@ -1850,18 +1872,6 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-uri', 'javelin-uri',
), ),
'e476c952' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'javelin-behavior-device',
'javelin-history',
'javelin-vector',
'phabricator-shaped-request',
'conpherence-thread-manager',
),
'e4cc26b3' => array( 'e4cc26b3' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1909,16 +1919,6 @@ return array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',
), ),
'efef202b' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'f24f3253' => array( 'f24f3253' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -67,7 +67,12 @@ final class ConpherenceColumnViewController extends
$participant->markUpToDate($conpherence, $latest_transaction); $participant->markUpToDate($conpherence, $latest_transaction);
unset($write_guard); unset($write_guard);
$draft = PhabricatorDraft::newFromUserAndKey(
$user,
$conpherence->getPHID());
$durable_column $durable_column
->setDraft($draft)
->setSelectedConpherence($conpherence) ->setSelectedConpherence($conpherence)
->setConpherences($latest_conpherences); ->setConpherences($latest_conpherences);
$conpherence_id = $conpherence->getID(); $conpherence_id = $conpherence->getID();

View file

@ -2,7 +2,8 @@
final class ConpherenceDurableColumnView extends AphrontTagView { final class ConpherenceDurableColumnView extends AphrontTagView {
private $conpherences; private $conpherences = array();
private $draft;
private $selectedConpherence; private $selectedConpherence;
private $transactions; private $transactions;
private $visible; private $visible;
@ -17,6 +18,15 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
return $this->conpherences; return $this->conpherences;
} }
public function setDraft(PhabricatorDraft $draft) {
$this->draft = $draft;
return $this;
}
public function getDraft() {
return $this->draft;
}
public function setSelectedConpherence( public function setSelectedConpherence(
ConpherenceThread $conpherence = null) { ConpherenceThread $conpherence = null) {
$this->selectedConpherence = $conpherence; $this->selectedConpherence = $conpherence;
@ -343,6 +353,12 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
return null; return null;
} }
$draft = $this->getDraft();
$draft_value = null;
if ($draft) {
$draft_value = $draft->getDraft();
}
$textarea = javelin_tag( $textarea = javelin_tag(
'textarea', 'textarea',
array( array(
@ -350,7 +366,8 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
'class' => 'conpherence-durable-column-textarea', 'class' => 'conpherence-durable-column-textarea',
'sigil' => 'conpherence-durable-column-textarea', 'sigil' => 'conpherence-durable-column-textarea',
'placeholder' => pht('Send a message...'), 'placeholder' => pht('Send a message...'),
)); ),
$draft_value);
$id = $conpherence->getID(); $id = $conpherence->getID();
return phabricator_form( return phabricator_form(
$this->getUser(), $this->getUser(),

View file

@ -252,6 +252,25 @@ JX.install('ConpherenceThreadManager', {
this._didSendMessageCallback(r); this._didSendMessageCallback(r);
})); }));
this.syncWorkflow(workflow, 'finally'); this.syncWorkflow(workflow, 'finally');
},
handleDraftKeydown: function(e) {
var form = e.getNode('tag:form');
var data = e.getNodeData('tag:form');
if (!data.preview) {
var uri = '/conpherence/update/' + this._loadedThreadID + '/';
data.preview = new JX.PhabricatorShapedRequest(
uri,
JX.bag,
JX.bind(this, function () {
var data = JX.DOM.convertFormToDictionary(form);
data.action = 'draft';
data = this._getParams(data);
return data;
}));
}
data.preview.trigger();
} }
}, },

View file

@ -234,6 +234,13 @@ JX.behavior('durable-column', function(config, statics) {
'conpherence-message-form', 'conpherence-message-form',
_sendMessage); _sendMessage);
JX.Stratcom.listen(
['keydown'],
'conpherence-durable-column-textarea',
function (e) {
threadManager.handleDraftKeydown(e);
});
if (config.visible) { if (config.visible) {
_toggleColumn(false); _toggleColumn(false);
} }

View file

@ -564,28 +564,11 @@ JX.behavior('conpherence-menu', function(config) {
handleThreadScrollers handleThreadScrollers
); );
var onkeydownDraft = function (e) {
var form = e.getNode('tag:form');
var data = e.getNodeData('tag:form');
if (!data.preview) {
var uri = config.baseURI + 'update/' + _thread.selected + '/';
data.preview = new JX.PhabricatorShapedRequest(
uri,
JX.bag,
function () {
var data = JX.DOM.convertFormToDictionary(form);
data.action = 'draft';
return data;
});
}
data.preview.trigger();
};
JX.Stratcom.listen( JX.Stratcom.listen(
['keydown'], ['keydown'],
'conpherence-pontificate', 'conpherence-pontificate',
onkeydownDraft); function (e) {
threadManager.handleDraftKeydown(e);
});
}); });