git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

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 feed
Matt McKegg committed on 12/12/2017, 2:06:13 AM
Parent: dbe444113f2ca34fc436778abd48372dd514941d

Files changed

modules/feed/html/rollup.jschanged
overrides/patchcore/backlinks/obs.jschanged
package.jsonchanged
sbot/roots.jschanged
modules/feed/html/rollup.jsView
@@ -24,8 +24,9 @@
2424 'message.html.canRender': 'first',
2525 'message.html.render': 'first',
2626 'message.sync.isBlocked': 'first',
2727 'message.sync.unbox': 'first',
28+ 'message.sync.timestamp': 'first',
2829 'profile.html.person': 'first',
2930 'message.html.link': 'first',
3031 'message.sync.root': 'first',
3132 'feed.pull.rollup': 'first',
@@ -292,8 +293,12 @@
292293 cb(null, msg)
293294 }
294295 })
295296 }
297+
298+ function byAssertedTime (a, b) {
299+ return api.message.sync.timestamp(a) - api.message.sync.timestamp(b)
300+ }
296301 }
297302
298303 function plural (value, single, many) {
299304 return computed(value, (value) => {
@@ -379,12 +384,8 @@
379384 function returnFalse () {
380385 return false
381386 }
382387
383-function byAssertedTime (a, b) {
384- return a.value.timestamp - b.value.timestamp
385-}
386-
387388 function last (array) {
388389 if (Array.isArray(array)) {
389390 return array[array.length - 1]
390391 } else {
overrides/patchcore/backlinks/obs.jsView
@@ -9,9 +9,10 @@
99
1010 exports.needs = nest({
1111 'sbot.pull.backlinks': 'first',
1212 'sbot.obs.connection': 'first',
13- 'sbot.pull.stream': 'first'
13+ 'sbot.pull.stream': 'first',
14+ 'message.sync.timestamp': 'first'
1415 })
1516
1617 exports.gives = nest('backlinks.obs.for', true)
1718
@@ -117,17 +118,17 @@
117118
118119 function unsubscribe (id) {
119120 onceTrue(api.sbot.obs.connection(), (sbot) => sbot.patchwork.liveBacklinks.unsubscribe(id))
120121 }
121-}
122122
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+ }
130131 }
131132 }
132133
133134 function isReplyTo (maybeReply, msg) {
package.jsonView
@@ -40,9 +40,9 @@
4040 "mutant": "^3.21.2",
4141 "mutant-pull-reduce": "^1.1.0",
4242 "obv": "0.0.1",
4343 "patch-settings": "^1.0.1",
44- "patchcore": "~1.19.0",
44+ "patchcore": "~1.21.0",
4545 "pull-abortable": "^4.1.0",
4646 "pull-defer": "^0.2.2",
4747 "pull-file": "~1.0.0",
4848 "pull-identify-filetype": "^1.1.0",
@@ -56,9 +56,9 @@
5656 "sorted-array-functions": "~1.0.0",
5757 "spacetime": "^1.0.7",
5858 "ssb-about": "~0.1.1",
5959 "ssb-avatar": "^0.2.0",
60- "ssb-backlinks": "~0.5.1",
60+ "ssb-backlinks": "~0.6.0",
6161 "ssb-blobs": "~1.1.4",
6262 "ssb-friends": "^2.3.5",
6363 "ssb-keys": "^7.0.13",
6464 "ssb-mentions": "^0.4.0",
sbot/roots.jsView
@@ -8,13 +8,14 @@
88 var Defer = require('pull-defer')
99
1010 // HACK: pull it out of patchcore
1111 var getRoot = require('patchcore/message/sync/root').create().message.sync.root
12+var getTimestamp = require('patchcore/message/sync/timestamp').create().message.sync.timestamp
1213
1314 module.exports = function (ssb, config) {
14- var create = FlumeViewLevel(1, function (msg, seq) {
15+ var create = FlumeViewLevel(2, function (msg, seq) {
1516 var result = [
16- [msg.value.timestamp, getRoot(msg) || msg.key]
17+ [getTimestamp(msg), getRoot(msg) || msg.key]
1718 ]
1819 return result
1920 })
2021

Built with git-ssb-web