Commit d96c42c6804052c6ea48b6833b6d8b110d3baad8
Hide npm-publish author if it is same as message author
cel committed on 6/18/2017, 6:29:27 PMParent: 92f0421665adb2185d90062cf58393742112c5bb
Files changed
lib/render-msg.js | changed |
lib/render-msg.js | ||
---|---|---|
@@ -861,8 +861,18 @@ | ||
861 | 861 … | if (!readme || readme === 'ERROR: No README data found!') return |
862 | 862 … | return u.ifString(readme) |
863 | 863 … | } |
864 | 864 … | |
865 … | +function singleValue(obj) { | |
866 … | + if (!obj || typeof obj !== 'object') return obj | |
867 … | + var keys = Object.keys(obj) | |
868 … | + if (keys.length === 1) return obj[keys[0]] | |
869 … | +} | |
870 … | + | |
871 … | +function ifDifferent(obj, value) { | |
872 … | + if (singleValue(obj) !== value) return obj | |
873 … | +} | |
874 … | + | |
865 | 875 … | RenderMsg.prototype.npmPublish = function (cb) { |
866 | 876 … | var self = this |
867 | 877 … | var render = self.render |
868 | 878 … | var pkg = self.c.meta || {} |
@@ -897,9 +907,9 @@ | ||
897 | 907 … | h('blockquote', {innerHTML: render.markdown(pkgReadme)}) : '', |
898 | 908 … | versions.map(function (version, i) { |
899 | 909 … | var release = pkg.versions[version] || {} |
900 | 910 … | var license = u.ifString(release.license) |
901 | - var author = release.author | |
911 … | + var author = ifDifferent(release.author, self.msg.value.author) | |
902 | 912 … | var description = u.ifString(release.description) |
903 | 913 … | var readme = asNpmReadme(release.readme) |
904 | 914 … | var keywords = u.toArray(release.keywords).map(u.ifString) |
905 | 915 … | var dist = release.dist || {} |
Built with git-ssb-web