git ssb

10+

Matt McKegg / patchwork



Commit e1c938e079d739f9e8511262531b1d04e30effab

Merge branch 'master' of https://github.com/ssbc/patchwork into channel-list-mask

Matthew Roseman committed on 4/3/2018, 10:21:46 PM
Parent: 8bafac31ed8088c572b22263835ef43e71ffc34e
Parent: 9de99ae493db260032c0423eedf4a3aa6f5d714f

Files changed

README.mdchanged
modules/app/html/search.jschanged
modules/channel/html/preview.jschanged
modules/channel/obs/suggest.jschanged
modules/page/html/render/channels.jschanged
modules/page/html/render/message.jschanged
modules/page/html/render/public.jschanged
modules/sheet/profiles.jschanged
overrides/patchcore/message/html/action/reply.jschanged
package-lock.jsonchanged
package.jsonchanged
contributing.mdadded
README.mdView
@@ -93,8 +93,12 @@
9393 ## Code of conduct
9494
9595 Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms.
9696
97+## Contributing
98+
99+Please read the [Patchwork Contribution Guidelines](contributing.md) before opening a pull request.
100+
97101 ## Docs
98102
99103 - [scuttlebutt.nz](https://www.scuttlebutt.nz)
100104 - [scuttlebot.io](https://scuttlebot.io)
modules/app/html/search.jsView
@@ -49,9 +49,9 @@
4949 function doSearch () {
5050 var value = searchBox.value.trim()
5151 if (value.startsWith('/') || value.startsWith('?') || value.startsWith('@') || value.startsWith('#') || value.startsWith('%')) {
5252 if (value.startsWith('@') && value.length < 30) {
53- // probably not a key
53+ // probably not a key
5454 } else if (value.length > 2) {
5555 setView(value)
5656 }
5757 } else if (value.trim()) {
modules/channel/html/preview.jsView
@@ -1,7 +1,6 @@
11 var nest = require('depnest')
22 var h = require('mutant/h')
3-var map = require('mutant/map')
43 var when = require('mutant/when')
54 var computed = require('mutant/computed')
65 var send = require('mutant/send')
76
modules/channel/obs/suggest.jsView
@@ -75,5 +75,5 @@
7575 }
7676
7777 function matches (text, startsWith) {
7878 return text.slice(0, startsWith.length).localeCompare(startsWith, 'default', {sensitivity: 'base'}) === 0
79-}
79+}
modules/page/html/render/channels.jsView
@@ -1,6 +1,6 @@
11 var nest = require('depnest')
2-var { h, send, when, computed, map } = require('mutant')
2+var { h, when, computed, map } = require('mutant')
33
44 exports.needs = nest({
55 'message.async.publish': 'first',
66 'keys.sync.id': 'first',
@@ -13,9 +13,8 @@
1313
1414 exports.gives = nest('page.html.render')
1515
1616 exports.create = function (api) {
17- const i18n = api.intl.sync.i18n
1817 return nest('page.html.render', function page (path) {
1918 if (path !== '/channels') return
2019
2120 var id = api.keys.sync.id()
@@ -41,22 +40,6 @@
4140 ])
4241 }, {maxTime: 5, idle: true})
4342 ])
4443 ])
45-
46- function subscribe (id) {
47- api.message.async.publish({
48- type: 'channel',
49- channel: id,
50- subscribed: true
51- })
52- }
53-
54- function unsubscribe (id) {
55- api.message.async.publish({
56- type: 'channel',
57- channel: id,
58- subscribed: false
59- })
60- }
6144 })
6245 }
modules/page/html/render/message.jsView
@@ -68,9 +68,8 @@
6868
6969 // what happens in private stays in private!
7070 meta.recps.set(value.content.recps)
7171
72- var author = value.author
7372 var root = api.message.sync.root({key: id, value}) || id
7473 var isReply = id !== root
7574 var thread = api.feed.obs.thread(id, {branch: isReply})
7675
modules/page/html/render/public.jsView
@@ -267,9 +267,9 @@
267267 function noVisibleNewPostsWarning () {
268268 const explanation = i18n('You may not be able to see new content until you follow some users or pubs.')
269269
270270 const shownWhen = computed([loading, contact.isNotFollowingAnybody],
271- (isLoading, isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody
271+ (isLoading, isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody
272272 )
273273
274274 return api.feed.html.followWarning(shownWhen, explanation)
275275 }
@@ -283,31 +283,15 @@
283283 // should be sufficient to get the user to join a pub. However, pubs have been buggy and not followed back on occassion.
284284 // Additionally, someone onboarded on a local network might follow someone on the network, but not be followed back by
285285 // them, so we begin to show this warning if the user has followed someone, but has no followers.
286286 const shownWhen = computed([loading, contact.hasNoFollowers, contact.isNotFollowingAnybody],
287- (isLoading, hasNoFollowers, isNotFollowingAnybody) =>
288- !isLoading && (hasNoFollowers && !isNotFollowingAnybody)
287+ (isLoading, hasNoFollowers, isNotFollowingAnybody) =>
288+ !isLoading && (hasNoFollowers && !isNotFollowingAnybody)
289289 )
290290
291291 return api.feed.html.followerWarning(shownWhen, explanation)
292292 }
293293
294- function subscribe (id) {
295- api.message.async.publish({
296- type: 'channel',
297- channel: id,
298- subscribed: true
299- })
300- }
301-
302- function unsubscribe (id) {
303- api.message.async.publish({
304- type: 'channel',
305- channel: id,
306- subscribed: false
307- })
308- }
309-
310294 function disconnect (id) {
311295 onceTrue(api.sbot.obs.connection, (sbot) => {
312296 sbot.patchwork.disconnect(id)
313297 })
modules/sheet/profiles.jsView
@@ -1,5 +1,5 @@
1-var {h, when, map, computed, Value, lookup} = require('mutant')
1+var {h, map, computed, Value, lookup} = require('mutant')
22 var nest = require('depnest')
33 var catchLinks = require('../../lib/catch-links')
44
55 exports.needs = nest({
@@ -78,9 +78,8 @@
7878 })
7979 })
8080
8181 function renderContactBlock (profiles) {
82- var yourId = api.keys.sync.id()
8382 profiles = api.profile.obs.rank(profiles)
8483 return [
8584 h('div', {
8685 classList: 'ProfileList'
overrides/patchcore/message/html/action/reply.jsView
@@ -19,9 +19,9 @@
1919
2020 function handleEvent (ev) {
2121 var {api, msg} = this
2222 var el = getMessageElement(ev.target)
23-
23+
2424 // HACK: if this is the last message in the list, reply to the root message
2525 if (el && !el.nextElementSibling) {
2626 api.app.navigate(api.message.sync.root(msg), 'reply')
2727 ev.preventDefault()
@@ -34,5 +34,5 @@
3434 return el
3535 }
3636 el = el.parentNode
3737 }
38-}
38+}
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 245531 bytes
New file size: 291054 bytes
package.jsonView
@@ -73,16 +73,17 @@
7373 "ssb-private": "0.1.4",
7474 "ssb-query": "^1.0.0",
7575 "ssb-ref": "^2.9.0",
7676 "ssb-sort": "^1.0.0",
77+ "standard": "^11.0.1",
7778 "statistics": "^3.3.0",
7879 "stream-to-pull-stream": "^1.7.2",
7980 "suggest-box": "^2.2.3",
8081 "text-node-searcher": "^1.1.1",
8182 "xtend": "^4.0.1"
8283 },
8384 "devDependencies": {
8485 "colors": "^1.1.2",
85- "electron": "~1.8.2",
86+ "electron": "~1.8.4",
8687 "node-gyp": "^3.6.2"
8788 }
8889 }
contributing.mdView
@@ -1,0 +1,17 @@
1+# Patchwork Contribution Guidelines
2+
3+Maintained by @mmckegg
4+
5+## Please ensure all submitted code conforms to [JavaScript Standard Style](https://standardjs.com/)
6+
7+You can run `npm test` or `npx standard` to run the linter. A lot of small issues can be automatically fixed using `npx standard --fix`.
8+
9+## Feel free to use [depject](https://github.com/depject/depject) inside of the Patchwork repo, but please don't merge in depject modules from other packages.
10+
11+[patchcore](https://github.com/ssbc/patchcore) and [patch-settings](https://github.com/mixmix/patch-settings) are the only external packages that [merge in depject modules](https://github.com/ssbc/patchwork/blob/master/main-window.js#L23) (and that is because of legacy reasons). Please don't treat this as best practice.
12+
13+I recommend doing as much as possible in the Patchwork repo rather than splitting into a bunch of modules. This makes it much easier to maintain and update the overall application. Only split things into modules that are clearly reusable components (algorithms, widgets, indexes) and use `require` to include them.
14+
15+_Originally depject was included in Patchwork to ease plugin creation, but I have realised since that this was not the best approach. When used across packages, it tends to create confusing hard to maintain APIs._
16+
17+**Please consider depject deprecated in Patchwork!** It will be replaced with something else in the near future, and I want to keep as much of it contained in the main patchwork repo to assist with migration.

Built with git-ssb-web