Commit f06d537e3a5dcdce8c60eb9c129923924e3d7326
use min of asserted/received value for asserted timestamp
better handling of the case where other feed clocks have been set in the future (relative to yours) no more “Received 3 mins from now” or posts stuck at top of feedMatt McKegg committed on 12/12/2017, 2:06:13 AM
Parent: dbe444113f2ca34fc436778abd48372dd514941d
Files changed
modules/feed/html/rollup.js | changed |
overrides/patchcore/backlinks/obs.js | changed |
package.json | changed |
sbot/roots.js | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -24,8 +24,9 @@ | ||
24 | 24 | 'message.html.canRender': 'first', |
25 | 25 | 'message.html.render': 'first', |
26 | 26 | 'message.sync.isBlocked': 'first', |
27 | 27 | 'message.sync.unbox': 'first', |
28 | + 'message.sync.timestamp': 'first', | |
28 | 29 | 'profile.html.person': 'first', |
29 | 30 | 'message.html.link': 'first', |
30 | 31 | 'message.sync.root': 'first', |
31 | 32 | 'feed.pull.rollup': 'first', |
@@ -292,8 +293,12 @@ | ||
292 | 293 | cb(null, msg) |
293 | 294 | } |
294 | 295 | }) |
295 | 296 | } |
297 | + | |
298 | + function byAssertedTime (a, b) { | |
299 | + return api.message.sync.timestamp(a) - api.message.sync.timestamp(b) | |
300 | + } | |
296 | 301 | } |
297 | 302 | |
298 | 303 | function plural (value, single, many) { |
299 | 304 | return computed(value, (value) => { |
@@ -379,12 +384,8 @@ | ||
379 | 384 | function returnFalse () { |
380 | 385 | return false |
381 | 386 | } |
382 | 387 | |
383 | -function byAssertedTime (a, b) { | |
384 | - return a.value.timestamp - b.value.timestamp | |
385 | -} | |
386 | - | |
387 | 388 | function last (array) { |
388 | 389 | if (Array.isArray(array)) { |
389 | 390 | return array[array.length - 1] |
390 | 391 | } else { |
overrides/patchcore/backlinks/obs.js | ||
---|---|---|
@@ -9,9 +9,10 @@ | ||
9 | 9 | |
10 | 10 | exports.needs = nest({ |
11 | 11 | 'sbot.pull.backlinks': 'first', |
12 | 12 | 'sbot.obs.connection': 'first', |
13 | - 'sbot.pull.stream': 'first' | |
13 | + 'sbot.pull.stream': 'first', | |
14 | + 'message.sync.timestamp': 'first' | |
14 | 15 | }) |
15 | 16 | |
16 | 17 | exports.gives = nest('backlinks.obs.for', true) |
17 | 18 | |
@@ -117,17 +118,17 @@ | ||
117 | 118 | |
118 | 119 | function unsubscribe (id) { |
119 | 120 | onceTrue(api.sbot.obs.connection(), (sbot) => sbot.patchwork.liveBacklinks.unsubscribe(id)) |
120 | 121 | } |
121 | -} | |
122 | 122 | |
123 | -function compareAsserted (a, b) { | |
124 | - if (isReplyTo(a, b)) { | |
125 | - return -1 | |
126 | - } else if (isReplyTo(b, a)) { | |
127 | - return 1 | |
128 | - } else { | |
129 | - return a.value.timestamp - b.value.timestamp | |
123 | + function compareAsserted (a, b) { | |
124 | + if (isReplyTo(a, b)) { | |
125 | + return -1 | |
126 | + } else if (isReplyTo(b, a)) { | |
127 | + return 1 | |
128 | + } else { | |
129 | + return api.message.sync.timestamp(a) - api.message.sync.timestamp(b) | |
130 | + } | |
130 | 131 | } |
131 | 132 | } |
132 | 133 | |
133 | 134 | function isReplyTo (maybeReply, msg) { |
package.json | ||
---|---|---|
@@ -40,9 +40,9 @@ | ||
40 | 40 | "mutant": "^3.21.2", |
41 | 41 | "mutant-pull-reduce": "^1.1.0", |
42 | 42 | "obv": "0.0.1", |
43 | 43 | "patch-settings": "^1.0.1", |
44 | - "patchcore": "~1.19.0", | |
44 | + "patchcore": "~1.21.0", | |
45 | 45 | "pull-abortable": "^4.1.0", |
46 | 46 | "pull-defer": "^0.2.2", |
47 | 47 | "pull-file": "~1.0.0", |
48 | 48 | "pull-identify-filetype": "^1.1.0", |
@@ -56,9 +56,9 @@ | ||
56 | 56 | "sorted-array-functions": "~1.0.0", |
57 | 57 | "spacetime": "^1.0.7", |
58 | 58 | "ssb-about": "~0.1.1", |
59 | 59 | "ssb-avatar": "^0.2.0", |
60 | - "ssb-backlinks": "~0.5.1", | |
60 | + "ssb-backlinks": "~0.6.0", | |
61 | 61 | "ssb-blobs": "~1.1.4", |
62 | 62 | "ssb-friends": "^2.3.5", |
63 | 63 | "ssb-keys": "^7.0.13", |
64 | 64 | "ssb-mentions": "^0.4.0", |
sbot/roots.js | ||
---|---|---|
@@ -8,13 +8,14 @@ | ||
8 | 8 | var Defer = require('pull-defer') |
9 | 9 | |
10 | 10 | // HACK: pull it out of patchcore |
11 | 11 | var getRoot = require('patchcore/message/sync/root').create().message.sync.root |
12 | +var getTimestamp = require('patchcore/message/sync/timestamp').create().message.sync.timestamp | |
12 | 13 | |
13 | 14 | module.exports = function (ssb, config) { |
14 | - var create = FlumeViewLevel(1, function (msg, seq) { | |
15 | + var create = FlumeViewLevel(2, function (msg, seq) { | |
15 | 16 | var result = [ |
16 | - [msg.value.timestamp, getRoot(msg) || msg.key] | |
17 | + [getTimestamp(msg), getRoot(msg) || msg.key] | |
17 | 18 | ] |
18 | 19 | return result |
19 | 20 | }) |
20 | 21 |
Built with git-ssb-web