Skip to content

Commit e07077a

Browse files
committed
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
1 parent 73c4977 commit e07077a

File tree

4 files changed

+63
-26
lines changed

4 files changed

+63
-26
lines changed

src/__celerity_resource_map__.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,23 +1289,24 @@
12891289
),
12901290
'javelin-behavior-conpherence-menu' =>
12911291
array(
1292-
'uri' => '/res/e8479b8e/rsrc/js/application/conpherence/behavior-menu.js',
1292+
'uri' => '/res/257f200d/rsrc/js/application/conpherence/behavior-menu.js',
12931293
'type' => 'js',
12941294
'requires' =>
12951295
array(
12961296
0 => 'javelin-behavior',
12971297
1 => 'javelin-dom',
1298-
2 => 'javelin-request',
1299-
3 => 'javelin-stratcom',
1300-
4 => 'javelin-workflow',
1301-
5 => 'javelin-behavior-device',
1302-
6 => 'javelin-history',
1298+
2 => 'javelin-util',
1299+
3 => 'javelin-request',
1300+
4 => 'javelin-stratcom',
1301+
5 => 'javelin-workflow',
1302+
6 => 'javelin-behavior-device',
1303+
7 => 'javelin-history',
13031304
),
13041305
'disk' => '/rsrc/js/application/conpherence/behavior-menu.js',
13051306
),
13061307
'javelin-behavior-conpherence-pontificate' =>
13071308
array(
1308-
'uri' => '/res/68f1e046/rsrc/js/application/conpherence/behavior-pontificate.js',
1309+
'uri' => '/res/91d6418d/rsrc/js/application/conpherence/behavior-pontificate.js',
13091310
'type' => 'js',
13101311
'requires' =>
13111312
array(

src/applications/conpherence/storage/ConpherenceParticipant.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getSettings() {
2828
public function markUpToDate(
2929
ConpherenceThread $conpherence,
3030
ConpherenceTransaction $xaction) {
31-
if (!$this->isUpToDate()) {
31+
if (!$this->isUpToDate($conpherence)) {
3232
$this->setParticipationStatus(ConpherenceParticipationStatus::UP_TO_DATE);
3333
$this->setBehindTransactionPHID($xaction->getPHID());
3434
$this->setSeenMessageCount($conpherence->getMessageCount());
@@ -37,9 +37,12 @@ public function markUpToDate(
3737
return $this;
3838
}
3939

40-
public function isUpToDate() {
41-
return $this->getParticipationStatus() ==
42-
ConpherenceParticipationStatus::UP_TO_DATE;
40+
private function isUpToDate(ConpherenceThread $conpherence) {
41+
return
42+
($this->getSeenMessageCount() == $conpherence->getMessageCount())
43+
&&
44+
($this->getParticipationStatus() ==
45+
ConpherenceParticipationStatus::UP_TO_DATE);
4346
}
4447

4548
}

webroot/rsrc/js/application/conpherence/behavior-menu.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @provides javelin-behavior-conpherence-menu
33
* @requires javelin-behavior
44
* javelin-dom
5+
* javelin-util
56
* javelin-request
67
* javelin-stratcom
78
* javelin-workflow
@@ -134,29 +135,48 @@ JX.behavior('conpherence-menu', function(config) {
134135

135136
JX.Stratcom.listen('click', 'conpherence-edit-metadata', function (e) {
136137
e.kill();
137-
var root = JX.$(config.form_pane);
138-
var form = JX.DOM.find(root, 'form');
138+
var root = e.getNode('conpherence-layout');
139+
var form = JX.DOM.find(root, 'form', 'conpherence-pontificate');
139140
var data = e.getNodeData('conpherence-edit-metadata');
141+
var header = JX.DOM.find(root, 'div', 'conpherence-header');
142+
var peopleWidget = null;
143+
try {
144+
peopleWidget = JX.DOM.find(root, 'div', 'widgets-people');
145+
} catch (ex) {
146+
// Ignore; maybe no people widget
147+
}
148+
140149
new JX.Workflow.newFromForm(form, data)
141-
.setHandler(function (r) {
150+
.setHandler(JX.bind(this, function(r) {
142151
// update the header
143152
JX.DOM.setContent(
144-
JX.$(config.header),
153+
header,
145154
JX.$H(r.header)
146155
);
147156

148-
// update the menu entry
149-
JX.DOM.replace(
150-
JX.$(r.conpherence_phid + '-nav-item'),
151-
JX.$H(r.nav_item)
152-
);
157+
try {
158+
// update the menu entry
159+
JX.DOM.replace(
160+
JX.$(r.conpherence_phid + '-nav-item'),
161+
JX.$H(r.nav_item)
162+
);
163+
JX.Stratcom.invoke(
164+
'conpherence-selectthread',
165+
null,
166+
{ id : r.conpherence_phid + '-nav-item' }
167+
);
168+
} catch (ex) {
169+
// Ignore; this view may not have a menu.
170+
}
153171

154-
// update the people widget
155-
JX.DOM.setContent(
156-
JX.$(config.people_widget),
157-
JX.$H(r.people_widget)
158-
);
159-
})
172+
if (peopleWidget) {
173+
// update the people widget
174+
JX.DOM.setContent(
175+
peopleWidget,
176+
JX.$H(r.people_widget)
177+
);
178+
}
179+
}))
160180
.start();
161181
});
162182

webroot/rsrc/js/application/conpherence/behavior-pontificate.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ JX.behavior('conpherence-pontificate', function(config) {
2222
} catch (ex) {
2323
// Ignore; maybe no files widget
2424
}
25+
var peopleWidget = null;
26+
try {
27+
peopleWidget = JX.DOM.find(root, 'div', 'widgets-people');
28+
} catch (ex) {
29+
// Ignore; maybe no peoples widget
30+
}
2531

2632
JX.Workflow.newFromForm(form)
2733
.setHandler(JX.bind(this, function(r) {
@@ -51,6 +57,13 @@ JX.behavior('conpherence-pontificate', function(config) {
5157
);
5258
}
5359

60+
if (peopleWidget) {
61+
JX.DOM.setContent(
62+
peopleWidget,
63+
JX.$H(r.people_widget)
64+
);
65+
}
66+
5467
var inputs = JX.DOM.scry(form, 'input');
5568
for (var ii = 0; ii < inputs.length; ii++) {
5669
if (inputs[ii].name == 'latest_transaction_id') {

0 commit comments

Comments
 (0)