git ssb

16+

Dominic / patchbay



Commit 812915c19cefd38d411ff51fc9293bf41bb31639

fix message.html.render for about messages

mixmix committed on 12/4/2018, 2:41:01 AM
Parent: b646c50c6df0318aa13a4c05977b089df80e370a

Files changed

message/html/render/about.jschanged
message/html/render/about.jsView
@@ -1,7 +1,7 @@
11 const nest = require('depnest')
22 const extend = require('xtend')
3-const ref = require('ssb-ref')
3 +const { isFeed, isMsg, isBlob } = require('ssb-ref')
44 const { h } = require('mutant')
55
66 exports.gives = nest('message.html.render')
77
@@ -17,15 +17,17 @@
1717 exports.create = function (api) {
1818 return nest('message.html.render', about)
1919
2020 function about (msg, opts) {
21 + // TODO write schemas for different sorts of about message
2122 if (msg.value.content.type !== 'about') return
2223
2324 const { name, description, image, about } = msg.value.content
2425 if (!name && !description && !image) return
26 + if (!isFeed(about)) return
27 + // mix : note this looked like it was intended to deal with all about message but the logic sucked
28 + // I've made it explicitly handle only about messages for people, as that's what it was actually doing
2529
26- if (ref.isMsg(about)) return
27-
2830 const element = api.message.html.layout(msg, extend({
2931 content: renderContent(msg),
3032 layout: 'default'
3133 }, opts))
@@ -38,9 +40,9 @@
3840 var { about, link, name, description, image } = content
3941 if (!about) return
4042
4143 // TODO : build better normalizers
42- if (image && ref.isBlob(image.link)) image = image.link
44 + if (image && isBlob(image.link)) image = image.link
4345 about = about || link
4446
4547 const metaData = [
4648 typeof name === 'string'
@@ -53,18 +55,18 @@
5355 ? h('img', { src: api.blob.sync.url(image), style: { 'margin-top': '.5rem' } })
5456 : undefined
5557 ]
5658
57- if (!ref.isFeed(about)) {
58- return [
59- h('p', [
60- 'Describes ',
61- h('a', { href: about }, [about.slice(0, 7), '...']),
62- ' as: '
63- ]),
64- ...metaData
65- ]
66- }
59 + // if (!isFeed(about)) {
60 + // return [
61 + // h('p', [
62 + // 'Describes ',
63 + // h('a', { href: about }, [about.slice(0, 7), '...']),
64 + // ' as: '
65 + // ]),
66 + // ...metaData
67 + // ]
68 + // }
6769
6870 const target = author === about
6971 ? 'themself '
7072 : api.about.html.link(about)

Built with git-ssb-web