git ssb

16+

cel / patchfoo



Commit d96c42c6804052c6ea48b6833b6d8b110d3baad8

Hide npm-publish author if it is same as message author

cel committed on 6/18/2017, 6:29:27 PM
Parent: 92f0421665adb2185d90062cf58393742112c5bb

Files changed

lib/render-msg.jschanged
lib/render-msg.jsView
@@ -861,8 +861,18 @@
861861 if (!readme || readme === 'ERROR: No README data found!') return
862862 return u.ifString(readme)
863863 }
864864
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 +
865875 RenderMsg.prototype.npmPublish = function (cb) {
866876 var self = this
867877 var render = self.render
868878 var pkg = self.c.meta || {}
@@ -897,9 +907,9 @@
897907 h('blockquote', {innerHTML: render.markdown(pkgReadme)}) : '',
898908 versions.map(function (version, i) {
899909 var release = pkg.versions[version] || {}
900910 var license = u.ifString(release.license)
901- var author = release.author
911 + var author = ifDifferent(release.author, self.msg.value.author)
902912 var description = u.ifString(release.description)
903913 var readme = asNpmReadme(release.readme)
904914 var keywords = u.toArray(release.keywords).map(u.ifString)
905915 var dist = release.dist || {}

Built with git-ssb-web