Commit 15fad1b5904057929eb70d9931b1b2f3339cc87c
render repo names with ssb-avatar
Ev Bogue committed on 10/11/2018, 6:34:01 PMParent: 8e2236d6be260051ebef7762adbc9a84db03a913
Files changed
render.js | changed |
render.js | ||
---|---|---|
@@ -8,8 +8,9 @@ | ||
8 | 8 | |
9 | 9 | var config = require('./config')() |
10 | 10 | var id = require('./keys').id |
11 | 11 | var avatar = require('./avatar') |
12 | +var ssbAvatar = require('ssb-avatar') | |
12 | 13 | |
13 | 14 | var diff = require('diff') |
14 | 15 | |
15 | 16 | function hash () { |
@@ -102,9 +103,8 @@ | ||
102 | 103 | var cloneurl = h('pre', 'git clone ssb://' + msg.value.content.repo) |
103 | 104 | |
104 | 105 | message.appendChild(reponame) |
105 | 106 | |
106 | - var ssbAvatar = require('ssb-avatar') | |
107 | 107 | |
108 | 108 | ssbAvatar(sbot, id, msg.value.content.repo, function (err, data) { |
109 | 109 | if (data) |
110 | 110 | var actualname = h('p', 'pushed to ', h('a', {href: '#' + msg.value.content.repo}, '%' + data.name)) |
@@ -128,16 +128,21 @@ | ||
128 | 128 | |
129 | 129 | } |
130 | 130 | else if (msg.value.content.type == 'git-repo') { |
131 | 131 | message.appendChild(tools.header(msg)) |
132 | - if (msg.value.content.name) { | |
133 | - message.appendChild(h('p', h('a', {href: '#' + msg.key}, '%' + msg.value.content.name))) | |
134 | - } else { | |
135 | - message.appendChild(h('p', h('a', {href: '#' + msg.key}, msg.key))) | |
136 | - } | |
132 | + | |
133 | + var reponame = h('p', 'git-ssb repo ', h('a', {href: '#' + msg.key}, msg.key)) | |
134 | + | |
135 | + message.appendChild(reponame) | |
136 | + | |
137 | + ssbAvatar(sbot, id, msg.key, function (err, data) { | |
138 | + if (data) | |
139 | + var actualname = h('p', 'git-ssb repo ', h('a', {href: '#' + msg.key}, '%' + data.name)) | |
140 | + reponame.parentNode.replaceChild(actualname, reponame) | |
141 | + }) | |
142 | + | |
137 | 143 | var cloneurl = h('pre', 'git clone ssb://' + msg.key) |
138 | 144 | message.appendChild(cloneurl) |
139 | - //message.appendChild(h('pre', tools.rawJSON(msg.value.content))) | |
140 | 145 | return message |
141 | 146 | } |
142 | 147 | |
143 | 148 | else if (msg.value.content.type == 'wiki') { |
Built with git-ssb-web