Commit 208be5e878807785bd047484e2d277826aa5f4c7
Merge pull request #325 from ssbc/book-notifications
Add book notificationsAnders Rune Jensen authored on 5/2/2019, 7:48:18 PM
GitHub committed on 5/2/2019, 7:48:18 PM
Parent: 9c5fb9afa9248c901294db9eac5e350da9bc055d
Parent: 8b4f3d4e0811a99edcd74de11882190e18a6a267
Files changed
app/page/notifications.js | changed |
package-lock.json | changed |
package.json | changed |
app/page/notifications.js | ||
---|---|---|
@@ -1,9 +1,11 @@ | ||
1 | 1 | const nest = require('depnest') |
2 | 2 | const { h } = require('mutant') |
3 | 3 | const pull = require('pull-stream') |
4 | +const pullMerge = require('pull-merge') | |
4 | 5 | const Scroller = require('pull-scroll') |
5 | 6 | const next = require('pull-next-query') |
7 | +const BookNotifications = require('scuttle-book/pull/notifications') | |
6 | 8 | |
7 | 9 | exports.gives = nest({ |
8 | 10 | 'app.html.menuItem': true, |
9 | 11 | 'app.page.notifications': true |
@@ -64,8 +66,9 @@ | ||
64 | 66 | // NOTE - currently this stream is know to pick up: |
65 | 67 | // - post mentions (public) |
66 | 68 | // - patchwork replies (public) |
67 | 69 | // - scry (public, private) |
70 | + // - reviews on scuttle-books you posted (public) | |
68 | 71 | |
69 | 72 | function pullMentions (opts) { |
70 | 73 | const query = [{ |
71 | 74 | $filter: { |
@@ -87,15 +90,22 @@ | ||
87 | 90 | index: 'DTA' |
88 | 91 | }, opts) |
89 | 92 | |
90 | 93 | return api.sbot.pull.stream(server => { |
91 | - return pull( | |
92 | - next(server.backlinks.read, _opts, ['timestamp']), | |
93 | - pull.filter(m => { | |
94 | - if (m.value.content.type !== 'post') return true | |
95 | - return !m.value.private // no private posts | |
96 | - }), | |
97 | - pull.filter(m => !api.message.sync.isBlocked(m)) | |
94 | + const bookNotifications = BookNotifications(server) | |
95 | + return pullMerge( | |
96 | + pull( | |
97 | + next(server.backlinks.read, _opts, ['timestamp']), | |
98 | + pull.filter(m => { | |
99 | + if (m.value.content.type !== 'post') return true | |
100 | + return !m.value.private // no private posts | |
101 | + }), | |
102 | + pull.filter(m => !api.message.sync.isBlocked(m)) | |
103 | + ), | |
104 | + pull(bookNotifications(api.keys.sync.id(), opts)), | |
105 | + (lhs, rhs) => { | |
106 | + return rhs.value.timestamp - lhs.value.timestamp | |
107 | + } | |
98 | 108 | ) |
99 | 109 | }) |
100 | 110 | } |
101 | 111 | } |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 710176 bytes New file size: 710208 bytes |
package.json | ||
---|---|---|
@@ -71,9 +71,9 @@ | ||
71 | 71 | "patch-history": "^1.0.0", |
72 | 72 | "patch-inbox": "^1.3.1", |
73 | 73 | "patch-settings": "^1.1.2", |
74 | 74 | "patch-suggest": "^3.0.1", |
75 | - "patchbay-book": "^2.0.0", | |
75 | + "patchbay-book": "^2.0.3", | |
76 | 76 | "patchbay-dark-crystal": "^2.0.0", |
77 | 77 | "patchbay-gatherings": "^3.2.9", |
78 | 78 | "patchbay-hacky-art": "^1.0.0", |
79 | 79 | "patchbay-poll": "^1.1.4", |
Built with git-ssb-web