Skip to content

Commit 33581fb

Browse files
author
Dev-3
committed
fix(client): the feedback list says how many rows of how many it draws (#2884)
The list stopped at eight rows behind a bare `Show more`, so a reader could not tell a cut list from a complete one from the page itself and quoted the eight rows in bug reports. The control row now carries the count it draws: `Showing 8 of 50` while folded, `Showing all 50` once open. Rows, ordering, the control and the title are otherwise unchanged, and eight or fewer rows draw neither the count nor the control. Red-first: the added assertions fail on the previous code (the count node is absent) and pass with it; removing only the count line turns those two tests red while the three #2266 tests stay green. The count is of the rows the page holds — a host read caps at fifty while the title's total counts the whole log. `core/client.js` and patches/ds-bot were regenerated.
1 parent 55c5ab4 commit 33581fb

9 files changed

Lines changed: 124 additions & 38 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The Feedback page's error list now says how much of it is drawn: the newest eight rows sit under a count like `Showing 8 of 50`, and the existing `Show more` control opens the rest, with the line reading `Showing all 50` while it is open. A reader with more errors than fit can now tell the list is cut rather than complete before quoting it in a bug report; eight or fewer errors keep the list exactly as it was, with no count and no control. See [#2884](https://github.com/ThinkFlowLab/FlyBot/issues/2884).

‎core/client.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ var ZH = {
472472
About: "简介",
473473
"Show less": "收起",
474474
"Show more": "展开",
475+
"Showing {shown} of {count}": "显示 {shown} / {count}",
476+
"Showing all {count}": "显示全部 {count}",
475477
"Admin leads": "管理员主持",
476478
"Plain messages go to the admin, who calls others with @Name.": "普通消息先给管理员,由管理员用 @名字 点名其他成员。",
477479
Everyone: "所有人",
@@ -19194,6 +19196,11 @@ function FeedbackPage({ roster, actions, run, Section, Row: Row4 }) {
1919419196
entries2.length > 8 ? (0, import_react41.createElement)(
1919519197
"div",
1919619198
{ key: "more", className: "bt-set-row bt-fb-more-row" },
19199+
(0, import_react41.createElement)(
19200+
"span",
19201+
{ className: "bt-set-hint bt-fb-count" },
19202+
allErrors ? t("Showing all {count}", { count: entries2.length }) : t("Showing {shown} of {count}", { shown: shown.length, count: entries2.length })
19203+
),
1919719204
(0, import_react41.createElement)("button", {
1919819205
type: "button",
1919919206
className: "bt-soft bt-soft-sm bt-fb-more",

‎core/src/client/feedback.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ export function FeedbackPage({ roster, actions, run, Section, Row }) {
145145
entry.code ? h('span', { className: 'bt-tag bt-fb-code' }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null)),
146146
entries.length > 8
147147
? h('div', { key: 'more', className: 'bt-set-row bt-fb-more-row' },
148+
h('span', { className: 'bt-set-hint bt-fb-count' },
149+
allErrors
150+
? t('Showing all {count}', { count: entries.length })
151+
: t('Showing {shown} of {count}', { shown: shown.length, count: entries.length })),
148152
h('button', {
149153
type: 'button', className: 'bt-soft bt-soft-sm bt-fb-more', 'aria-expanded': allErrors,
150154
onClick: () => setAllErrors(!allErrors),

‎core/src/client/i18n.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ const ZH = {
442442
About: '简介',
443443
'Show less': '收起',
444444
'Show more': '展开',
445+
'Showing {shown} of {count}': '显示 {shown} / {count}',
446+
'Showing all {count}': '显示全部 {count}',
445447
'Admin leads': '管理员主持',
446448
'Plain messages go to the admin, who calls others with @Name.': '普通消息先给管理员,由管理员用 @名字 点名其他成员。',
447449
Everyone: '所有人',

‎core/test/feedback-errors-more.test.js‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,18 @@ async function mount({ entries, total } = {}) {
155155
const find = predicate => all(tree).find(predicate)
156156
const rows = () => all(tree).filter(node => node.props?.className === 'bt-set-row bt-fb-entry')
157157
const more = () => find(node => typeof node.props?.className === 'string' && node.props.className.split(' ').includes('bt-fb-more'))
158+
const count = () => find(node => typeof node.props?.className === 'string' && node.props.className.split(' ').includes('bt-fb-count'))
158159
const text = (node) => [node?.props?.children].flat(Infinity).filter(child => typeof child === 'string' || typeof child === 'number').join('')
159160
const deepText = (node) => all(node).map(part => text(part)).filter(Boolean).join(' ')
160161
const heading = () => find(node => node.type === 'h3' && text(node).startsWith('Recent errors'))
161162
return {
162163
get rows() { return rows() },
163164
get more() { return more() },
165+
get count() { return count() },
164166
get heading() { return heading() },
165167
text, deepText,
166168
title: () => text(heading()),
169+
countText: () => text(count()),
167170
async click() { more().props.onClick({}); await settle() },
168171
}
169172
}
@@ -201,3 +204,25 @@ test('#2266: eight or fewer errors draw no control and keep the title as it was'
201204
assert.equal(exact.rows.length, 8)
202205
assert.equal(exact.more, undefined, 'exactly eight rows are all drawn, so no control')
203206
})
207+
208+
// #2884: `Show more` was an unlabelled way out — a reader with more than eight errors
209+
// could not tell whether the list was cut or complete from the page itself, and wrote
210+
// bug reports from the eight rows it showed. The control row now carries the count of
211+
// what is drawn against what is loaded: `Showing 8 of 50` while folded, `Showing all 50`
212+
// once open. A report of eight or fewer rows draws neither, exactly as before.
213+
test('#2884: a list cut at eight rows says how many rows of how many it draws', async () => {
214+
const page = await mount({ entries: errorEntries(50), total: 60 })
215+
assert.equal(page.countText(), 'Showing 8 of 50', 'the folded list says it is drawing eight of the fifty rows it holds')
216+
assert.equal(page.text(page.more).trim(), 'Show more')
217+
await page.click()
218+
assert.equal(page.countText(), 'Showing all 50', 'open, the panel says every loaded row is drawn')
219+
assert.equal(page.rows.length, 50)
220+
await page.click()
221+
assert.equal(page.countText(), 'Showing 8 of 50', 'folded again, the count returns to eight')
222+
})
223+
224+
test('#2884: eight or fewer rows draw no count line', async () => {
225+
const page = await mount({ entries: errorEntries(8), total: 8 })
226+
assert.equal(page.count, undefined, 'nothing is hidden, so nothing counts it')
227+
assert.equal(page.rows.length, 8)
228+
})

‎docs/subsystems/core-client.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The browser side of the patched `ds-bot` core (`core/`): sources in `core/src/cl
1818
- Read-only banner: when another dsh holds the team (`roster.readOnly` a non-empty string), the sidebar draws the host's own sentence and, beside it, one **Reload** control in both shapes (wide and rail; the control stays outside the `role="status"` line so a live region remains text). It calls `actions.reloadTeam`, which re-reads the whole team (`state` without `since`, see `stateRequest` / `stateAnswerIsStale` in `sources.js`) so the banner and every refused control clear once the other holder let go, without a page reload that would drop what is in the composer. Tests: `core/test/sidebar-readonly-reload.test.js`, `core/test/client-reload-state.test.js`. Since #2502 that sentence and entry are one shared piece: `client/read-only.js` exports `readOnlyLine(h, roster, actions, { key, className, style, reload })` and `readOnlySaid`, where the first argument is the renderer `h` itself, passed by the caller so the new module never imports react and the generated bundle keeps its bindings, and the Settings header, the drawer's three hint sites (`details-drawer.js` Bot overview, Bot settings view and group overview), the Inbox dialog and the Memory panel draw them instead of their own copies. The Board, both New chat sites (the To: row once the admin is chosen, the composer otherwise) and the Project settings panel draw the same piece since then: each is an overlay that covers the sidebar's own entry, so the sentence they repeat needs its own way to answer it. The sentence stays `bt-hint bt-read-only` under `role="status"`, the button sits outside that node, and a press runs the same `actions.reloadTeam` read with `reportError(error, 'reload')` on failure; one view draws at most one entry, and `reload: false` keeps a sentence without the control so a second hint can never grow a second button. A writable window, and a sentence of only whitespace, draw neither. Tests: `core/test/readonly-reload-lines.test.js`.
1919
- Chat context rows: a tool the plugin registers at install draws one `tool-addition` row, and `cells.js` keeps every name in `TEAM_TOOLS` out of the chat (`SILENT_REGISTRATION_TOOLS`, #1101) — the Project Assistant's `project_digest` joins them (#1712), so its 09:00 Session shows the digest, not its registration.
2020
- A Settings dialog takes focus when it opens (`useDialogFocus` in `core/src/client/overlay-hooks.js`; the `.bt-settings` dialog carries `tabIndex -1` and a ref) and gives it back to the still-connected opener when it closes; it is not a focus trap, so Tab can still leave the dialog for the page behind the scrim (#2251). It is drawn for `DIALOG_EXIT_MS` (160 ms) with `pointer-events: none` on the leaving layer, so the unmount restores focus only while the dialog still holds it (or nothing does) — a click on the page during that window keeps its focus (#2270).
21-
- Settings → Feedback's error list (`feedback.js`) still titles the block with the whole log (`Recent errors · 60`) but lists only the newest eight, so when the report holds more rows one `Show more` control (`aria-expanded`) sits under them and draws every loaded error, folding back to `Show less`; a report of eight or fewer draws no control (#2266).
21+
- Settings → Feedback's error list (`feedback.js`) still titles the block with the whole log (`Recent errors · 60`) but lists only the newest eight, so when the report holds more rows one `Show more` control (`aria-expanded`) sits under them beside a count of what is drawn (`Showing 8 of 50` while folded, `Showing all 50` open), and draws every loaded error, folding back to `Show less`; a report of eight or fewer draws neither (#2266, #2884).
2222
- An error toast keeps the host's code: `reportError` in `index.js` puts `error.code` into the toast payload and `feedback.js` draws it as a `bt-tag bt-toast-code`, so a reader can tell `bot/read-only` from any other refusal. That code is also the one action a toast can take: a `bot/read-only` toast offers **Reload** (`bt-toast-reload`) in place, which dismisses the toast and runs the client's own full-state read (`actions.reloadTeam`), so the window becomes writable once the other holder let go without a page reload that would drop the composer; a failed read goes to `actions.reportError(error, 'reload')` the way the sidebar's Reload does. Every other code, and a toast with no code, draws the sentence and **Details** exactly as before (P-502). That sentence is never blank: `api.js` answers a host refusal that carries no message of its own with `Request failed` (`result.error?.message || 'Request failed'` on the thrown error and on the noted copy alike), so a surface that prints `error.message` shows a refusal rather than nothing, and a memory row whose count sentence tests the failure for truth settles on it instead of `Loading…` (#2411). Tests: `core/test/api-empty-message.test.js`.
2323
- A link picked in a chat message opens in FlyBot's own panel: a capture-phase click handler on each bubble and on the person's own line (`bubbleLinkClick` in `cells.js`; a group card's container carries none, so a reply's link opens the tab of the Bot that spoke) takes an `http(s)` anchor before the host's delegate does, puts a tab in the panel's browser view (the globe button's view) with `actions.browserNewTab` and carries the URL with `actions.browserNavigate`; `browserNewTab` answers `null` for a Bot outside the roster, and with no tab — or no Desktop bridge — the page opens in the window itself. A mention, a file link and a modified or middle click are left alone, and the bubble renders bare `MarkdownText` so the host's `openFile`/`fileImages` reach it: a nested `MarkdownDelegateProvider` replaces the host's capabilities, and one that lacked `fileImages` drew every bubble image as its alt text (#2319). Left to the host a click opened a tab in the host's right sidebar, which this panel's fixed layer covers, so the content area looked blank (#2201). Tests: `core/test/chat-link-open.test.js`.
2424

‎patches/ds-bot/0001-core-fixes.patch‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ diff --git a/src/client/feedback.js b/src/client/feedback.js
604604
return [
605605
h(Section, { key: 'report', title: t('Report a problem') },
606606
h('div', { className: 'bt-set-row bt-set-paste bt-fb-what' },
607-
@@ -99,23 +99,35 @@ export function FeedbackPage({ actions, run, Section, Row }) {
607+
@@ -99,23 +99,39 @@ export function FeedbackPage({ actions, run, Section, Row }) {
608608
h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => setPreview(!preview), 'aria-expanded': preview }, preview ? t('Hide') : t('Show')),
609609
h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: copyReport }, t('Copy'))),
610610
preview ? h('div', { className: 'bt-set-row bt-fb-preview' }, h('pre', { tabIndex: 0, 'aria-label': t('Diagnostics') }, report?.markdown || t('Loading…'))) : null,
@@ -632,6 +632,10 @@ diff --git a/src/client/feedback.js b/src/client/feedback.js
632632
entry.code ? h('span', { className: 'bt-tag bt-fb-code' }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null)),
633633
+ entries.length > 8
634634
+ ? h('div', { key: 'more', className: 'bt-set-row bt-fb-more-row' },
635+
+ h('span', { className: 'bt-set-hint bt-fb-count' },
636+
+ allErrors
637+
+ ? t('Showing all {count}', { count: entries.length })
638+
+ : t('Showing {shown} of {count}', { shown: shown.length, count: entries.length })),
635639
+ h('button', {
636640
+ type: 'button', className: 'bt-soft bt-soft-sm bt-fb-more', 'aria-expanded': allErrors,
637641
+ onClick: () => setAllErrors(!allErrors),
@@ -1072,7 +1076,14 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
10721076
'Add to group chat': '加入群聊',
10731077
'Message Bot': '给 Bot 发消息',
10741078
'To:': '发给:',
1075-
@@ -154,9 +154,24 @@ const ZH = {
1079+
@@ -149,14 +149,31 @@ const ZH = {
1080+
About: '简介',
1081+
'Show less': '收起',
1082+
'Show more': '展开',
1083+
+ 'Showing {shown} of {count}': '显示 {shown} / {count}',
1084+
+ 'Showing all {count}': '显示全部 {count}',
1085+
'Admin leads': '管理员主持',
1086+
'Plain messages go to the admin, who calls others with @Name.': '普通消息先给管理员,由管理员用 @名字 点名其他成员。',
10761087
Everyone: '所有人',
10771088
'Every member answers in turn, admin first.': '每位成员轮流回答,管理员先说。',
10781089
'Members · {count}': '成员 · {count}',

0 commit comments

Comments
 (0)