Commit 37ce8bccebec917257a650d3328c37f3dbd6cff7
Use links instead of log to render feed
Charles Lehner committed on 2/28/2016, 4:41:15 AMParent: 88eec92c154cb3894b4a853ba05d69069267687a
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -186,33 +186,28 @@ | ||
186 | 186 | |
187 | 187 | /* Feed */ |
188 | 188 | |
189 | 189 | function renderFeed(feedId) { |
190 | - var opts = { | |
191 | - reverse: true, | |
192 | - id: feedId, | |
193 | - limit: 100, | |
194 | - } | |
195 | 190 | return pull( |
196 | - feedId ? ssb.createUserStream(opts) : ssb.createLogStream(opts), | |
197 | - pull.filter(function (msg) { | |
198 | - return msg.value.content.type in msgTypes | |
191 | + ssb.links({ | |
192 | + reverse: true, | |
193 | + rel: 'repo', | |
194 | + source: feedId, | |
195 | + values: true | |
199 | 196 | }), |
200 | - pull.asyncMap(function (msg, cb) { | |
201 | - switch (msg.value.content.type) { | |
202 | - case 'git-repo': return renderRepoCreated(msg, cb) | |
203 | - case 'git-update': return renderUpdate(msg, cb) | |
204 | - } | |
205 | - }) | |
197 | + pull.take(20), | |
198 | + pull.asyncMap(renderUpdate) | |
206 | 199 | ) |
207 | 200 | } |
208 | 201 | |
202 | + /* | |
209 | 203 | function renderRepoCreated(msg, cb) { |
210 | 204 | var repoLink = link([msg.key]) |
211 | 205 | var authorLink = link([msg.value.author]) |
212 | 206 | cb(null, '<p>' + timestamp(msg.value.timestamp) + '<br>' + |
213 | 207 | authorLink + ' created repo ' + repoLink + '</p>') |
214 | 208 | } |
209 | + */ | |
215 | 210 | |
216 | 211 | function renderUpdate(msg, cb) { |
217 | 212 | about.getName(msg.value.author, function (err, name) { |
218 | 213 | if (err) return cb(err) |
Built with git-ssb-web