1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Further corrections to Conpherence updates

Summary:
Apparently I am crazy and didn't test D5537 propertly at all. In particular:

  - Currently, the update sends back new "people" and "files" widgets. The "people" widget has a tokenizer, which fatals when the behavior initializes without the widget in the DOM. For now, disable widget updates on replies. I'll fix this in a future diff.
  - Currently, we don't update the "last_transaction_id" in the form itself, so the first reply sends back 1 message, the next 2 messages, etc. Update the input.
  - The transaction paging doesn't and has never worked, I am crazy. Make it actually work.

Test Plan:
computers are too hard

(also, this is why I hate Javascript)

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D5538
This commit is contained in:
epriestley 2013-04-02 11:27:58 -07:00
parent d7951bec56
commit 9db4feda09
5 changed files with 62 additions and 68 deletions

View file

@ -774,15 +774,6 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/css/aphront/list-filter-view.css',
),
'aphront-multi-column-view-css' =>
array(
'uri' => '/res/5abc8fff/rsrc/css/aphront/multi-column.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/multi-column.css',
),
'aphront-notes' =>
array(
'uri' => '/res/f8f3dcfa/rsrc/css/core/aphront-notes.css',
@ -1277,7 +1268,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-pontificate' =>
array(
'uri' => '/res/a5f5b42c/rsrc/js/application/conpherence/behavior-pontificate.js',
'uri' => '/res/ae5f5f61/rsrc/js/application/conpherence/behavior-pontificate.js',
'type' => 'js',
'requires' =>
array(
@ -2851,7 +2842,7 @@ celerity_register_resource_map(array(
),
'phabricator-core-css' =>
array(
'uri' => '/res/040d65c1/rsrc/css/core/core.css',
'uri' => '/res/9df0488c/rsrc/css/core/core.css',
'type' => 'css',
'requires' =>
array(
@ -3447,7 +3438,7 @@ celerity_register_resource_map(array(
),
'phabricator-workboard-view-css' =>
array(
'uri' => '/res/c9bfe320/rsrc/css/layout/phabricator-workboard-view.css',
'uri' => '/res/b70667c6/rsrc/css/layout/phabricator-workboard-view.css',
'type' => 'css',
'requires' =>
array(
@ -3456,7 +3447,7 @@ celerity_register_resource_map(array(
),
'phabricator-workpanel-view-css' =>
array(
'uri' => '/res/4e25e23b/rsrc/css/layout/phabricator-workpanel-view.css',
'uri' => '/res/d2eea288/rsrc/css/layout/phabricator-workpanel-view.css',
'type' => 'css',
'requires' =>
array(
@ -3808,7 +3799,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'490ec7ca' =>
'c4fbf0c2' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -3850,7 +3841,7 @@ celerity_register_resource_map(array(
34 => 'phabricator-object-item-list-view-css',
35 => 'global-drag-and-drop-css',
),
'uri' => '/res/pkg/490ec7ca/core.pkg.css',
'uri' => '/res/pkg/c4fbf0c2/core.pkg.css',
'type' => 'css',
),
'd95b69e5' =>
@ -4040,16 +4031,16 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => '6b1fccc6',
'aphront-dialog-view-css' => '490ec7ca',
'aphront-error-view-css' => '490ec7ca',
'aphront-form-view-css' => '490ec7ca',
'aphront-list-filter-view-css' => '490ec7ca',
'aphront-pager-view-css' => '490ec7ca',
'aphront-panel-view-css' => '490ec7ca',
'aphront-table-view-css' => '490ec7ca',
'aphront-tokenizer-control-css' => '490ec7ca',
'aphront-tooltip-css' => '490ec7ca',
'aphront-typeahead-control-css' => '490ec7ca',
'aphront-dialog-view-css' => 'c4fbf0c2',
'aphront-error-view-css' => 'c4fbf0c2',
'aphront-form-view-css' => 'c4fbf0c2',
'aphront-list-filter-view-css' => 'c4fbf0c2',
'aphront-pager-view-css' => 'c4fbf0c2',
'aphront-panel-view-css' => 'c4fbf0c2',
'aphront-table-view-css' => 'c4fbf0c2',
'aphront-tokenizer-control-css' => 'c4fbf0c2',
'aphront-tooltip-css' => 'c4fbf0c2',
'aphront-typeahead-control-css' => 'c4fbf0c2',
'differential-changeset-view-css' => '8aaacd1b',
'differential-core-view-css' => '8aaacd1b',
'differential-inline-comment-editor' => 'e96b08f8',
@ -4063,7 +4054,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => '8aaacd1b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '490ec7ca',
'global-drag-and-drop-css' => 'c4fbf0c2',
'inline-comment-summary-css' => '8aaacd1b',
'javelin-aphlict' => 'd95b69e5',
'javelin-behavior' => 'fe22443b',
@ -4135,47 +4126,47 @@ celerity_register_resource_map(array(
'javelin-util' => 'fe22443b',
'javelin-vector' => 'fe22443b',
'javelin-workflow' => 'fe22443b',
'lightbox-attachment-css' => '490ec7ca',
'lightbox-attachment-css' => 'c4fbf0c2',
'maniphest-task-summary-css' => '6b1fccc6',
'maniphest-transaction-detail-css' => '6b1fccc6',
'phabricator-busy' => 'd95b69e5',
'phabricator-content-source-view-css' => '8aaacd1b',
'phabricator-core-buttons-css' => '490ec7ca',
'phabricator-core-css' => '490ec7ca',
'phabricator-crumbs-view-css' => '490ec7ca',
'phabricator-directory-css' => '490ec7ca',
'phabricator-core-buttons-css' => 'c4fbf0c2',
'phabricator-core-css' => 'c4fbf0c2',
'phabricator-crumbs-view-css' => 'c4fbf0c2',
'phabricator-directory-css' => 'c4fbf0c2',
'phabricator-drag-and-drop-file-upload' => 'e96b08f8',
'phabricator-dropdown-menu' => 'd95b69e5',
'phabricator-file-upload' => 'd95b69e5',
'phabricator-filetree-view-css' => '490ec7ca',
'phabricator-flag-css' => '490ec7ca',
'phabricator-form-view-css' => '490ec7ca',
'phabricator-header-view-css' => '490ec7ca',
'phabricator-jump-nav' => '490ec7ca',
'phabricator-filetree-view-css' => 'c4fbf0c2',
'phabricator-flag-css' => 'c4fbf0c2',
'phabricator-form-view-css' => 'c4fbf0c2',
'phabricator-header-view-css' => 'c4fbf0c2',
'phabricator-jump-nav' => 'c4fbf0c2',
'phabricator-keyboard-shortcut' => 'd95b69e5',
'phabricator-keyboard-shortcut-manager' => 'd95b69e5',
'phabricator-main-menu-view' => '490ec7ca',
'phabricator-main-menu-view' => 'c4fbf0c2',
'phabricator-menu-item' => 'd95b69e5',
'phabricator-nav-view-css' => '490ec7ca',
'phabricator-nav-view-css' => 'c4fbf0c2',
'phabricator-notification' => 'd95b69e5',
'phabricator-notification-css' => '490ec7ca',
'phabricator-notification-menu-css' => '490ec7ca',
'phabricator-object-item-list-view-css' => '490ec7ca',
'phabricator-notification-css' => 'c4fbf0c2',
'phabricator-notification-menu-css' => 'c4fbf0c2',
'phabricator-object-item-list-view-css' => 'c4fbf0c2',
'phabricator-object-selector-css' => '8aaacd1b',
'phabricator-prefab' => 'd95b69e5',
'phabricator-project-tag-css' => '6b1fccc6',
'phabricator-remarkup-css' => '490ec7ca',
'phabricator-remarkup-css' => 'c4fbf0c2',
'phabricator-shaped-request' => 'e96b08f8',
'phabricator-side-menu-view-css' => '490ec7ca',
'phabricator-standard-page-view' => '490ec7ca',
'phabricator-side-menu-view-css' => 'c4fbf0c2',
'phabricator-standard-page-view' => 'c4fbf0c2',
'phabricator-textareautils' => 'd95b69e5',
'phabricator-tooltip' => 'd95b69e5',
'phabricator-transaction-view-css' => '490ec7ca',
'phabricator-zindex-css' => '490ec7ca',
'sprite-apps-large-css' => '490ec7ca',
'sprite-gradient-css' => '490ec7ca',
'sprite-icon-css' => '490ec7ca',
'sprite-menu-css' => '490ec7ca',
'syntax-highlighting-css' => '490ec7ca',
'phabricator-transaction-view-css' => 'c4fbf0c2',
'phabricator-zindex-css' => 'c4fbf0c2',
'sprite-apps-large-css' => 'c4fbf0c2',
'sprite-gradient-css' => 'c4fbf0c2',
'sprite-icon-css' => 'c4fbf0c2',
'sprite-menu-css' => 'c4fbf0c2',
'syntax-highlighting-css' => 'c4fbf0c2',
),
));

View file

@ -324,7 +324,7 @@ final class ConpherenceUpdateController
$user = $this->getRequest()->getUser();
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->setBeforeMessageID($latest_transaction_id)
->setAfterMessageID($latest_transaction_id)
->needHeaderPics(true)
->needWidgetData(true)
->needAllTransactions(true)
@ -358,8 +358,10 @@ final class ConpherenceUpdateController
'nav_item' => hsprintf('%s', $nav_item),
'conpherence_phid' => $conpherence->getPHID(),
'header' => hsprintf('%s', $header),
'file_widget' => $file_widget->render(),
'people_widget' => $people_widget->render()
// TODO: Fix these.
// 'file_widget' => $file_widget->render(),
// 'people_widget' => $people_widget->render()
);
return $content;
}

View file

@ -12,7 +12,7 @@ final class ConpherenceThreadQuery
private $needHeaderPics;
private $needOrigPics;
private $needAllTransactions;
private $beforeMessageID;
private $afterMessageID;
public function needOrigPics($need_orig_pics) {
$this->needOrigPics = $need_orig_pics;
@ -44,9 +44,9 @@ final class ConpherenceThreadQuery
return $this;
}
// TODO: This is pretty hacky!
public function setBeforeMessageID($id) {
$this->beforeMessageID = $id;
// TODO: This is pretty hacky!!!!~~
public function setAfterMessageID($id) {
$this->afterMessageID = $id;
return $this;
}
@ -131,8 +131,9 @@ final class ConpherenceThreadQuery
->setViewer($this->getViewer())
->withObjectPHIDs(array_keys($conpherences))
->needHandles(true)
->setBeforeID($this->beforeMessageID)
->setAfterID($this->afterMessageID)
->execute();
$transactions = mgroup($transactions, 'getObjectPHID');
foreach ($conpherences as $phid => $conpherence) {
$current_transactions = $transactions[$phid];

View file

@ -137,6 +137,8 @@ abstract class PhabricatorApplicationTransactionQuery
$where[] = $clause;
}
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);
}

View file

@ -17,13 +17,6 @@ JX.behavior('conpherence-pontificate', function(config) {
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
var header = JX.DOM.find(root, 'div', 'conpherence-header');
var files = null;
try {
files = JX.DOM.find(root, 'div', 'conpherence-widget-files');
} catch (ex) {
// Ignore, this view may not have a Files widget.
}
JX.Workflow.newFromForm(form)
.setHandler(JX.bind(this, function(r) {
// add the new transactions, probably just our post but who knows
@ -39,8 +32,13 @@ JX.behavior('conpherence-pontificate', function(config) {
// Ignore; this view may not have a menu.
}
if (files) {
JX.DOM.setContent(files, JX.$H(r.file_widget));
var inputs = JX.DOM.scry(form, 'input');
for (var ii = 0; ii < inputs.length; ii++) {
JX.log(inputs[ii]);
if (inputs[ii].name == 'latest_transaction_id') {
inputs[ii].value = r.latest_transaction_id;
break;
}
}
var textarea = JX.DOM.find(form, 'textarea');