git ssb

0+

Daan Patchwork / ssb-viewer



forked from cel / ssb-viewer

Commit cecdc93fd30b7c181e4e9720a98ef8f788355906

Render gathering descriptions

Jacob Karlsson committed on 7/2/2018, 5:52:17 PM
Parent: 857dc63ce5bae471cf7123b6ec6ace0896677b64

Files changed

index.jschanged
render.jschanged
index.jsView
@@ -136,8 +136,9 @@
136136 paramap(addBlog, 8),
137137 paramap(addFollowAbout, 8),
138138 paramap(addVoteMessage, 8),
139139 paramap(addGitLinks, 8),
140+ paramap(addGatheringAbout, 8),
140141 render(),
141142 toPull(res, function (err) {
142143 if (err) console.error('[viewer]', err)
143144 })
@@ -241,8 +242,9 @@
241242 paramap(addBlog, 8),
242243 paramap(addFollowAbout, 8),
243244 paramap(addVoteMessage, 8),
244245 paramap(addGitLinks, 8),
246+ paramap(addGatheringAbout, 8),
245247 pull(renderThread(feedOpts), wrapPage(name)),
246248 toPull(res, function (err) {
247249 if (err) console.error('[viewer]', err)
248250 })
@@ -267,9 +269,10 @@
267269 pull(
268270 pull.values(logs),
269271 paramap(addAuthorAbout, 8),
270272 paramap(addBlog, 8),
271- paramap(addVoteMessage, 8),
273+ paramap(addVoteMessage, 8),
274+ paramap(addGatheringAbout, 8),
272275 pull(renderThread(defaultOpts, '', renderShowAll(showAll, req.url)),
273276 wrapPage('#' + channelId)),
274277 toPull(res, function (err) {
275278 if (err) console.error('[viewer]', err)
@@ -323,8 +326,9 @@
323326 pull(
324327 pull.values(sort(links)),
325328 paramap(addAuthorAbout, 8),
326329 paramap(addBlog, 8),
330+ paramap(addGatheringAbout, 8),
327331 format,
328332 toPull(res, function (err) {
329333 if (err) console.error('[viewer]', err)
330334 })
@@ -391,8 +395,23 @@
391395 cb(null, msg)
392396 })
393397 }
394398
399+ function addGatheringAbout(msg, cb) {
400+ if (msg.value && msg.value.content.type === 'gathering') {
401+ console.log('adding gathering abouts. msg:', msg)
402+ getAbout(msg.key, (err, about) => {
403+ if (err) { return cb(err) }
404+
405+ msg.value.content.about = about
406+ console.log('about gathering', about)
407+ cb(null, msg)
408+ })
409+ } else {
410+ cb(null, msg)
411+ }
412+ }
413+
395414 function addGitLinks(msg, cb) {
396415 if (msg.value.content.type == 'git-update')
397416 getMsg(msg.value.content.repo, function (err, gitRepo) {
398417 if (gitRepo)
render.jsView
@@ -522,11 +522,27 @@
522522 s.innerHTML = marked(String(c.blogContent), opts.marked)
523523
524524 return [channel, h('h2', c.title), s];
525525 }
526+ else if (c.type === 'gathering') {
527+ console.log('opts', opts)
528+ console.log('c', c)
529+
530+ return ['id: ' + id,
531+ h('div',
532+ ['this is a gathering boopadoop',
533+ renderGathering(opts, id, c)]
534+ )
535+ ]
536+ }
526537 else return renderDefault(c);
527538 }
528539
540+function renderGathering(opts, id, c) {
541+ console.log('gathering content:', c)
542+ return h('div', c.about.description)
543+}
544+
529545 function renderPost(opts, id, c) {
530546 opts.mentions = {};
531547 if (Array.isArray(c.mentions)) {
532548 c.mentions.forEach(function (link) {

Built with git-ssb-web