Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 770fe5e

Browse files
Merge pull request #1428 from ssbc/fix-feeds
Fixes issues with following states for channels, feeds, timelines.
2 parents 0685882 + 6918e65 commit 770fe5e

File tree

9 files changed

+196
-156
lines changed

9 files changed

+196
-156
lines changed

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ electron.app.on('ready', () => {
104104
click: () => {
105105
browserWindow.webContents.send('goToSettings')
106106
}
107+
},
108+
{
109+
label: 'Status',
110+
accelerator: 'CmdOrCtrl+.',
111+
click: () => {
112+
browserWindow.webContents.send('goToStatus')
113+
}
107114
}
108115
]
109116
})

lib/depject/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ module.exports = {
138138
public: require('./page/html/render/public.js'),
139139
search: require('./page/html/render/search.js'),
140140
settings: require('./page/html/render/settings.js'),
141+
status: require('./page/html/render/status.js'),
141142
tag: require('./page/html/render/tag.js'),
142143
'your-posts': require('./page/html/render/your-posts.js'),
143144
'attending-gatherings': require('./page/html/render/attending-gatherings.js')
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const { computed, h } = require('mutant')
2+
const nest = require('depnest')
3+
const renderProgress = require('../../../../progress/html/render')
4+
5+
exports.needs = nest({
6+
'sbot.pull.stream': 'first',
7+
'progress.obs': {
8+
indexes: 'first',
9+
plugins: 'first',
10+
replicate: 'first',
11+
migration: 'first'
12+
},
13+
'intl.sync.i18n': 'first'
14+
})
15+
16+
exports.gives = nest('page.html.render')
17+
18+
exports.create = function (api) {
19+
return nest('page.html.render', function channel (path) {
20+
const indexes = api.progress.obs.indexes()
21+
const pluginIndexes = api.progress.obs.plugins()
22+
const indexesJson = computed([indexes, pluginIndexes], (indexes, plugins) => {
23+
return JSON.stringify({indexes, plugins}, null, 4)
24+
})
25+
26+
if (path !== '/status') return
27+
const i18n = api.intl.sync.i18n
28+
29+
const prepend = [
30+
h('PageHeading', [
31+
h('h1', [
32+
h('strong', i18n('Status'))
33+
])
34+
])
35+
]
36+
37+
return h('Scroller', { style: { overflow: 'auto' } }, [
38+
h('div.wrapper', [
39+
h('section.prepend', prepend),
40+
h('section.content', [
41+
h('h2', i18n('Indexes')),
42+
h('pre', [indexesJson])
43+
]),
44+
])
45+
])
46+
})
47+
}

lib/depject/progress/obs.js

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ exports.gives = nest({
66
'progress.obs': [
77
'global',
88
'indexes',
9+
'plugins',
910
'replicate',
1011
'migration',
1112
'peer'
@@ -19,6 +20,7 @@ exports.needs = nest({
1920
exports.create = function (api) {
2021
let syncStatus = null
2122
let progress = null
23+
let pluginProgress = null
2224

2325
return nest({
2426
'progress.obs': {
@@ -37,6 +39,10 @@ exports.create = function (api) {
3739
load()
3840
return progress.indexes
3941
},
42+
plugins () {
43+
load()
44+
return pluginProgress.plugins
45+
},
4046
migration () {
4147
load()
4248
return progress.migration
@@ -63,6 +69,11 @@ exports.create = function (api) {
6369
migration: Status()
6470
})
6571
}
72+
if (!pluginProgress) {
73+
pluginProgress = ProgressStatus(x => x.patchwork.progress(), {
74+
plugins: Struct({}),
75+
})
76+
}
6677
}
6778

6879
function ProgressStatus (keyFn, attrs) {

lib/main-window.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ module.exports = function (config) {
118118

119119
const defaultViews = computed(includeParticipating, (includeParticipating) => {
120120
const result = [
121-
'/public', '/private', '/mentions'
121+
'/public', '/private', '/mentions', '/status'
122122
]
123123

124124
// allow user to choose in settings whether to show participating tab
@@ -141,6 +141,7 @@ module.exports = function (config) {
141141
electron.ipcRenderer.on('goBack', views.goBack)
142142

143143
electron.ipcRenderer.on('goToSettings', () => api.app.navigate('/settings'))
144+
electron.ipcRenderer.on('goTostatus', () => api.app.navigate('/status'))
144145

145146
electron.ipcRenderer.on("navigate-to", (ev, target) => {
146147
navigate(target);
@@ -368,6 +369,11 @@ module.exports = function (config) {
368369
label: i18n("Settings"),
369370
target: "/settings",
370371
},
372+
{
373+
type: "normal",
374+
label: i18n("Status"),
375+
target: "/status",
376+
},
371377
];
372378
return dropTabItems
373379
}

lib/plugins/progress.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ const deepEqual = require('deep-equal')
44
module.exports = function (ssb) {
55
return {
66
stream: function () {
7-
let lastValue = deepClone(ssb.progress())
7+
let lastValue = deepClone(ssb.status())
8+
lastValue = {
9+
...lastValue.progress,
10+
plugins: lastValue.sync.plugins,
11+
}
812

913
const timer = setInterval(() => {
10-
const newValue = ssb.progress()
14+
let newValue = deepClone(ssb.status())
15+
newValue = {
16+
...newValue.progress,
17+
plugins: newValue.sync.plugins,
18+
}
1119
if (!deepEqual(newValue, lastValue)) {
12-
lastValue = deepClone(newValue)
20+
lastValue = newValue
1321
pushable.push(lastValue)
1422
}
1523
}, 200)

locales/en.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -304,5 +304,7 @@
304304
"Connect": "Connect",
305305
"In order to share with users on the internet, you need to be invited to a pub server or a room server.": "In order to share with users on the internet, you need to be invited to a pub server or a room server.",
306306
"nl": "nl",
307-
"Last activity": "Last activity"
307+
"Last activity": "Last activity",
308+
"Status": "Status",
309+
"Indexes": "Indexes"
308310
}

0 commit comments

Comments
 (0)