Commit 2515885506eef29d56ab8b1c94a9ebc9e15483aa
Revert "Use links instead of log to render feed"
This reverts commit 37ce8bccebec917257a650d3328c37f3dbd6cff7. but keep the limit of 20 entriesCharles Lehner committed on 2/28/2016, 7:37:53 PM
Parent: 93eb7d1f5a8e13d37fb5015a48122af34f5f5f5c
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -196,28 +196,33 @@ | ||
196 | 196 | |
197 | 197 | /* Feed */ |
198 | 198 | |
199 | 199 | function renderFeed(feedId) { |
200 | + var opts = { | |
201 | + reverse: true, | |
202 | + id: feedId | |
203 | + } | |
200 | 204 | 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 | |
206 | 208 | }), |
207 | 209 | 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 | + }) | |
209 | 216 | ) |
210 | 217 | } |
211 | 218 | |
212 | - /* | |
213 | 219 | function renderRepoCreated(msg, cb) { |
214 | 220 | var repoLink = link([msg.key]) |
215 | 221 | var authorLink = link([msg.value.author]) |
216 | 222 | cb(null, '<p>' + timestamp(msg.value.timestamp) + '<br>' + |
217 | 223 | authorLink + ' created repo ' + repoLink + '</p>') |
218 | 224 | } |
219 | - */ | |
220 | 225 | |
221 | 226 | function renderUpdate(msg, cb) { |
222 | 227 | about.getName(msg.value.author, function (err, name) { |
223 | 228 | if (err) return cb(err) |
Built with git-ssb-web