git ssb

16+

Dominic / patchbay



Commit cbef0d72b505f32da320aecf8f0c3251e868f40d

standardise

mix irving committed on 2/8/2018, 5:16:20 AM
Parent: f9247af42625faa86a666f3a03671aa524a870a4

Files changed

app/page/thread.jschanged
app/sync/catch-keyboard-shortcut.jschanged
app/sync/goTo.jschanged
app/sync/locationId.jschanged
router/async/normalise.jschanged
router/async/router.jschanged
app/page/thread.jsView
@@ -88,9 +88,8 @@
8888 })
8989
9090 return container
9191
92-
9392 function scrollDownToMessage (id) {
9493 const locationId = api.app.sync.locationId(location)
9594 const tabs = api.app.html.tabs()
9695 locateKey()
@@ -108,5 +107,4 @@
108107 }
109108 }
110109 }
111110 }
112-
app/sync/catch-keyboard-shortcut.jsView
@@ -107,9 +107,8 @@
107107 goTo(msg.dataset.id)
108108 // TODO - rm the dataset.root decorator
109109 }
110110
111-
112111 function toggleRawMessage (ev) {
113112 const msg = ev.target
114113 if (!msg.classList.contains('Message')) return
115114
app/sync/goTo.jsView
@@ -26,9 +26,9 @@
2626 const {
2727 openBackground = false,
2828 split = false
2929 } = options
30-
30 +
3131 const tabs = api.app.html.tabs()
3232
3333 // currently do normalisation here only to generate normalised locationId
3434 api.router.async.normalise(location, (err, location) => {
@@ -57,9 +57,8 @@
5757 history.set([ ..._history, location, current ])
5858 } else {
5959 api.history.sync.push(location)
6060 }
61-
6261 })
6362 })
6463 }
6564 }
app/sync/locationId.jsView
@@ -9,12 +9,13 @@
99
1010 function locationId (location) {
1111 if (typeof location === 'string') return string
1212
13- if (isMsg(location.key)) location = {
14- key: get(location, 'value.content.root', location.key)
13 + if (isMsg(location.key)) {
14 + location = {
15 + key: get(location, 'value.content.root', location.key)
16 + }
1517 }
1618
1719 return JSON.stringify(location)
1820 }
1921 }
20-
router/async/normalise.jsView
@@ -4,24 +4,25 @@
44 exports.gives = nest('router.async.normalise')
55
66 exports.needs = nest({
77 'message.sync.unbox': 'first',
8- 'sbot.async.get': 'first',
8 + 'sbot.async.get': 'first'
99 })
1010
1111 exports.create = (api) => {
1212 return nest('router.async.normalise', normalise)
1313
1414 function normalise (location, cb) {
1515 if (typeof location === 'object') cb(null, location)
16- else if (isMsg(location)) api.sbot.async.get(location, (err, value) => {
17- if (err) cb(err)
18- else {
19- if (typeof value.content === 'string') value = api.message.sync.unbox(value)
20- cb(null, {key: location, value})
21- }
22- })
23- else if (isBlob(location)) cb(null, { blob: location })
16 + else if (isMsg(location)) {
17 + api.sbot.async.get(location, (err, value) => {
18 + if (err) cb(err)
19 + else {
20 + if (typeof value.content === 'string') value = api.message.sync.unbox(value)
21 + cb(null, {key: location, value})
22 + }
23 + })
24 + } else if (isBlob(location)) cb(null, { blob: location })
2425 else if (isChannel(location)) cb(null, { channel: location })
2526 else if (isFeed(location)) cb(null, { feed: location })
2627 else if (isPage(location)) cb(null, { page: location.substring(1) })
2728
@@ -35,5 +36,4 @@
3536
3637 function isPage (str) {
3738 return typeof str === 'string' && str[0] === '/' && str.length > 1
3839 }
39-
router/async/router.jsView
@@ -33,6 +33,4 @@
3333
3434 if (route) cb(null, route[1](location))
3535 }
3636 }
37-
38-

Built with git-ssb-web