git ssb

16+

Dominic / patchbay



Commit 5dcb2e47e47030dca8e1317520628cf4526c217b

Merge master

Anders Rune Jensen committed on 6/7/2018, 6:25:03 PM
Parent: 06d5f9edff08206becab379b2f89c78d0d066da5
Parent: 3957df45eb7c39662cabc9816064d7e2ef1eb664

Files changed

app/html/filter.jschanged
app/html/search-bar.jschanged
app/page/settings.jschanged
app/sync/initialise/suggestionCaches.jsadded
message/html/compose.jschanged
package-lock.jsonchanged
package.jsonchanged
app/html/filter.jsView
@@ -140,12 +140,11 @@
140140 h('i', { classList: when(state, 'fa fa-check-square-o', 'fa fa-square-o') })
141141 ])
142142 }
143143
144- const getChannelSuggestions = api.channel.async.suggest()
145144 addSuggest(channelInput, (inputText, cb) => {
146145 if (inputText[0] === '#') {
147- cb(null, getChannelSuggestions(inputText.slice(1)))
146 + api.channel.async.suggest(inputText.slice(1), cb)
148147 }
149148 }, {cls: 'PatchSuggest'})
150149 channelInput.addEventListener('suggestselect', ev => {
151150 const channels = channelInput.value.trim()
@@ -154,12 +153,11 @@
154153
155154 draw()
156155 })
157156
158- const getAboutSuggestions = api.about.async.suggest()
159157 addSuggest(userInput, (inputText, cb) => {
160158 inputText = inputText.replace(/^@/, '')
161- cb(null, getAboutSuggestions(inputText))
159 + api.about.async.suggest(inputText, cb)
162160 }, {cls: 'PatchSuggest'})
163161 userInput.addEventListener('suggestselect', ev => userId.set(ev.detail.id))
164162
165163 function followFilter (msg) {
app/html/search-bar.jsView
@@ -16,13 +16,14 @@
1616
1717 return nest('app.html.searchBar', function searchBar () {
1818 if (_search) return _search
1919
20- const getProfileSuggestions = api.about.async.suggest()
21- const getChannelSuggestions = api.channel.async.suggest()
22-
2320 function goToLocation (location, ev) {
24- if (location[0] == '?') { location = { page: 'search', query: location.substring(1) } } else if (!['@', '#', '%', '&', '/'].includes(location[0])) { location = { page: 'search', query: location } }
21 + if (location[0] === '?') {
22 + location = { page: 'search', query: location.substring(1) }
23 + } else if (!['@', '#', '%', '&', '/'].includes(location[0])) {
24 + location = { page: 'search', query: location }
25 + }
2526
2627 api.app.sync.goTo(location)
2728 if (!ev.ctrlKey) input.blur()
2829 }
@@ -32,9 +33,9 @@
3233 placeholder: '?search, @name, #channel',
3334 'ev-keyup': ev => {
3435 switch (ev.keyCode) {
3536 case 13: // enter
36- goToLocation(input.value.trim(), ev)
37 + goToLocation(input.value.trim(), ev)
3738 return
3839 case 27: // escape
3940 ev.preventDefault()
4041 input.blur()
@@ -63,18 +64,18 @@
6364 addSuggest(input, (inputText, cb) => {
6465 const char = inputText[0]
6566 const word = inputText.slice(1)
6667
67- if (char === '@') cb(null, getProfileSuggestions(word))
68- if (char === '#') cb(null, getChannelSuggestions(word))
68 + if (char === '@') api.about.async.suggest(word, cb)
69 + if (char === '#') api.channel.async.suggest(word, cb)
6970 if (char === '/') cb(null, getPagesSuggestions(word))
7071 }, {cls: 'PatchSuggest'})
7172
7273 // TODO extract
7374 function getPagesSuggestions (word) {
7475 const pages = [
7576 'public', 'private', 'inbox', 'profile', 'notifications', 'settings',
76- 'gatherings', 'chess', 'books'
77 + 'gatherings', 'chess', 'books', 'imageSearch', 'polls'
7778 ]
7879
7980 return pages
8081 .filter(page => ~page.indexOf(word))
app/page/settings.jsView
@@ -14,9 +14,9 @@
1414
1515 exports.create = function (api) {
1616 return nest({
1717 'app.html.menuItem': menuItem,
18- 'app.page.settings': publicPage
18 + 'app.page.settings': settingsPage
1919 })
2020
2121 function menuItem () {
2222 return h('a', {
@@ -24,9 +24,10 @@
2424 'ev-click': () => api.app.sync.goTo({ page: 'settings' })
2525 }, '/settings')
2626 }
2727
28- function publicPage (location) {
28 +
29 + function settingsPage (location) {
2930 var page = h('SettingsPage', { title: '/settings' }, [
3031 h('div.container', [
3132 h('h1', 'Settings'),
3233 api.app.html.settings().map(setting => {
app/sync/initialise/suggestionCaches.jsView
@@ -1,0 +1,17 @@
1 +const nest = require('depnest')
2 +
3 +exports.gives = nest('app.sync.initialise')
4 +
5 +exports.needs = nest({
6 + 'about.async.suggest': 'first',
7 + 'channel.async.suggest': 'first'
8 +})
9 +
10 +exports.create = function (api) {
11 + return nest('app.sync.initialise', init)
12 +
13 + function init () {
14 + api.about.async.suggest()
15 + api.channel.async.suggest()
16 + }
17 +}
message/html/compose.jsView
@@ -9,8 +9,9 @@
99 exports.needs = nest({
1010 'about.async.suggest': 'first',
1111 'channel.async.suggest': 'first',
1212 'emoji.async.suggest': 'first',
13 + 'meme.async.suggest': 'first',
1314 'blob.html.input': 'first',
1415 'message.html.confirm': 'first',
1516 'drafts.sync.get': 'first',
1617 'drafts.sync.set': 'first',
@@ -40,12 +41,8 @@
4041 var textAreaFocused = Value(false)
4142 var focused = computed([channelInputFocused, textAreaFocused], (a, b) => a || b)
4243 var hasContent = Value(false)
4344
44- var getProfileSuggestions = api.about.async.suggest()
45- var getChannelSuggestions = api.channel.async.suggest()
46- var getEmojiSuggestions = api.emoji.async.suggest()
47-
4845 var blurTimeout = null
4946
5047 var expanded = computed([shrink, focused, hasContent], (shrink, focused, hasContent) => {
5148 if (!shrink || hasContent) return true
@@ -153,22 +150,23 @@
153150 composer.addQuote = function (data) {
154151 try {
155152 if (typeof data.content.text === 'string') {
156153 var text = data.content.text
157- textArea.value += '> ' + text.replace(/\r\n|\r|\n/g,'\n> ') + '\r\n\n'
154 + textArea.value += '> ' + text.replace(/\r\n|\r|\n/g, '\n> ') + '\r\n\n'
158155 hasContent.set(!!textArea.value)
159156 }
160- } catch(err) {
157 + } catch (err) {
161158 // object not have text or content
162159 }
163160 }
164161
165- if (location.action == 'quote')
162 + if (location.action == 'quote') {
166163 composer.addQuote(location.value)
164 + }
167165
168166 addSuggest(channelInput, (inputText, cb) => {
169167 if (inputText[0] === '#') {
170- cb(null, getChannelSuggestions(inputText.slice(1)))
168 + cb(null, api.channel.async.suggest(inputText.slice(1)))
171169 }
172170 }, {cls: 'PatchSuggest'})
173171 channelInput.addEventListener('suggestselect', ev => {
174172 channelInput.value = ev.detail.id // HACK : this over-rides the markdown value
@@ -177,11 +175,12 @@
177175 addSuggest(textArea, (inputText, cb) => {
178176 const char = inputText[0]
179177 const wordFragment = inputText.slice(1)
180178
181- if (char === '@') cb(null, getProfileSuggestions(wordFragment, feedIdsInThread))
182- if (char === '#') cb(null, getChannelSuggestions(wordFragment))
183- if (char === ':') cb(null, getEmojiSuggestions(wordFragment))
179 + if (char === '@') api.about.async.suggest(wordFragment, feedIdsInThread, cb)
180 + if (char === '#') api.channel.async.suggest(wordFragment, cb)
181 + if (char === ':') api.emoji.async.suggest(wordFragment, cb)
182 + if (char === '&') api.meme.async.suggest(wordFragment, cb)
184183 }, {cls: 'PatchSuggest'})
185184
186185 return composer
187186
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 360509 bytes
New file size: 357422 bytes
package.jsonView
@@ -60,9 +60,9 @@
6060 "patch-history": "^1.0.0",
6161 "patch-hub": "^1.1.0",
6262 "patch-inbox": "^1.0.2",
6363 "patch-settings": "^1.1.1",
64- "patch-suggest": "^1.1.0",
64 + "patch-suggest": "^2.0.1",
6565 "patchbay-book": "^1.0.6",
6666 "patchbay-gatherings": "^2.0.0",
6767 "patchbay-poll": "^1.0.1",
6868 "patchcore": "^1.27.1",
@@ -72,13 +72,13 @@
7272 "pull-scroll": "^1.0.9",
7373 "pull-stream": "^3.6.8",
7474 "read-directory": "^2.1.1",
7575 "require-style": "^1.0.1",
76- "scuttle-blog": "^1.0.0",
76 + "scuttle-blog": "^1.0.1",
7777 "scuttlebot": "^11.3.0",
7878 "setimmediate": "^1.0.5",
79- "ssb-about": "^0.1.1",
80- "ssb-backlinks": "^0.6.1",
79 + "ssb-about": "^0.1.2",
80 + "ssb-backlinks": "^0.7.1",
8181 "ssb-blobs": "^1.1.3",
8282 "ssb-chess": "^2.2.4",
8383 "ssb-chess-db": "^1.0.2",
8484 "ssb-client": "^4.5.7",
@@ -89,9 +89,9 @@
8989 "ssb-meme": "^1.0.4",
9090 "ssb-mentions": "^0.4.1",
9191 "ssb-mutual": "^0.1.0",
9292 "ssb-private": "^0.2.1",
93- "ssb-query": "^1.0.2",
93 + "ssb-query": "^2.1.0",
9494 "ssb-search": "^1.0.1",
9595 "ssb-ws": "^1.0.3",
9696 "style-resolve": "^1.0.1",
9797 "suggest-box": "^2.2.3",

Built with git-ssb-web