git ssb

30+

cel / git-ssb-web



Commit ea333278df31de123808813a031b904b32dab41f

Show list of repos user dug

Fix %Q/K1p5oaaZvIAMVynzpcQFUp0vIdlZT1B9baTRnOGiE=.sha256
Charles Lehner committed on 4/26/2016, 8:57:28 PM
Parent: 2324d21c2b5a2390f8620efc18d98402e2474ee6

Files changed

lib/users.jschanged
lib/util.jschanged
locale/en.jsonchanged
locale/eo.jsonchanged
lib/users.jsView
@@ -21,8 +21,10 @@
2121 case 'activity':
2222 return this.serveUserActivity(req, feedId)
2323 case 'repos':
2424 return this.serveUserRepos(req, feedId)
25 + case 'digs':
26 + return this.serveUserDigs(req, feedId)
2527 }
2628 }
2729
2830 U.renderUserPage = function (req, feedId, page, titleTemplate, body) {
@@ -37,9 +39,10 @@
3739 pull.once('<h2>' + u.link([feedId], name) +
3840 '<code class="user-id">' + feedId + '</code></h2>' +
3941 u.nav([
4042 [[feedId], req._t('Activity'), 'activity'],
41- [[feedId, 'repos'], req._t('Repos'), 'repos']
43 + [[feedId, 'repos'], req._t('Repos'), 'repos'],
44 + [[feedId, 'digs'], req._t('ReposDug'), 'digs'],
4245 ], page)),
4346 body
4447 ])))
4548 })
@@ -96,4 +99,47 @@
9699 })
97100 }, 8)
98101 ))
99102 }
103 +
104 +U.serveUserDigs = function (req, feedId) {
105 + var self = this
106 + var title = req._t('UsersReposDug', {name: '%{name}'})
107 + return self.renderUserPage(req, feedId, 'digs', title, pull(
108 + self.web.ssb.links({
109 + source: feedId,
110 + rel: 'vote',
111 + dest: '%',
112 + reverse: true,
113 + values: true
114 + }),
115 + pull.unique('dest'),
116 + u.sortMsgs(true),
117 + paramap(function (link, cb) {
118 + self.web.getMsg(link.dest, function (err, destMsg) {
119 + if (err) return cb(err)
120 + if (destMsg.content.type != 'git-repo') return cb()
121 + var vote = link.value.content && link.value.content.vote
122 + if (!(vote && vote.value > 0)) return cb()
123 + var repoId = link.dest
124 + var repoAuthor = destMsg.author
125 + var done = multicb({ pluck: 1, spread: true })
126 + self.web.getRepoName(repoAuthor, repoId, done())
127 + self.web.about.getName(repoAuthor, done())
128 + done(function (err, repoName, authorName) {
129 + var authorLink = u.link([repoAuthor], authorName)
130 + var repoLink = u.link([repoId], repoName)
131 + if (err) return cb(err)
132 + cb(null, '<section class="collapse">' +
133 + '<strong class="bgslash">' +
134 + authorLink + ' / ' + repoLink + '</strong>' +
135 + '<div class="date-info">' +
136 + req._t('DugOnDate', {
137 + date: u.timestamp(link.value.timestamp, req)
138 + }) + '</div>' +
139 + '</section>')
140 + })
141 + })
142 + }, 12),
143 + pull.filter()
144 + ))
145 +}
lib/util.jsView
@@ -131,19 +131,20 @@
131131 function compareMsgs(a, b) {
132132 return (a.value.timestamp - b.value.timestamp) || (a.key - b.key)
133133 }
134134
135-u.pullSort = function (comparator) {
135 +u.pullSort = function (comparator, descending) {
136136 return function (read) {
137137 return u.readNext(function (cb) {
138138 pull(read, pull.collect(function (err, items) {
139139 if (err) return cb(err)
140140 items.sort(comparator)
141 + if (descending) items.reverse()
141142 cb(null, pull.values(items))
142143 }))
143144 })
144145 }
145146 }
146147
147-u.sortMsgs = function () {
148- return u.pullSort(compareMsgs)
148 +u.sortMsgs = function (descending) {
149 + return u.pullSort(compareMsgs, descending)
149150 }
locale/en.jsonView
@@ -32,11 +32,14 @@
3232 "Named": "%{author} named %{target} %{name}",
3333 "CommentedOn": "%{name} commented on %{type} %{title}",
3434 "Activity": "Activity",
3535 "Repos": "Repos",
36 + "ReposDug": "Repos dug",
3637 "UsersRepos": "%{name}'s repos",
38 + "UsersReposDug": "Repos dug by %{name}",
3739 "UpdatedOnDate": "Updated %{date}",
3840 "CreatedOnDate": "Created %{date}",
41 + "DugOnDate": "Dug %{date}",
3942 "Dig": "Dig",
4043 "Undig": "Undig",
4144 "Fork": "Fork",
4245 "Forks": "Forks",
locale/eo.jsonView
@@ -32,11 +32,14 @@
3232 "Named": "%{author} nomis %{target} %{name}",
3333 "CommentedOn": "%{name} komentis %{type} %{title}",
3434 "Activity": "Aktivaĵo",
3535 "Repos": "Deponejoj",
36 + "ReposDug": "Deponejoj dig-itaj",
3637 "UsersRepos": "Deponejoj de %{name}",
38 + "UsersReposDug": "Deponejoj dig-itaj de %{name}",
3739 "UpdatedOnDate": "Ĝisdatigis je %{date}",
3840 "CreatedOnDate": "Kreis je %{date}",
41 + "DugOnDate": "Dig-adi %{date}",
3942 "Dig": "Digi",
4043 "Undig": "Maldigi",
4144 "Fork": "Forki",
4245 "Forks": "Forkoj",

Built with git-ssb-web