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 PMParent: f8a3919796796fb604a4d98decee02f962ee7cee
Files changed
lib/feed-summary.js | changed |
lib/feed-summary.js | ||
---|---|---|
@@ -79,10 +79,10 @@ | ||
79 | 79 … | const group = ensureMessage(c.root, messageUpdates) |
80 | 80 … | group.fromTime = fromTime |
81 | 81 … | group.lastUpdateType = 'reply' |
82 | 82 … | 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) | |
85 | 85 … | group.channel = group.channel || msg.value.content.channel |
86 | 86 … | |
87 | 87 … | // only bump when filter passes |
88 | 88 … | if (!bumpFilter || bumpFilter(msg, group)) { |
@@ -181,4 +181,14 @@ | ||
181 | 181 … | } |
182 | 182 … | } |
183 | 183 … | return group |
184 | 184 … | } |
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