git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit b67ed19d6fbf76c870c96c70cb920c9eda385257

add relationships module

Dominic Tarr committed on 7/25/2016, 12:34:44 AM
Parent: f32aaca1352e9cd82c3584608228beda59e2a946

Files changed

modules/index.jschanged
modules/relationships.jsadded
modules/index.jsView
@@ -11,8 +11,9 @@
1111 "crypto.js": require('./crypto.js'),
1212 "feed.js": require('./feed.js'),
1313 "file-input.js": require('./file-input.js'),
1414 "follow.js": require('./follow.js'),
15+ "relationships.js": require('./relationships.js'),
1516 "invite.js": require('./invite.js'),
1617 "like.js": require('./like.js'),
1718 "markdown.js": require('./markdown.js'),
1819 "message-confirm.js": require('./message-confirm.js'),
modules/relationships.jsView
@@ -1,0 +1,23 @@
1+
2+var plugs = require('../plugs')
3+
4+var sbot_links2 = plugs.first(exports.sbot_links2 = [])
5+
6+//this is a bit crude, and doesn't actually show unfollows yet.
7+
8+exports.follows = function (id, cb) {
9+ return sbot_links2({query: [
10+ {"$filter": {"source": id, "rel": ["contact", true, false] }},
11+ {"$map": "dest"}
12+ ]})
13+}
14+
15+exports.followers = function (id) {
16+ return sbot_links2({query: [
17+ {"$filter": {"dest": id, "rel": ["contact", true, false] }},
18+ {"$map": "source"}
19+ ]})
20+}
21+
22+
23+

Built with git-ssb-web