git ssb

10+

Matt McKegg / patchwork



Commit 68976cde98459b3f066c8c3c0fab7c054a4d848c

sort rollup replies in provided timestamp order if received < 10 mins apart (otherwise use sync time, experimental!)

Matt McKegg committed on 11/3/2016, 7:40:03 PM
Parent: f8a3919796796fb604a4d98decee02f962ee7cee

Files changed

lib/feed-summary.jschanged
lib/feed-summary.jsView
@@ -79,10 +79,10 @@
7979 const group = ensureMessage(c.root, messageUpdates)
8080 group.fromTime = fromTime
8181 group.lastUpdateType = 'reply'
8282 group.repliesFrom.add(msg.value.author)
83- //SortedArray.add(group.replies, msg, compareUserTimestamp)
84- group.replies.push(msg)
83 + SortedArray.add(group.replies, msg, compareUserTimestamp)
84 + //group.replies.push(msg)
8585 group.channel = group.channel || msg.value.content.channel
8686
8787 // only bump when filter passes
8888 if (!bumpFilter || bumpFilter(msg, group)) {
@@ -181,4 +181,14 @@
181181 }
182182 }
183183 return group
184184 }
185 +
186 +function compareUserTimestamp (a, b) {
187 + var isClose = !a.timestamp || !b.timestamp || Math.abs(a.timestamp - b.timestamp) < (10 * 60e3)
188 + if (isClose) {
189 + // recieved close together, use provided timestamps
190 + return a.value.timestamp - b.value.timestamp
191 + } else {
192 + return a.timestamp - b.timestamp
193 + }
194 +}

Built with git-ssb-web