Commit 8ef6aa7beef970e32307b11113580c779a334793
improve "beta" marking in settings
mix irving committed on 6/27/2018, 3:03:39 AMParent: 4b05816cf5b7924499a556962fed53517b29f270
Files changed
app/obs/pluginsOk.js | changed |
app/page/notifications.js | changed |
app/sync/initialize/unreadCounters.js | changed |
message/sync/getParticipants.js | changed |
translations/en.js | changed |
unread/sync/markRead.js | changed |
app/obs/pluginsOk.js | ||
---|---|---|
@@ -20,10 +20,10 @@ | ||
20 | 20 | function checkForTrouble () { |
21 | 21 | onceTrue( |
22 | 22 | api.sbot.obs.connection, |
23 | 23 | sbot => { |
24 | - if (!sbot.channel) console.log('> channel plugin missing!') | |
25 | - if (!sbot.tickack) console.log('> ticktack plugin missing!') | |
24 | + // if (!sbot.channel) console.log('> channel plugin missing!') | |
25 | + // if (!sbot.tickack) console.log('> ticktack plugin missing!') | |
26 | 26 | |
27 | 27 | if (!sbot.channel || !sbot.ticktack) ok.set(false) // TODO could build a list of missing plugins + effects |
28 | 28 | else ok.set(true) |
29 | 29 | } |
app/page/notifications.js | ||
---|---|---|
@@ -1,16 +1,15 @@ | ||
1 | 1 | const nest = require('depnest') |
2 | -const { h, onceTrue } = require('mutant') | |
3 | -const defer = require('pull-defer') | |
2 | +const { h } = require('mutant') | |
4 | 3 | |
5 | 4 | exports.gives = nest('app.page.notifications') |
6 | 5 | |
7 | 6 | exports.needs = nest({ |
8 | 7 | 'app.html.scroller': 'first', |
9 | 8 | 'app.html.sideNav': 'first', |
10 | 9 | 'message.html.comment': 'first', |
11 | 10 | 'message.html.notification': 'first', |
12 | - 'sbot.obs.connection': 'first', | |
11 | + 'sbot.pull.stream': 'first', | |
13 | 12 | 'translations.sync.strings': 'first' |
14 | 13 | }) |
15 | 14 | |
16 | 15 | const SOURCES = { |
@@ -23,36 +22,24 @@ | ||
23 | 22 | return nest('app.page.notifications', function (location) { |
24 | 23 | // location here can expected to be: { page: 'notifications', section: * } |
25 | 24 | if (!Object.keys(SOURCES).includes(location.section)) return |
26 | 25 | |
26 | + const createStream = (opts) => api.sbot.pull.stream(server => { | |
27 | + const source = SOURCES[location.section] | |
28 | + return server.ticktack[source](opts) | |
29 | + }) | |
30 | + | |
27 | 31 | var scroller = api.app.html.scroller({ |
28 | 32 | classList: ['content'], |
29 | - createStream: createCreateStream(location.section), | |
33 | + createStream, | |
30 | 34 | render: createRender(location.section) |
31 | 35 | }) |
32 | 36 | |
33 | 37 | return h('Page -notifications', [ |
34 | 38 | api.app.html.sideNav(location), |
35 | 39 | scroller |
36 | 40 | ]) |
37 | 41 | |
38 | - function createCreateStream (section) { | |
39 | - return function (opts) { | |
40 | - // TODO - refactor with sbot.pull.stream | |
41 | - const source = defer.source() | |
42 | - var resolved = false | |
43 | - | |
44 | - onceTrue(api.sbot.obs.connection, server => { | |
45 | - if (resolved) return | |
46 | - | |
47 | - source.resolve(server.ticktack[SOURCES[section]](opts)) | |
48 | - resolved = true | |
49 | - }) | |
50 | - | |
51 | - return source | |
52 | - } | |
53 | - } | |
54 | - | |
55 | 42 | function createRender (section) { |
56 | 43 | return function (msg) { |
57 | 44 | switch (section) { |
58 | 45 | case 'comments': |
app/sync/initialize/unreadCounters.js | ||
---|---|---|
@@ -44,13 +44,15 @@ | ||
44 | 44 | |
45 | 45 | const { getUnreadMsgsCache } = api.unread.obs |
46 | 46 | const { getParticipants } = api.message.sync |
47 | 47 | |
48 | - const participantsKey = getParticipants(msg).key | |
49 | - updateCache(getUnreadMsgsCache(participantsKey), msg) | |
50 | - | |
51 | 48 | const rootKey = get(msg, 'value.content.root', msg.key) |
52 | 49 | updateCache(getUnreadMsgsCache(rootKey), msg) |
50 | + | |
51 | + const participants = getParticipants(msg) | |
52 | + if (participants) { | |
53 | + updateCache(getUnreadMsgsCache(participants.key), msg) | |
54 | + } | |
53 | 55 | } |
54 | 56 | |
55 | 57 | function updateCache (cache, msg) { |
56 | 58 | if (api.unread.sync.isUnread(msg)) cache.add(msg.key) |
message/sync/getParticipants.js | ||
---|---|---|
@@ -10,11 +10,13 @@ | ||
10 | 10 | exports.create = function (api) { |
11 | 11 | return nest('message.sync.getParticipants', getParticipants) |
12 | 12 | |
13 | 13 | function getParticipants (msg) { |
14 | + const recps = get(msg, 'value.content.recps') | |
15 | + if (!recps) return | |
16 | + | |
14 | 17 | const myKey = api.keys.sync.id() |
15 | - | |
16 | - var participants = get(msg, 'value.content.recps') | |
18 | + var participants = recps | |
17 | 19 | .map(r => typeof r === 'string' ? r : r.link) |
18 | 20 | .filter(r => r !== myKey) |
19 | 21 | .sort() |
20 | 22 |
translations/en.js | ||
---|---|---|
@@ -4,13 +4,13 @@ | ||
4 | 4 | likes: 'Likes', |
5 | 5 | shares: 'Shares', |
6 | 6 | themes: { |
7 | 7 | light: 'Light', |
8 | - dark: 'Dark' | |
8 | + dark: 'Dark (beta)' | |
9 | 9 | }, |
10 | 10 | editors: { |
11 | 11 | rich: 'Rich', |
12 | - markdown: 'Markdown' | |
12 | + markdown: 'Markdown (beta)' | |
13 | 13 | }, |
14 | 14 | splash: { |
15 | 15 | about: [ |
16 | 16 | 'A social network that values openness, equality, and freedom.', |
@@ -85,10 +85,10 @@ | ||
85 | 85 | introduction: 'Introduction', |
86 | 86 | language: 'Language', |
87 | 87 | zoom: 'Zoom', |
88 | 88 | version: 'Version', |
89 | - theme: 'Theme (beta)', | |
90 | - editor: 'Editor (beta)' | |
89 | + theme: 'Theme', | |
90 | + editor: 'Editor' | |
91 | 91 | } |
92 | 92 | }, |
93 | 93 | addressBook: { |
94 | 94 | action: { |
unread/sync/markRead.js | ||
---|---|---|
@@ -27,10 +27,12 @@ | ||
27 | 27 | getUnreadMsgsCache(msg.value.content.root || msg.key) |
28 | 28 | .delete(msg.key) |
29 | 29 | |
30 | 30 | const participants = api.message.sync.getParticipants(msg) |
31 | - getUnreadMsgsCache(participants.key) | |
32 | - .delete(msg.key) | |
31 | + if (participants) { | |
32 | + getUnreadMsgsCache(participants.key) | |
33 | + .delete(msg.key) | |
34 | + } | |
33 | 35 | |
34 | 36 | if (msg && typeof msg.key === 'string') { |
35 | 37 | // note: there is a quirk where some messages don't have a timestamp |
36 | 38 | if (isUnread(msg)) { |
Built with git-ssb-web