git ssb

30+

cel / git-ssb-web



Commit 2515885506eef29d56ab8b1c94a9ebc9e15483aa

Revert "Use links instead of log to render feed"

This reverts commit 37ce8bccebec917257a650d3328c37f3dbd6cff7.

but keep the limit of 20 entries
Charles Lehner committed on 2/28/2016, 7:37:53 PM
Parent: 93eb7d1f5a8e13d37fb5015a48122af34f5f5f5c

Files changed

index.jschanged
index.jsView
@@ -196,28 +196,33 @@
196196
197197 /* Feed */
198198
199199 function renderFeed(feedId) {
200+ var opts = {
201+ reverse: true,
202+ id: feedId
203+ }
200204 return pull(
201- ssb.links({
202- reverse: true,
203- rel: 'repo',
204- source: feedId,
205- values: true
205+ feedId ? ssb.createUserStream(opts) : ssb.createLogStream(opts),
206+ pull.filter(function (msg) {
207+ return msg.value.content.type in msgTypes
206208 }),
207209 pull.take(20),
208- pull.asyncMap(renderUpdate)
210+ pull.asyncMap(function (msg, cb) {
211+ switch (msg.value.content.type) {
212+ case 'git-repo': return renderRepoCreated(msg, cb)
213+ case 'git-update': return renderUpdate(msg, cb)
214+ }
215+ })
209216 )
210217 }
211218
212- /*
213219 function renderRepoCreated(msg, cb) {
214220 var repoLink = link([msg.key])
215221 var authorLink = link([msg.value.author])
216222 cb(null, '<p>' + timestamp(msg.value.timestamp) + '<br>' +
217223 authorLink + ' created repo ' + repoLink + '</p>')
218224 }
219- */
220225
221226 function renderUpdate(msg, cb) {
222227 about.getName(msg.value.author, function (err, name) {
223228 if (err) return cb(err)

Built with git-ssb-web