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

View file

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

View file

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

View file

@ -252,6 +252,25 @@ JX.install('ConpherenceThreadManager', {
this._didSendMessageCallback(r);
}));
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',
_sendMessage);
JX.Stratcom.listen(
['keydown'],
'conpherence-durable-column-textarea',
function (e) {
threadManager.handleDraftKeydown(e);
});
if (config.visible) {
_toggleColumn(false);
}

View file

@ -564,28 +564,11 @@ JX.behavior('conpherence-menu', function(config) {
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(
['keydown'],
'conpherence-pontificate',
onkeydownDraft);
function (e) {
threadManager.handleDraftKeydown(e);
});
});