git ssb

30+

cel / git-ssb-web



Commit 09a90c8c8dd420350b85fbb6d781b88a9786512f

Include pull request head repo in list of forks of base repo

This means that if a pull request is made to merge commits from repo A into
repo B, repo A will subsequently appear in the "compare changes" suggestions
list for repo B
Charles Lehner committed on 7/24/2016, 4:12:03 PM
Parent: df526a703483cc221c20e8b4d0187de4bba7fd15

Files changed

lib/repos/index.jschanged
lib/repos/index.jsView
@@ -862,19 +862,38 @@
862862 R.getForks = function (repo, includeSelf) {
863863 var self = this
864864 return pull(
865865 cat([
866- includeSelf && u.readOnce(function (cb) {
867- self.web.getMsg(repo.id, function (err, value) {
868- cb(err, value && {key: repo.id, value: value})
869- })
870- }),
871- self.web.ssb.links({
872- dest: repo.id,
873- values: true,
874- rel: 'upstream'
866+ includeSelf && pull.once(repo.id),
867+ // get downstream repos
868+ pull(
869+ self.web.ssb.links({
870+ dest: repo.id,
871+ rel: 'upstream'
872+ }),
873+ pull.map('key')
874+ ),
875+ // look for other repos that previously had pull requests to this one
876+ pull(
877+ self.web.ssb.links({
878+ dest: repo.id,
879+ values: true,
880+ rel: 'project'
881+ }),
882+ pull.filter(function (msg) {
883+ var c = msg && msg.value && msg.value.content
884+ return c && c.type == 'pull-request'
885+ }),
886+ pull.map(function (msg) { return msg.value.content.head_repo })
887+ )
888+ ]),
889+ pull.unique(),
890+ paramap(function (key, cb) {
891+ self.web.ssb.get(key, function (err, value) {
892+ if (err) cb(err)
893+ else cb(null, {key: key, value: value})
875894 })
876- ]),
895+ }, 4),
877896 pull.filter(function (msg) {
878897 var c = msg && msg.value && msg.value.content
879898 return c && c.type == 'git-repo'
880899 }),

Built with git-ssb-web