git ssb

16+

Dominic / patchbay



Commit 208be5e878807785bd047484e2d277826aa5f4c7

Merge pull request #325 from ssbc/book-notifications

Add book notifications
Anders 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.jschanged
package-lock.jsonchanged
package.jsonchanged
app/page/notifications.jsView
@@ -1,9 +1,11 @@
11 const nest = require('depnest')
22 const { h } = require('mutant')
33 const pull = require('pull-stream')
4+const pullMerge = require('pull-merge')
45 const Scroller = require('pull-scroll')
56 const next = require('pull-next-query')
7+const BookNotifications = require('scuttle-book/pull/notifications')
68
79 exports.gives = nest({
810 'app.html.menuItem': true,
911 'app.page.notifications': true
@@ -64,8 +66,9 @@
6466 // NOTE - currently this stream is know to pick up:
6567 // - post mentions (public)
6668 // - patchwork replies (public)
6769 // - scry (public, private)
70+ // - reviews on scuttle-books you posted (public)
6871
6972 function pullMentions (opts) {
7073 const query = [{
7174 $filter: {
@@ -87,15 +90,22 @@
8790 index: 'DTA'
8891 }, opts)
8992
9093 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+ }
98108 )
99109 })
100110 }
101111 }
package-lock.jsonView
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.jsonView
@@ -71,9 +71,9 @@
7171 "patch-history": "^1.0.0",
7272 "patch-inbox": "^1.3.1",
7373 "patch-settings": "^1.1.2",
7474 "patch-suggest": "^3.0.1",
75- "patchbay-book": "^2.0.0",
75+ "patchbay-book": "^2.0.3",
7676 "patchbay-dark-crystal": "^2.0.0",
7777 "patchbay-gatherings": "^3.2.9",
7878 "patchbay-hacky-art": "^1.0.0",
7979 "patchbay-poll": "^1.1.4",

Built with git-ssb-web