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 PMParent: 8bafac31ed8088c572b22263835ef43e71ffc34e
Parent: 9de99ae493db260032c0423eedf4a3aa6f5d714f
Files changed
README.md | changed |
modules/app/html/search.js | changed |
modules/channel/html/preview.js | changed |
modules/channel/obs/suggest.js | changed |
modules/page/html/render/channels.js | changed |
modules/page/html/render/message.js | changed |
modules/page/html/render/public.js | changed |
modules/sheet/profiles.js | changed |
overrides/patchcore/message/html/action/reply.js | changed |
package-lock.json | changed |
package.json | changed |
contributing.md | added |
README.md | ||
---|---|---|
@@ -93,8 +93,12 @@ | ||
93 | 93 | ## Code of conduct |
94 | 94 | |
95 | 95 | 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. |
96 | 96 | |
97 | +## Contributing | |
98 | + | |
99 | +Please read the [Patchwork Contribution Guidelines](contributing.md) before opening a pull request. | |
100 | + | |
97 | 101 | ## Docs |
98 | 102 | |
99 | 103 | - [scuttlebutt.nz](https://www.scuttlebutt.nz) |
100 | 104 | - [scuttlebot.io](https://scuttlebot.io) |
modules/app/html/search.js | ||
---|---|---|
@@ -49,9 +49,9 @@ | ||
49 | 49 | function doSearch () { |
50 | 50 | var value = searchBox.value.trim() |
51 | 51 | if (value.startsWith('/') || value.startsWith('?') || value.startsWith('@') || value.startsWith('#') || value.startsWith('%')) { |
52 | 52 | if (value.startsWith('@') && value.length < 30) { |
53 | - // probably not a key | |
53 | + // probably not a key | |
54 | 54 | } else if (value.length > 2) { |
55 | 55 | setView(value) |
56 | 56 | } |
57 | 57 | } else if (value.trim()) { |
modules/channel/html/preview.js | ||
---|---|---|
@@ -1,7 +1,6 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var h = require('mutant/h') |
3 | -var map = require('mutant/map') | |
4 | 3 | var when = require('mutant/when') |
5 | 4 | var computed = require('mutant/computed') |
6 | 5 | var send = require('mutant/send') |
7 | 6 |
modules/channel/obs/suggest.js | ||
---|---|---|
@@ -75,5 +75,5 @@ | ||
75 | 75 | } |
76 | 76 | |
77 | 77 | function matches (text, startsWith) { |
78 | 78 | return text.slice(0, startsWith.length).localeCompare(startsWith, 'default', {sensitivity: 'base'}) === 0 |
79 | -} | |
79 | +} |
modules/page/html/render/channels.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | -var { h, send, when, computed, map } = require('mutant') | |
2 | +var { h, when, computed, map } = require('mutant') | |
3 | 3 | |
4 | 4 | exports.needs = nest({ |
5 | 5 | 'message.async.publish': 'first', |
6 | 6 | 'keys.sync.id': 'first', |
@@ -13,9 +13,8 @@ | ||
13 | 13 | |
14 | 14 | exports.gives = nest('page.html.render') |
15 | 15 | |
16 | 16 | exports.create = function (api) { |
17 | - const i18n = api.intl.sync.i18n | |
18 | 17 | return nest('page.html.render', function page (path) { |
19 | 18 | if (path !== '/channels') return |
20 | 19 | |
21 | 20 | var id = api.keys.sync.id() |
@@ -41,22 +40,6 @@ | ||
41 | 40 | ]) |
42 | 41 | }, {maxTime: 5, idle: true}) |
43 | 42 | ]) |
44 | 43 | ]) |
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 | - } | |
61 | 44 | }) |
62 | 45 | } |
modules/page/html/render/message.js | ||
---|---|---|
@@ -68,9 +68,8 @@ | ||
68 | 68 | |
69 | 69 | // what happens in private stays in private! |
70 | 70 | meta.recps.set(value.content.recps) |
71 | 71 | |
72 | - var author = value.author | |
73 | 72 | var root = api.message.sync.root({key: id, value}) || id |
74 | 73 | var isReply = id !== root |
75 | 74 | var thread = api.feed.obs.thread(id, {branch: isReply}) |
76 | 75 |
modules/page/html/render/public.js | ||
---|---|---|
@@ -267,9 +267,9 @@ | ||
267 | 267 | function noVisibleNewPostsWarning () { |
268 | 268 | const explanation = i18n('You may not be able to see new content until you follow some users or pubs.') |
269 | 269 | |
270 | 270 | const shownWhen = computed([loading, contact.isNotFollowingAnybody], |
271 | - (isLoading, isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody | |
271 | + (isLoading, isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody | |
272 | 272 | ) |
273 | 273 | |
274 | 274 | return api.feed.html.followWarning(shownWhen, explanation) |
275 | 275 | } |
@@ -283,31 +283,15 @@ | ||
283 | 283 | // should be sufficient to get the user to join a pub. However, pubs have been buggy and not followed back on occassion. |
284 | 284 | // Additionally, someone onboarded on a local network might follow someone on the network, but not be followed back by |
285 | 285 | // them, so we begin to show this warning if the user has followed someone, but has no followers. |
286 | 286 | const shownWhen = computed([loading, contact.hasNoFollowers, contact.isNotFollowingAnybody], |
287 | - (isLoading, hasNoFollowers, isNotFollowingAnybody) => | |
288 | - !isLoading && (hasNoFollowers && !isNotFollowingAnybody) | |
287 | + (isLoading, hasNoFollowers, isNotFollowingAnybody) => | |
288 | + !isLoading && (hasNoFollowers && !isNotFollowingAnybody) | |
289 | 289 | ) |
290 | 290 | |
291 | 291 | return api.feed.html.followerWarning(shownWhen, explanation) |
292 | 292 | } |
293 | 293 | |
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 | - | |
310 | 294 | function disconnect (id) { |
311 | 295 | onceTrue(api.sbot.obs.connection, (sbot) => { |
312 | 296 | sbot.patchwork.disconnect(id) |
313 | 297 | }) |
modules/sheet/profiles.js | ||
---|---|---|
@@ -1,5 +1,5 @@ | ||
1 | -var {h, when, map, computed, Value, lookup} = require('mutant') | |
1 | +var {h, map, computed, Value, lookup} = require('mutant') | |
2 | 2 | var nest = require('depnest') |
3 | 3 | var catchLinks = require('../../lib/catch-links') |
4 | 4 | |
5 | 5 | exports.needs = nest({ |
@@ -78,9 +78,8 @@ | ||
78 | 78 | }) |
79 | 79 | }) |
80 | 80 | |
81 | 81 | function renderContactBlock (profiles) { |
82 | - var yourId = api.keys.sync.id() | |
83 | 82 | profiles = api.profile.obs.rank(profiles) |
84 | 83 | return [ |
85 | 84 | h('div', { |
86 | 85 | classList: 'ProfileList' |
overrides/patchcore/message/html/action/reply.js | ||
---|---|---|
@@ -19,9 +19,9 @@ | ||
19 | 19 | |
20 | 20 | function handleEvent (ev) { |
21 | 21 | var {api, msg} = this |
22 | 22 | var el = getMessageElement(ev.target) |
23 | - | |
23 | + | |
24 | 24 | // HACK: if this is the last message in the list, reply to the root message |
25 | 25 | if (el && !el.nextElementSibling) { |
26 | 26 | api.app.navigate(api.message.sync.root(msg), 'reply') |
27 | 27 | ev.preventDefault() |
@@ -34,5 +34,5 @@ | ||
34 | 34 | return el |
35 | 35 | } |
36 | 36 | el = el.parentNode |
37 | 37 | } |
38 | -} | |
38 | +} |
package-lock.json | ||
---|---|---|
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.json | ||
---|---|---|
@@ -73,16 +73,17 @@ | ||
73 | 73 | "ssb-private": "0.1.4", |
74 | 74 | "ssb-query": "^1.0.0", |
75 | 75 | "ssb-ref": "^2.9.0", |
76 | 76 | "ssb-sort": "^1.0.0", |
77 | + "standard": "^11.0.1", | |
77 | 78 | "statistics": "^3.3.0", |
78 | 79 | "stream-to-pull-stream": "^1.7.2", |
79 | 80 | "suggest-box": "^2.2.3", |
80 | 81 | "text-node-searcher": "^1.1.1", |
81 | 82 | "xtend": "^4.0.1" |
82 | 83 | }, |
83 | 84 | "devDependencies": { |
84 | 85 | "colors": "^1.1.2", |
85 | - "electron": "~1.8.2", | |
86 | + "electron": "~1.8.4", | |
86 | 87 | "node-gyp": "^3.6.2" |
87 | 88 | } |
88 | 89 | } |
contributing.md | ||
---|---|---|
@@ -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