Commit bcc4c3555e43a5f9cb02b98de559a806dce9b933
Render comments on issues & pull requests in feed
Charles Lehner committed on 4/21/2016, 2:33:01 AMParent: c161479ab3878dc4ae4819e8b18b35cbfc4cf003
Files changed
index.js | changed |
locale/en.json | changed |
locale/eo.json | changed |
index.js | ||
---|---|---|
@@ -848,9 +848,11 @@ | ||
848 | 848 | } |
849 | 849 | return pull( |
850 | 850 | feedId ? ssb.createUserStream(opts) : ssb.createFeedStream(opts), |
851 | 851 | pull.filter(function (msg) { |
852 | - return msg.value.content.type in msgTypes | |
852 | + var c = msg.value.content | |
853 | + return c.type in msgTypes | |
854 | + || (c.type == 'post' && c.repo && c.issue) | |
853 | 855 | }), |
854 | 856 | typeof filter == 'function' ? filter(opts) : filter, |
855 | 857 | pull.take(20), |
856 | 858 | addAuthorName(about), |
@@ -959,8 +961,21 @@ | ||
959 | 961 | author: authorLink, |
960 | 962 | target: '<tt>' + escapeHTML(c.about) + '</tt>', |
961 | 963 | name: link([c.about], c.name) |
962 | 964 | }) + '</section>') |
965 | + case 'post': | |
966 | + return pullReqs.get(c.issue, function (err, pr) { | |
967 | + if (err) return cb(err) | |
968 | + var type = pr.msg.value.content.type == 'pull-request' ? | |
969 | + 'pull request' : 'issue.' | |
970 | + return cb(null, '<section class="collapse">' + msgLink + '<br>' + | |
971 | + req._t('CommentedOn', { | |
972 | + author: authorLink, | |
973 | + target: req._t(type) + ' ' + link([pr.id], pr.title, true) | |
974 | + }) + | |
975 | + '<blockquote>' + markdown(c.text) + '</blockquote>' + | |
976 | + '</section>') | |
977 | + }) | |
963 | 978 | default: |
964 | 979 | return cb(null, json(msg)) |
965 | 980 | } |
966 | 981 | } |
locale/en.json | ||
---|---|---|
@@ -27,8 +27,9 @@ | ||
27 | 27 | "CreatedRepo": "%{name} created repo %{repo}", |
28 | 28 | "Pushed": "%{name} pushed to %{repo}", |
29 | 29 | "OpenedIssue": "%{name} opened %{type} %{title} on %{project}", |
30 | 30 | "Named": "%{author} named %{target} %{name}", |
31 | + "CommentedOn": "%{author} commented on %{target}", | |
31 | 32 | "Activity": "Activity", |
32 | 33 | "Repos": "Repos", |
33 | 34 | "UpdatedOnDate": "Updated %{date}", |
34 | 35 | "CreatedOnDate": "Created %{date}", |
locale/eo.json | ||
---|---|---|
@@ -27,8 +27,9 @@ | ||
27 | 27 | "CreatedRepo": "%{name} kreis deponejon %{repo}", |
28 | 28 | "Pushed": "%{name} puŝis al %{repo}", |
29 | 29 | "OpenedIssue": "%{name} malfermiĝis %{type} %{title} sur %{project}", |
30 | 30 | "Named": "%{author} nomis %{target} %{name}", |
31 | + "CommentedOn": "%{author} komentis %{target}", | |
31 | 32 | "Activity": "Aktivaĵo", |
32 | 33 | "Repos": "Deponejoj", |
33 | 34 | "UpdatedOnDate": "Ĝisdatigis je %{date}", |
34 | 35 | "CreatedOnDate": "Kreis je %{date}", |
Built with git-ssb-web