git ssb

7+

dinoworm ๐Ÿ› / patchcore



Tree: a690b3b6fbae95bcc505e502af93903beb3ba86e

Files: a690b3b6fbae95bcc505e502af93903beb3ba86e / message / sync / root.js

633 bytesRaw
1var ref = require('ssb-ref')
2var nest = require('depnest')
3
4exports.gives = nest('message.sync.root', true)
5
6exports.create = function (api) {
7 return nest('message.sync.root', function (msg) {
8 if (msg && msg.value && msg.value.content) {
9 var type = msg.value.content.type
10 var root = msg.value.content.root
11
12 if (type === 'vote') {
13 root = msg.value.content.vote && msg.value.content.vote.link
14 } else if (type === 'about') {
15 root = msg.value.content.about
16 }
17
18 // only abouts and likes for messages (not feeds) will be returned
19 if (ref.isMsg(root)) return root
20 }
21 })
22}
23

Built with git-ssb-web