git ssb

30+

cel / git-ssb-web



Commit 055aafda8233152dfc42bdd8daf083be8c415c77

optmz: indexed user repo reads

noffle committed on 5/12/2018, 4:48:22 AM
Parent: f2a29c8443af6d8b2826e9119cc208e19479f015

Files changed

lib/users.jschanged
lib/users.jsView
@@ -60,22 +60,41 @@
6060
6161 U.serveUserRepos = function (req, feedId) {
6262 var self = this
6363 var title = req._t('UsersRepos', {name: '%{name}'})
64- return self.renderUserPage(req, feedId, 'repos', title, pull(
65- cat([
66- self.web.ssb.messagesByType({
67- type: 'git-update',
68- reverse: true
64 +
65 + // use git index, if present
66 + var source
67 + if (self.web.ssb.git) {
68 + source = pull(
69 + self.web.ssb.git.author({
70 + lt: '9999999999999',
71 + values: true,
72 + reverse: true,
73 + id: feedId
6974 }),
70- self.web.ssb.messagesByType({
71- type: 'git-repo',
72- reverse: true
75 + pull.map(function (msg) { return msg.value }),
76 + )
77 + } else {
78 + source = pull(
79 + cat([
80 + self.web.ssb.messagesByType({
81 + type: 'git-update',
82 + reverse: true
83 + }),
84 + self.web.ssb.messagesByType({
85 + type: 'git-repo',
86 + reverse: true
87 + })
88 + ]),
89 + pull.filter(function (msg) {
90 + return msg.value.author == feedId
7391 })
74- ]),
75- pull.filter(function (msg) {
76- return msg.value.author == feedId
77- }),
92 + )
93 + }
94 +
95 + return self.renderUserPage(req, feedId, 'repos', title, pull(
96 + source,
7897 pull.unique(function (msg) {
7998 return msg.value.content.repo || msg.key
8099 }),
81100 paramap(function (msg, cb) {

Built with git-ssb-web