Style git messages better

This commit is contained in:
Anders Rune Jensen
2017-05-12 13:38:48 +02:00
parent 1b057d84aa
commit bff02dfad0
2 changed files with 25 additions and 6 deletions
+18
View File
@@ -107,6 +107,7 @@ exports.init = function (sbot, config) {
paramap(addAuthorAbout, 8), paramap(addAuthorAbout, 8),
paramap(addFollowAbout, 8), paramap(addFollowAbout, 8),
paramap(addVoteMessage, 8), paramap(addVoteMessage, 8),
paramap(addGitLinks, 8),
pull(renderThread(defaultOpts), wrapPage(about.name)), pull(renderThread(defaultOpts), wrapPage(about.name)),
toPull(res, function (err) { toPull(res, function (err) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
@@ -296,6 +297,23 @@ exports.init = function (sbot, config) {
cb(null, msg) cb(null, msg)
}) })
} }
function addGitLinks(msg, cb) {
if (msg.value.content.type == 'git-update')
getMsg(msg.value.content.repo, function (err, gitRepo) {
if (gitRepo)
msg.value.content.repoName = gitRepo.value.content.name
cb(null, msg)
})
else if (msg.value.content.type == 'issue')
getMsg(msg.value.content.project, function (err, gitRepo) {
if (gitRepo)
msg.value.content.repoName = gitRepo.value.content.name
cb(null, msg)
})
else
cb(null, msg)
}
} }
function serveBlob(req, res, sbot, id) { function serveBlob(req, res, sbot, id) {
+7 -6
View File
@@ -389,15 +389,16 @@ function render(opts, c) {
} }
else if (c.type == "issue") { else if (c.type == "issue") {
return '<span class="status">' + return '<span class="status">' +
"Created a git issue" + "Created a git issue" + (c.repoName != undefined ? " in repo " + c.repoName : "") + renderPost(opts, c) +
'</span>' + '</span>';
renderDefault(c); //renderDefault(c);
} }
else if (c.type == "git-update") { else if (c.type == "git-update") {
return '<span class="status">' + return '<span class="status">' +
"Did a git update" + "Did a git update " + (c.repoName != undefined ? " in repo " + c.repoName : "") +
'</span>' + "<br/>" +
renderDefault(c); (c.commits != undefined ? c.commits.map(com => { return "-" +com.title; }).join("<br/>") : "") +
'</span>'
} }
else if (c.type == "ssb-dns") { else if (c.type == "ssb-dns") {
return '<span class="status">' + return '<span class="status">' +