git ssb

30+

cel / git-ssb-web



Commit 4292d046964c377943c7a3a4f0015c183315fb36

Indicate private updates

cel committed on 1/17/2017, 2:53:03 AM
Parent: 8df9a55e12e25a2e55af110f3c01603e65aa3c47

Files changed

index.jschanged
lib/repos/index.jschanged
lib/util.jschanged
index.jsView
@@ -576,8 +576,9 @@
576576 var msgDate = moment(new Date(msg.value.timestamp)).fromNow()
577577 var msgDateLink = u.link([msg.key], msgDate, false, 'class="date"')
578578 var author = msg.value.author
579579 var authorLink = u.link([msg.value.author], msg.authorName)
580 + var privateIconMaybe = msg.value.private ? ' ' + u.privateIcon(req) : ''
580581 switch (c.type) {
581582 case 'git-repo':
582583 var done = multicb({ pluck: 1, spread: true })
583584 self.getRepoName(author, msg.key, done())
@@ -590,9 +591,9 @@
590591 req._t('Forked', {
591592 name: authorLink,
592593 upstream: u.link([c.upstream], upstreamName),
593594 repo: u.link([msg.key], repoName)
594- }) + ' ' + msgDateLink + '</section>')
595 + }) + ' ' + msgDateLink + privateIconMaybe + '</section>')
595596 })
596597 })
597598 } else {
598599 return done(function (err, repoName) {
@@ -601,9 +602,9 @@
601602 cb(null, '<section class="collapse">' +
602603 req._t('CreatedRepo', {
603604 name: authorLink,
604605 repo: repoLink
605- }) + ' ' + msgDateLink +
606 + }) + ' ' + msgDateLink + privateIconMaybe +
606607 (msg.value.private ?
607608 '<br>' + req._t('repo.Recipients') + '<ul>' +
608609 (Array.isArray(c.recps) ? c.recps : []).map(function (feed) {
609610 return '<li>' + u.link([feed], feed) + '</li>'
@@ -619,9 +620,9 @@
619620 cb(null, '<section class="collapse">' +
620621 req._t('Pushed', {
621622 name: authorLink,
622623 repo: repoLink
623- }) + ' ' + msgDateLink + '</section>')
624 + }) + ' ' + msgDateLink + privateIconMaybe + '</section>')
624625 })
625626 case 'issue':
626627 case 'pull-request':
627628 var issueLink = u.link([msg.key], u.messageTitle(msg))
@@ -638,18 +639,18 @@
638639 type: req._t(c.type == 'pull-request' ?
639640 'pull request' : 'issue.'),
640641 title: issueLink,
641642 project: repoLink
642- }) + ' ' + msgDateLink + '</section>')
643 + }) + ' ' + msgDateLink + privateIconMaybe + '</section>')
643644 })
644645 })
645646 case 'about':
646647 return cb(null, '<section class="collapse">' +
647648 req._t('Named', {
648649 author: authorLink,
649650 target: '<tt>' + u.escape(c.about) + '</tt>',
650651 name: u.link([c.about], c.name)
651- }) + ' ' + msgDateLink + '</section>')
652 + }) + ' ' + msgDateLink + privateIconMaybe + '</section>')
652653 case 'post':
653654 return this.pullReqs.get(c.issue, function (err, pr) {
654655 if (err) return cb(err)
655656 var type = pr.msg.value.content.type == 'pull-request' ?
@@ -660,9 +661,9 @@
660661 changed ? 'ReopenedIssue' : 'ClosedIssue', {
661662 name: authorLink,
662663 type: req._t(type),
663664 title: u.link([pr.id], pr.title, true)
664- }) + ' ' + msgDateLink +
665 + }) + ' ' + msgDateLink + privateIconMaybe +
665666 (c.text ? '<blockquote>' + markdown(c.text) + '</blockquote>' : '') +
666667 '</section>')
667668 })
668669 default:
lib/repos/index.jsView
@@ -159,12 +159,8 @@
159159 '<pre>' + u.escape(err.stack) + '</pre>'
160160 ]))
161161 }
162162
163-function privateIcon(req) {
164- return `<img src="/emoji/lock.png" height="16" width="16" alt="${req._t('repo.Private')}" title="${req._t('repo.RepoIsPrivate')}">`
165-}
166-
167163 R.serveRepoTemplate = function (req, repo, page, branch, titleTemplate, body) {
168164 var self = this
169165 var gitUrl = 'ssb://' + repo.id
170166 var host = req.headers.host || '127.0.0.1:7718'
@@ -237,9 +233,9 @@
237233 ])
238234 )
239235 ]),
240236 forms.name(req, isLocal, repo.id, repoName, 'repo-name', null, req._t('repo.Rename'),
241- h('h2', {class: 'bgslash'}, `${u.link([repo.feed], authorName)} / ${u.link([repo.id], repoName)}${repo.private ? ' ' + privateIcon(req) : ''}`)
237 + h('h2', {class: 'bgslash'}, `${u.link([repo.feed], authorName)} / ${u.link([repo.id], repoName)}${repo.private ? ' ' + u.privateIcon(req) : ''}`)
242238 ),
243239 ]),
244240 u.when(repo.upstream, () =>
245241 h('small', {class: 'bgslash'}, req._t('ForkedFrom', {
lib/util.jsView
@@ -235,4 +235,8 @@
235235
236236 u.formatMarkdownTitle = function (title) {
237237 return u.escape(removeMd(title))
238238 }
239 +
240 +u.privateIcon = function (req) {
241 + return `<img src="/emoji/lock.png" height="16" width="16" alt="${req._t('repo.Private')}" title="${req._t('repo.RepoIsPrivate')}">`
242 +}

Built with git-ssb-web