git ssb

7+

dinoworm 🐛 / patchcore



Commit aeffed8b04f94878e4481ca09cd5359940c55102

feed.pull.rollup: use pull.unique instead of custom code

Matt McKegg committed on 6/21/2017, 12:33:57 AM
Parent: 31f46fbae8f4e0e6a228ab89d9304da16ad34b03

Files changed

feed/pull/rollup.jschanged
feed/pull/rollup.jsView
@@ -17,32 +17,18 @@
1717
1818 exports.create = function (api) {
1919 return nest('feed.pull.rollup', function (rootFilter) {
2020 return pull(
21- Roots(),
21 + pull.map(msg => api.message.sync.root(msg) || msg.key),
22 + pull.unique(),
2223 Lookup(),
2324 pull.filter(msg => msg && msg.value && !api.message.sync.root(msg)),
2425 pull.filter(rootFilter || (() => true)),
2526 AddReplies()
2627 )
2728 })
2829
2930 // scoped
30-
31- function Roots () {
32- var alreadyEmitted = new Set()
33- return pull(
34- pull.map((msg) => {
35- var root = api.message.sync.root(msg) || msg.key
36- if (!alreadyEmitted.has(root)) {
37- alreadyEmitted.add(root)
38- return root
39- }
40- }),
41- pull.filter()
42- )
43- }
44-
4531 function Lookup () {
4632 return pull.asyncMap((key, cb) => {
4733 api.sbot.async.get(key, (_, value) => {
4834 if (typeof value.content === 'string') {

Built with git-ssb-web