Permalink
Browse files

run `standard --fix` (for new standard version)

  • Loading branch information...
mmckegg committed Oct 7, 2018
1 parent 62a6da3 commit b0d2734c08bfd1daaa1c09d6fc346cca24c9dbef
Showing with 351 additions and 352 deletions.
  1. +1 −1 index.js
  2. +4 −4 lib/context-menu-and-spellcheck.js
  3. +1 −1 lib/get-bump.js
  4. +2 −2 lib/group-summaries.js
  5. +1 −1 lib/latest-update.js
  6. +9 −9 lib/lookup-roots.js
  7. +1 −1 lib/mutant-pull-collection.js
  8. +2 −2 lib/mutant-pull-dict.js
  9. +2 −2 lib/mutant-pull-value.js
  10. +2 −2 lib/pull-resume.js
  11. +1 −1 lib/resolve-abouts.js
  12. +2 −2 lib/thread-summary.js
  13. +5 −5 main-window.js
  14. +1 −1 modules/about/async/latest-values.js
  15. +1 −1 modules/about/html/link.js
  16. +6 −6 modules/about/obs.js
  17. +4 −4 modules/app/html/progress-notifier.js
  18. +1 −1 modules/app/html/search.js
  19. +1 −1 modules/app/sync/external-handler/git.js
  20. +3 −3 modules/backlinks/obs.js
  21. +1 −1 modules/blob/obs/has.js
  22. +1 −1 modules/channel/async/suggest.js
  23. +1 −1 modules/channel/html/link.js
  24. +1 −1 modules/channel/html/preview.js
  25. +3 −3 modules/channel/obs/active.js
  26. +11 −11 modules/channel/obs/recent.js
  27. +1 −1 modules/channel/obs/subscribed.js
  28. +1 −1 modules/channel/obs/subscribers.js
  29. +2 −2 modules/contact/async.js
  30. +5 −5 modules/contact/obs.js
  31. +10 −10 modules/feed/html/meta-summary.js
  32. +4 −4 modules/feed/html/rollup.js
  33. +2 −2 modules/feed/obs/recent.js
  34. +2 −2 modules/feed/obs/thread.js
  35. +1 −1 modules/gathering/sheet/edit.js
  36. +1 −1 modules/intl/sync/i18n.js
  37. +1 −1 modules/invite/dhtAcceptSheet.js
  38. +1 −1 modules/invite/dhtCreateSheet.js
  39. +2 −3 modules/invite/invite.js
  40. +1 −1 modules/invite/sheet.js
  41. +1 −1 modules/message/async/name.js
  42. +2 −2 modules/message/async/publish.js
  43. +2 −2 modules/message/html/actions.js
  44. +2 −2 modules/message/html/compose.js
  45. +5 −5 modules/message/html/layout/default.js
  46. +4 −4 modules/message/html/layout/mini.js
  47. +1 −1 modules/message/html/link.js
  48. +1 −1 modules/message/html/markdown.js
  49. +2 −2 modules/message/html/metas.js
  50. +1 −1 modules/message/html/missing.js
  51. +1 −1 modules/message/html/render/about.js
  52. +3 −3 modules/message/obs/likes.js
  53. +2 −2 modules/message/sheet/preview.js
  54. +1 −1 modules/page/html/render/all.js
  55. +3 −3 modules/page/html/render/channel.js
  56. +1 −1 modules/page/html/render/channels.js
  57. +1 −1 modules/page/html/render/gatherings.js
  58. +1 −1 modules/page/html/render/mentions.js
  59. +6 −6 modules/page/html/render/message.js
  60. +2 −2 modules/page/html/render/private.js
  61. +12 −12 modules/page/html/render/profile.js
  62. +6 −6 modules/page/html/render/public.js
  63. +5 −5 modules/page/html/render/search.js
  64. +6 −6 modules/page/html/render/settings.js
  65. +2 −2 modules/profile/async/avatar.js
  66. +2 −2 modules/profile/async/suggest.js
  67. +2 −2 modules/profile/html/person.js
  68. +3 −3 modules/profile/html/preview.js
  69. +1 −1 modules/profile/obs/rank.js
  70. +1 −1 modules/profile/sheet/edit.js
  71. +1 −1 modules/progress/html/peer.js
  72. +2 −2 modules/progress/obs.js
  73. +2 −2 modules/sbot.js
  74. +2 −2 modules/sheet/display.js
  75. +2 −2 modules/sheet/profiles.js
  76. +1 −1 modules/sheet/tags/renderTaggers.js
  77. +1 −1 modules/sheet/tags/tags.js
  78. +1 −1 modules/tag/html/tag.js
  79. +17 −17 sbot/about.js
  80. +6 −6 sbot/backlinks.js
  81. +15 −15 sbot/channel-feed.js
  82. +2 −2 sbot/channels.js
  83. +7 −7 sbot/gatherings.js
  84. +2 −2 sbot/index.js
  85. +12 −12 sbot/likes.js
  86. +1 −1 sbot/live-backlinks.js
  87. +17 −17 sbot/mentions-feed.js
  88. +6 −6 sbot/network-feed.js
  89. +12 −12 sbot/private-feed.js
  90. +27 −27 sbot/profile.js
  91. +9 −9 sbot/public-feed.js
  92. +4 −4 sbot/recent-feeds.js
  93. +7 −7 sbot/roots.js
  94. +3 −3 sbot/search.js
  95. +2 −2 sbot/subscriptions.js
  96. +3 −3 sbot/subscriptions2.js
  97. +2 −2 sbot/thread.js
  98. +1 −1 styles/index.js
