1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Conpherence - fix JS and add code to repair old bad data

Summary:
the JS is fragile with respect to the tokenizer coming in from the people widget. make sure to always try to load this up. Note this generally needs to get cleaned up where the server should only send down the *exact* bits the client needs. This is all TODO as part of getting this on mobile perfectly. Also note this fragility exists still in that you can break conpherence by clicking quickly before the initial tokenizer load loads.

For old bad data, at some point we weren't updating participation as well as we do today in the editor class. the result is with the migration and code change some conversation participants have bad "last seen message" counts. the simplest case is the test user talking to themselves -- threads before the editor code fixes / changes will have the entire thread as unread for these folks. The other buggy case I saw was where the "last reply" to a thread wasn't being count. These issues showed up for threads February and older which is old.

Test Plan: edited conpherence meta data and no JS bugs. pontificated and no JS bugs. added a person and no JS bugs.

Reviewers: chad, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5622
This commit is contained in:
Bob Trahan 2013-04-08 13:41:34 -07:00
parent 73c49775c1
commit e07077ae4e
4 changed files with 63 additions and 26 deletions

View file

@ -1289,23 +1289,24 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-menu' =>
array(
'uri' => '/res/e8479b8e/rsrc/js/application/conpherence/behavior-menu.js',
'uri' => '/res/257f200d/rsrc/js/application/conpherence/behavior-menu.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
2 => 'javelin-request',
3 => 'javelin-stratcom',
4 => 'javelin-workflow',
5 => 'javelin-behavior-device',
6 => 'javelin-history',
2 => 'javelin-util',
3 => 'javelin-request',
4 => 'javelin-stratcom',
5 => 'javelin-workflow',
6 => 'javelin-behavior-device',
7 => 'javelin-history',
),
'disk' => '/rsrc/js/application/conpherence/behavior-menu.js',
),
'javelin-behavior-conpherence-pontificate' =>
array(
'uri' => '/res/68f1e046/rsrc/js/application/conpherence/behavior-pontificate.js',
'uri' => '/res/91d6418d/rsrc/js/application/conpherence/behavior-pontificate.js',
'type' => 'js',
'requires' =>
array(

View file

@ -28,7 +28,7 @@ final class ConpherenceParticipant extends ConpherenceDAO {
public function markUpToDate(
ConpherenceThread $conpherence,
ConpherenceTransaction $xaction) {
if (!$this->isUpToDate()) {
if (!$this->isUpToDate($conpherence)) {
$this->setParticipationStatus(ConpherenceParticipationStatus::UP_TO_DATE);
$this->setBehindTransactionPHID($xaction->getPHID());
$this->setSeenMessageCount($conpherence->getMessageCount());
@ -37,9 +37,12 @@ final class ConpherenceParticipant extends ConpherenceDAO {
return $this;
}
public function isUpToDate() {
return $this->getParticipationStatus() ==
ConpherenceParticipationStatus::UP_TO_DATE;
private function isUpToDate(ConpherenceThread $conpherence) {
return
($this->getSeenMessageCount() == $conpherence->getMessageCount())
&&
($this->getParticipationStatus() ==
ConpherenceParticipationStatus::UP_TO_DATE);
}
}

View file

@ -2,6 +2,7 @@
* @provides javelin-behavior-conpherence-menu
* @requires javelin-behavior
* javelin-dom
* javelin-util
* javelin-request
* javelin-stratcom
* javelin-workflow
@ -134,29 +135,48 @@ JX.behavior('conpherence-menu', function(config) {
JX.Stratcom.listen('click', 'conpherence-edit-metadata', function (e) {
e.kill();
var root = JX.$(config.form_pane);
var form = JX.DOM.find(root, 'form');
var root = e.getNode('conpherence-layout');
var form = JX.DOM.find(root, 'form', 'conpherence-pontificate');
var data = e.getNodeData('conpherence-edit-metadata');
var header = JX.DOM.find(root, 'div', 'conpherence-header');
var peopleWidget = null;
try {
peopleWidget = JX.DOM.find(root, 'div', 'widgets-people');
} catch (ex) {
// Ignore; maybe no people widget
}
new JX.Workflow.newFromForm(form, data)
.setHandler(function (r) {
.setHandler(JX.bind(this, function(r) {
// update the header
JX.DOM.setContent(
JX.$(config.header),
header,
JX.$H(r.header)
);
// update the menu entry
JX.DOM.replace(
JX.$(r.conpherence_phid + '-nav-item'),
JX.$H(r.nav_item)
);
try {
// update the menu entry
JX.DOM.replace(
JX.$(r.conpherence_phid + '-nav-item'),
JX.$H(r.nav_item)
);
JX.Stratcom.invoke(
'conpherence-selectthread',
null,
{ id : r.conpherence_phid + '-nav-item' }
);
} catch (ex) {
// Ignore; this view may not have a menu.
}
// update the people widget
JX.DOM.setContent(
JX.$(config.people_widget),
JX.$H(r.people_widget)
);
})
if (peopleWidget) {
// update the people widget
JX.DOM.setContent(
peopleWidget,
JX.$H(r.people_widget)
);
}
}))
.start();
});

View file

@ -22,6 +22,12 @@ JX.behavior('conpherence-pontificate', function(config) {
} catch (ex) {
// Ignore; maybe no files widget
}
var peopleWidget = null;
try {
peopleWidget = JX.DOM.find(root, 'div', 'widgets-people');
} catch (ex) {
// Ignore; maybe no peoples widget
}
JX.Workflow.newFromForm(form)
.setHandler(JX.bind(this, function(r) {
@ -51,6 +57,13 @@ JX.behavior('conpherence-pontificate', function(config) {
);
}
if (peopleWidget) {
JX.DOM.setContent(
peopleWidget,
JX.$H(r.people_widget)
);
}
var inputs = JX.DOM.scry(form, 'input');
for (var ii = 0; ii < inputs.length; ii++) {
if (inputs[ii].name == 'latest_transaction_id') {