git ssb

2+

mixmix / ticktack



Commit 8ef6aa7beef970e32307b11113580c779a334793

improve "beta" marking in settings

mix irving committed on 6/27/2018, 3:03:39 AM
Parent: 4b05816cf5b7924499a556962fed53517b29f270

Files changed

app/obs/pluginsOk.jschanged
app/page/notifications.jschanged
app/sync/initialize/unreadCounters.jschanged
message/sync/getParticipants.jschanged
translations/en.jschanged
unread/sync/markRead.jschanged
app/obs/pluginsOk.jsView
@@ -20,10 +20,10 @@
2020 function checkForTrouble () {
2121 onceTrue(
2222 api.sbot.obs.connection,
2323 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!')
2626
2727 if (!sbot.channel || !sbot.ticktack) ok.set(false) // TODO could build a list of missing plugins + effects
2828 else ok.set(true)
2929 }
app/page/notifications.jsView
@@ -1,16 +1,15 @@
11 const nest = require('depnest')
2-const { h, onceTrue } = require('mutant')
3-const defer = require('pull-defer')
2+const { h } = require('mutant')
43
54 exports.gives = nest('app.page.notifications')
65
76 exports.needs = nest({
87 'app.html.scroller': 'first',
98 'app.html.sideNav': 'first',
109 'message.html.comment': 'first',
1110 'message.html.notification': 'first',
12- 'sbot.obs.connection': 'first',
11+ 'sbot.pull.stream': 'first',
1312 'translations.sync.strings': 'first'
1413 })
1514
1615 const SOURCES = {
@@ -23,36 +22,24 @@
2322 return nest('app.page.notifications', function (location) {
2423 // location here can expected to be: { page: 'notifications', section: * }
2524 if (!Object.keys(SOURCES).includes(location.section)) return
2625
26+ const createStream = (opts) => api.sbot.pull.stream(server => {
27+ const source = SOURCES[location.section]
28+ return server.ticktack[source](opts)
29+ })
30+
2731 var scroller = api.app.html.scroller({
2832 classList: ['content'],
29- createStream: createCreateStream(location.section),
33+ createStream,
3034 render: createRender(location.section)
3135 })
3236
3337 return h('Page -notifications', [
3438 api.app.html.sideNav(location),
3539 scroller
3640 ])
3741
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-
5542 function createRender (section) {
5643 return function (msg) {
5744 switch (section) {
5845 case 'comments':
app/sync/initialize/unreadCounters.jsView
@@ -44,13 +44,15 @@
4444
4545 const { getUnreadMsgsCache } = api.unread.obs
4646 const { getParticipants } = api.message.sync
4747
48- const participantsKey = getParticipants(msg).key
49- updateCache(getUnreadMsgsCache(participantsKey), msg)
50-
5148 const rootKey = get(msg, 'value.content.root', msg.key)
5249 updateCache(getUnreadMsgsCache(rootKey), msg)
50+
51+ const participants = getParticipants(msg)
52+ if (participants) {
53+ updateCache(getUnreadMsgsCache(participants.key), msg)
54+ }
5355 }
5456
5557 function updateCache (cache, msg) {
5658 if (api.unread.sync.isUnread(msg)) cache.add(msg.key)
message/sync/getParticipants.jsView
@@ -10,11 +10,13 @@
1010 exports.create = function (api) {
1111 return nest('message.sync.getParticipants', getParticipants)
1212
1313 function getParticipants (msg) {
14+ const recps = get(msg, 'value.content.recps')
15+ if (!recps) return
16+
1417 const myKey = api.keys.sync.id()
15-
16- var participants = get(msg, 'value.content.recps')
18+ var participants = recps
1719 .map(r => typeof r === 'string' ? r : r.link)
1820 .filter(r => r !== myKey)
1921 .sort()
2022
translations/en.jsView
@@ -4,13 +4,13 @@
44 likes: 'Likes',
55 shares: 'Shares',
66 themes: {
77 light: 'Light',
8- dark: 'Dark'
8+ dark: 'Dark (beta)'
99 },
1010 editors: {
1111 rich: 'Rich',
12- markdown: 'Markdown'
12+ markdown: 'Markdown (beta)'
1313 },
1414 splash: {
1515 about: [
1616 'A social network that values openness, equality, and freedom.',
@@ -85,10 +85,10 @@
8585 introduction: 'Introduction',
8686 language: 'Language',
8787 zoom: 'Zoom',
8888 version: 'Version',
89- theme: 'Theme (beta)',
90- editor: 'Editor (beta)'
89+ theme: 'Theme',
90+ editor: 'Editor'
9191 }
9292 },
9393 addressBook: {
9494 action: {
unread/sync/markRead.jsView
@@ -27,10 +27,12 @@
2727 getUnreadMsgsCache(msg.value.content.root || msg.key)
2828 .delete(msg.key)
2929
3030 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+ }
3335
3436 if (msg && typeof msg.key === 'string') {
3537 // note: there is a quirk where some messages don't have a timestamp
3638 if (isUnread(msg)) {

Built with git-ssb-web