@@ -120,7 +120,7 @@ electron.app.on('ready', () => {
electron.ipcMain.on('open-background-devtools', function (ev, config) {
if (windows.background) {
windows.background.webContents.openDevTools({mode: 'detach'})
windows.background.webContents.openDevTools({ mode: 'detach' })
}
})
})
@@ -1,12 +1,12 @@
var {remote, shell, clipboard, ipcRenderer} = require('electron')
var {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker')
var {MenuItem, Menu} = remote
var { remote, shell, clipboard, ipcRenderer } = require('electron')
var { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } = require('electron-spellchecker')
var { MenuItem, Menu } = remote
var ref = require('ssb-ref')
var navigateHandler = null
module.exports = setupContextMenuAndSpellCheck
function setupContextMenuAndSpellCheck (config, {navigate, get}) {
function setupContextMenuAndSpellCheck (config, { navigate, get }) {
navigateHandler = navigate
window.spellCheckHandler = new SpellCheckHandler()
window.spellCheckHandler.attachToInput()
@@ -4,7 +4,7 @@ module.exports = function (msg, bumpFilter) {
if (bumpFilter) {
var bump = typeof bumpFilter === 'function' ? bumpFilter(msg) : bumpFilter
if (bump) {
if (typeof bump === 'string') bump = {type: bump}
if (typeof bump === 'string') bump = { type: bump }
return extend({
id: msg.key,
author: msg.value.author
@@ -1,7 +1,7 @@
var pull = require('pull-stream')
var metaSummaryTypes = ['about', 'channel', 'contact']
module.exports = function GroupSummaries ({windowSize, ungroupFilter, getPriority}) {
module.exports = function GroupSummaries ({ windowSize, ungroupFilter, getPriority }) {
return pull(
GroupUntil((result, msg) => result.length < windowSize || metaSummaryTypes.includes(msg.value.content.type)),
pull.map(function (msgs) {
@@ -12,7 +12,7 @@ module.exports = function GroupSummaries ({windowSize, ungroupFilter, getPriorit
var type = (getPriority && getPriority(msg)) ? 'unreadMetaSummary' : 'metaSummary'
if (metaSummaryTypes.includes(msg.value.content.type) && !msg.totalReplies && (!ungroupFilter || !ungroupFilter(msg))) {
if (!groups[type]) {
groups[type] = {group: type, msgs: []}
groups[type] = { group: type, msgs: [] }
result.push(groups[type])
}
groups[type].msgs.push(msg)
@@ -29,7 +29,7 @@ module.exports = function () {
})
}
})
// You must handle the error here otherwise you get an unhandled error exception which stops the whole app.
req.on('error', function (error) {
console.log('error trying to reach github to check for latest patchwork version: ', error)
@@ -3,22 +3,22 @@ const pull = require('pull-stream')
const getRoot = require('./get-root')
const extend = require('xtend')
module.exports = function LookupRoots ({ssb, cache}) {
module.exports = function LookupRoots ({ ssb, cache }) {
cache = cache || HLRU(100)
return pull.asyncMap((msg, cb) => {
getRootMsg(msg, {ssb, cache}, (_, root) => {
getRootMsg(msg, { ssb, cache }, (_, root) => {
if (root && root.key !== msg.key) {
cb(null, extend(msg, {
rootId: msg.key, root
}))
} else {
cb(null, extend(msg, {rootId: msg.key}))
cb(null, extend(msg, { rootId: msg.key }))
}
})
})
}
function getRootMsg (msg, {ssb, cache, visited}, cb) {
function getRootMsg (msg, { ssb, cache, visited }, cb) {
visited = visited || new Set()
visited.add(msg.key)
@@ -27,25 +27,25 @@ function getRootMsg (msg, {ssb, cache, visited}, cb) {
// we found the root!
return cb(null, msg)
} else {
getThruCache(rootId, {ssb, cache}, (_, root) => {
getThruCache(rootId, { ssb, cache }, (_, root) => {
if (visited.has(root.key)) {
// recursion detected, abort!
return cb(null, msg)
} else {
// go deeper
getRootMsg(root, {ssb, cache, visited}, cb)
getRootMsg(root, { ssb, cache, visited }, cb)
}
})
}
}
function getThruCache (key, {ssb, cache}, cb) {
function getThruCache (key, { ssb, cache }, cb) {
if (cache.has(key)) {
cb(null, cache.get(key))
} else {
// don't do an ooo lookup
ssb.get({id: key, raw: true, private: true}, (_, value) => {
var msg = {key, value}
ssb.get({ id: key, raw: true, private: true }, (_, value) => {
var msg = { key, value }
if (msg.value) {
cache.set(key, msg)
}
@@ -5,7 +5,7 @@ var LazyWatcher = require('mutant/lib/lazy-watcher')
module.exports = createPullCollection
function createPullCollection (getStream, opts) {
var state = {getStream}
var state = { getStream }
var binder = LazyWatcher.call(state, update, listen, unlisten)
binder.value = []
if (opts && opts.nextTick) binder.nextTick = true
@@ -4,8 +4,8 @@ var LazyWatcher = require('mutant/lib/lazy-watcher')
module.exports = createPullDict
function createPullDict (getStream, {nextTick, idle, checkDelete} = {}) {
var state = {getStream, checkDelete}
function createPullDict (getStream, { nextTick, idle, checkDelete } = {}) {
var state = { getStream, checkDelete }
var binder = LazyWatcher.call(state, update, listen, unlisten)
binder.value = {}
if (nextTick) binder.nextTick = true
@@ -4,8 +4,8 @@ var LazyWatcher = require('mutant/lib/lazy-watcher')
module.exports = createPullValue
function createPullValue (getStream, {nextTick, idle, onListen, onUnlisten} = {}) {
var state = {getStream, onListen, onUnlisten}
function createPullValue (getStream, { nextTick, idle, onListen, onUnlisten } = {}) {
var state = { getStream, onListen, onUnlisten }
var binder = LazyWatcher.call(state, update, listen, unlisten)
if (nextTick) binder.nextTick = true
if (idle) binder.idle = true
@@ -4,9 +4,9 @@ const Next = require('pull-next')
const extend = require('xtend')
module.exports = {
source: function (stream, {getResume, limit, filterMap}) {
source: function (stream, { getResume, limit, filterMap }) {
if (limit) {
let marker = {marker: true}
let marker = { marker: true }
let count = 0
return pullCat([
pull(
@@ -2,7 +2,7 @@ const pull = require('pull-stream')
const extend = require('xtend')
var Paramap = require('pull-paramap')
module.exports = function ({ssb}) {
module.exports = function ({ ssb }) {
return pull(
Paramap((msg, cb) => {
var type = msg.value && msg.value.content && msg.value.content.type
@@ -1,12 +1,12 @@
const pull = require('pull-stream')
const getBump = require('./get-bump')
module.exports = function (dest, {recentLimit = 3, bumpFilter, recentFilter, readThread, messageFilter}, cb) {
module.exports = function (dest, { recentLimit = 3, bumpFilter, recentFilter, readThread, messageFilter }, cb) {
var bumps = []
var totalReplies = 0
var latestReplies = []
return pull(
readThread({reverse: true, live: false, dest}),
readThread({ reverse: true, live: false, dest }),
pull.filter(messageFilter || (() => true)),
pull.drain(msg => {
try {
@@ -44,7 +44,7 @@ module.exports = function (config) {
}))
const i18n = api.intl.sync.i18n
setupContextMenuAndSpellCheck(api.config.sync.load(), {navigate, get: api.sbot.async.get})
setupContextMenuAndSpellCheck(api.config.sync.load(), { navigate, get: api.sbot.async.get })
var id = api.keys.sync.id()
var latestUpdate = LatestUpdate()
@@ -112,7 +112,7 @@ module.exports = function (config) {
[i18n('Gatherings'), '/gatherings'],
[i18n('Tags'), `/tags/all/${encodeURIComponent(id)}`],
[i18n('Extended Network'), '/all'],
{separator: true},
{ separator: true },
[i18n('Settings'), '/settings']
])
]),
@@ -130,7 +130,7 @@ module.exports = function (config) {
h('div.info', [
h('a.message -update', { href: 'https://github.com/ssbc/patchwork/releases' }, [
h('strong', ['Patchwork ', latestUpdate, i18n(' has been released.')]), i18n(' Click here to download and view more info!'),
h('a.ignore', {'ev-click': latestUpdate.ignore}, 'X')
h('a.ignore', { 'ev-click': latestUpdate.ignore }, 'X')
])
])
),
@@ -163,7 +163,7 @@ module.exports = function (config) {
navigate('/channels')
}
},
{type: 'separator'}
{ type: 'separator' }
].concat(channels.map(channel => {
return {
label: `#${channel}`,
@@ -236,7 +236,7 @@ module.exports = function (config) {
}
api.sbot.async.get(params, function (err, value) {
if (err) return cb(err)
cb(null, api.app.sync.externalHandler({key: link.link, value, query: link.query}))
cb(null, api.app.sync.externalHandler({ key: link.link, value, query: link.query }))
})
} else if (link && ref.isBlob(link.link)) {
cb(null, function (href) {
@@ -10,7 +10,7 @@ exports.gives = nest('about.async.latestValues')
exports.create = function (api) {
return nest('about.async.latestValues', function (dest, keys, cb) {
onceTrue(api.sbot.obs.connection, sbot => {
sbot.patchwork.about.latestValues({dest, keys}, cb)
sbot.patchwork.about.latestValues({ dest, keys }, cb)
})
})
}
@@ -9,6 +9,6 @@ exports.gives = nest('about.html.link')
exports.create = function (api) {
return nest('about.html.link', function (id, text = null) {
return h('a', {href: id, title: id}, text || ['@', api.about.obs.name(id)])
return h('a', { href: id, title: id }, text || ['@', api.about.obs.name(id)])
})
}
@@ -1,4 +1,4 @@
var {computed} = require('mutant')
var { computed } = require('mutant')
var nest = require('depnest')
var ref = require('ssb-ref')
var colorHash = new (require('color-hash'))()
@@ -57,22 +57,22 @@ exports.create = function (api) {
function valueFrom (id, key, author) {
if (!ref.isLink(id)) throw new Error('About requires an ssb ref!')
return MutantPullValue(() => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.valueFromStream({dest: id, key, id: author}))
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.valueFromStream({ dest: id, key, id: author }))
})
}
function latestValue (id, key) {
if (!ref.isLink(id)) throw new Error('About requires an ssb ref!')
return MutantPullValue(() => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.latestValueStream({dest: id, key}))
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.latestValueStream({ dest: id, key }))
})
}
function socialValue (id, key, defaultValue) {
if (!ref.isLink(id)) throw new Error('About requires an ssb ref!')
if (!socialValueCache[id + '/' + key]) {
var obs = socialValueCache[id + '/' + key] = MutantPullValue(() => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.socialValueStream({dest: id, key}))
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.socialValueStream({ dest: id, key }))
}, {
onListen: () => { socialValueCache[id + '/' + key] = obs },
onUnlisten: () => delete socialValueCache[id + '/' + key]
@@ -84,8 +84,8 @@ exports.create = function (api) {
function socialValues (id, key) {
if (!ref.isLink(id)) throw new Error('About requires an ssb ref!')
return MutantPullDict(() => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.socialValuesStream({dest: id, key}))
}, {checkDelete})
return api.sbot.pull.stream((sbot) => sbot.patchwork.about.socialValuesStream({ dest: id, key }))
}, { checkDelete })
}
function groupedValues (id, key) {
@@ -1,4 +1,4 @@
var {computed, when, h, Value} = require('mutant')
var { computed, when, h, Value } = require('mutant')
var nest = require('depnest')
var sustained = require('../../../lib/sustained')
const pull = require('pull-stream')
@@ -56,11 +56,11 @@ exports.create = function (api) {
h('div.status', [
when(displaying, h('Loading -small', [
when(pendingMigration,
[h('span.info', i18n('Upgrading database')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: migrationProgress })],
[h('span.info', i18n('Upgrading database')), h('progress', { style: { 'margin-left': '10px' }, min: 0, max: 1, value: migrationProgress })],
when(computed(downloadProgress, (v) => v < 1),
[h('span.info', i18n('Downloading new messages')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: downloadProgress })],
[h('span.info', i18n('Downloading new messages')), h('progress', { style: { 'margin-left': '10px' }, min: 0, max: 1, value: downloadProgress })],
when(pending, [
[h('span.info', i18n('Indexing database')), h('progress', { style: {'margin-left': '10px'}, min: 0, max: 1, value: indexProgress })]
[h('span.info', i18n('Indexing database')), h('progress', { style: { 'margin-left': '10px' }, min: 0, max: 1, value: indexProgress })]
], i18n('Scuttling...'))
)
)
@@ -41,7 +41,7 @@ exports.create = function (api) {
} else if (inputText[0] === '/') {
cb(null, getPageSuggestions(inputText))
}
}, {cls: 'SuggestBox'})
}, { cls: 'SuggestBox' })
})
return searchBox
@@ -1,5 +1,5 @@
const nest = require('depnest')
const {shell} = require('electron')
const { shell } = require('electron')
const net = require('net')
exports.gives = nest('app.sync.externalHandler')
@@ -64,7 +64,7 @@ exports.create = function (api) {
function references (msg) {
var id = msg.key
return MutantPullCollection((lastMessage) => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.backlinks.referencesStream({id, since: lastMessage && lastMessage.timestamp}))
return api.sbot.pull.stream((sbot) => sbot.patchwork.backlinks.referencesStream({ id, since: lastMessage && lastMessage.timestamp }))
})
}
@@ -73,7 +73,7 @@ exports.create = function (api) {
var rooted = !!api.message.sync.root(msg)
if (rooted) {
return MutantPullCollection((lastMessage) => {
return api.sbot.pull.stream((sbot) => sbot.patchwork.backlinks.forksStream({id, since: lastMessage && lastMessage.timestamp}))
return api.sbot.pull.stream((sbot) => sbot.patchwork.backlinks.forksStream({ id, since: lastMessage && lastMessage.timestamp }))
})
} else {
return []
@@ -91,7 +91,7 @@ exports.create = function (api) {
onceIdle(() => {
pull(
api.sbot.pull.backlinks({
query: [ {$filter: { dest: id }} ],
query: [ { $filter: { dest: id } } ],
index: 'DTA' // use asserted timestamps
}),
pull.drain((msg) => {
@@ -32,7 +32,7 @@ exports.create = function (api) {
if (!cbs) {
cbs = {}
pull(
StreamWhenConnected(api.sbot.obs.connection, sbot => sbot.blobs.ls({old: false})),
StreamWhenConnected(api.sbot.obs.connection, sbot => sbot.blobs.ls({ old: false })),
pull.drain(blob => {
if (cbs[blob]) {
while (cbs[blob].length) {
@@ -1,5 +1,5 @@
var nest = require('depnest')
var {computed, watch} = require('mutant')
var { computed, watch } = require('mutant')
exports.needs = nest({
'channel.obs.recent': 'first',
@@ -10,6 +10,6 @@ exports.gives = nest('channel.html.link')
exports.create = function (api) {
return nest('channel.html.link', function (channel, text = null) {
var ref = `#${api.channel.sync.normalize(channel)}`
return h('a ChannelLink', {href: ref, title: ref}, text || ref)
return h('a ChannelLink', { href: ref, title: ref }, text || ref)
})
}
@@ -41,7 +41,7 @@ exports.create = function (api) {
h('div.main', [
h('div.title', [
h('h1', [
h('a', {href, 'ev-click': () => api.app.navigate(href)}, [href])
h('a', { href, 'ev-click': () => api.app.navigate(href) }, [href])
]),
h('div.meta', [
api.channel.html.subscribeToggle(channel)
Oops, something went wrong.

0 comments on commit b0d2734

Please sign in to comment.