Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3032-approval-card-copy.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The last four English controls on the approval cards — another owner's "Waiting for the owner's approval" line, the per-pair Auto-send from now on link on the in-chat card and on a held reply's bubble, and the friend panel's Decline button and pending tag — now follow the window's language ([#3032](https://github.com/ThinkFlowLab/FlyBot/issues/3032)).
5 changes: 5 additions & 0 deletions core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ var ZH = {
"no longer shared": "已不再共享",
"Messages waiting for your approval": "等你批准的消息",
"Waiting for approval": "等待批准",
// #3032: the four approval-card controls that were still drawn as bare English.
"Waiting for the owner's approval": "等待 owner 批准",
"Auto-send from now on": "以后自动发送",
Decline: "拒绝",
pending: "等待中",
"Decide on the reply bubble above.": "在上面的回复气泡里批准。",
"Decide in {name}'s chat.": "在 {name} 的聊天里批准。",
"Not sent": "未发出",
Expand Down
5 changes: 5 additions & 0 deletions core/src/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ const ZH = {
'no longer shared': '已不再共享',
'Messages waiting for your approval': '等你批准的消息',
'Waiting for approval': '等待批准',
// #3032: the four approval-card controls that were still drawn as bare English.
"Waiting for the owner's approval": '等待 owner 批准',
'Auto-send from now on': '以后自动发送',
Decline: '拒绝',
pending: '等待中',
'Decide on the reply bubble above.': '在上面的回复气泡里批准。',
"Decide in {name}'s chat.": '在 {name} 的聊天里批准。',
'Not sent': '未发出',
Expand Down
5 changes: 0 additions & 5 deletions core/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"plugins/social/client.js:Anyone with the number can still join.",
"plugins/social/client.js:Ask them to share a Bot",
"plugins/social/client.js:Auto-send",
"plugins/social/client.js:Auto-send from now on#1",
"plugins/social/client.js:Auto-send from now on#2",
"plugins/social/client.js:Auto-send off",
"plugins/social/client.js:Auto-send on",
"plugins/social/client.js:Bot Social could not look up that link right now. Try again.",
Expand All @@ -18,7 +16,6 @@
"plugins/social/client.js:Could not copy. Select the link and copy it by hand.#1",
"plugins/social/client.js:Could not copy. Select the link and copy it by hand.#2",
"plugins/social/client.js:Could not reach FlyBot. Check that it is still running.",
"plugins/social/client.js:Decline",
"plugins/social/client.js:Declined {}.",
"plugins/social/client.js:Don't ask each time.#1",
"plugins/social/client.js:Don't ask each time.#2",
Expand Down Expand Up @@ -99,7 +96,6 @@
"plugins/social/client.js:Too many tries for now. Wait a minute and try again.",
"plugins/social/client.js:Waiting for others to join…#1",
"plugins/social/client.js:Waiting for others to join…#2",
"plugins/social/client.js:Waiting for the owner's approval",
"plugins/social/client.js:Which of your Bots talks",
"plugins/social/client.js:Which of your Bots to share",
"plugins/social/client.js:Who has joined#1",
Expand All @@ -110,7 +106,6 @@
"plugins/social/client.js:Your own Bots stay shared. {} can share it again.",
"plugins/social/client.js:mine#1",
"plugins/social/client.js:mine#2",
"plugins/social/client.js:pending",
"plugins/social/client.js:the group",
"plugins/social/client.js:the room",
"plugins/social/client.js:{} (you)",
Expand Down
11 changes: 6 additions & 5 deletions core/test/i18n-missing-entries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,16 @@ test('glyphs, bare digits and separators drawn as children are not pins', () =>
})

// The same sentence drawn through an attribute and as a child is two positions in one file, so it
// keeps two pins in #3026's shape: the attribute `#1`, the child `#2`.
// keeps two pins in #3026's shape: the attribute `#1`, the child `#2`. The sample is a sentence with
// no zh entry; #3032 gave `Decline` one, so this test moved to a string that is still a gap.
test('a sentence drawn as an attribute and as a child keeps two pins', () => {
const source = [
"h(Button, { title: 'Decline' })",
"h(Button, null, 'Decline')",
"h(Button, { title: 'Reopen the room' })",
"h(Button, null, 'Reopen the room')",
].join('\n')
assert.deepEqual(baselineOf(missingCopy(source, 'plugins/sample/client.js')), [
'plugins/sample/client.js:Decline#1',
'plugins/sample/client.js:Decline#2',
'plugins/sample/client.js:Reopen the room#1',
'plugins/sample/client.js:Reopen the room#2',
])
})

Expand Down
7 changes: 6 additions & 1 deletion patches/ds-bot/0001-core-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
Content: '内容',
'Referenced {labels}': '引用了 {labels}',
', ': '、',
@@ -41,22 +41,81 @@ const ZH = {
@@ -41,22 +41,86 @@ const ZH = {
' and ': '、',
and: '和',
'{count} members': '{count} 位成员',
Expand Down Expand Up @@ -902,6 +902,11 @@ diff --git a/src/client/i18n.js b/src/client/i18n.js
+ 'no longer shared': '已不再共享',
+ 'Messages waiting for your approval': '等你批准的消息',
+ 'Waiting for approval': '等待批准',
+ // #3032: the four approval-card controls that were still drawn as bare English.
+ "Waiting for the owner's approval": '等待 owner 批准',
+ 'Auto-send from now on': '以后自动发送',
+ Decline: '拒绝',
+ pending: '等待中',
+ 'Decide on the reply bubble above.': '在上面的回复气泡里批准。',
+ "Decide in {name}'s chat.": '在 {name} 的聊天里批准。',
+ 'Not sent': '未发出',
Expand Down
7 changes: 6 additions & 1 deletion patches/ds-bot/0008-client-bundle.patch
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ diff --git a/client.js b/client.js
Content: "内容",
"Referenced {labels}": "引用了 {labels}",
", ": "、",
@@ -78,21 +78,80 @@ var ZH = {
@@ -78,21 +78,85 @@ var ZH = {
" and ": "、",
and: "和",
"{count} members": "{count} 位成员",
Expand Down Expand Up @@ -209,6 +209,11 @@ diff --git a/client.js b/client.js
+ "no longer shared": "已不再共享",
+ "Messages waiting for your approval": "等你批准的消息",
+ "Waiting for approval": "等待批准",
+ // #3032: the four approval-card controls that were still drawn as bare English.
+ "Waiting for the owner's approval": "等待 owner 批准",
+ "Auto-send from now on": "以后自动发送",
+ Decline: "拒绝",
+ pending: "等待中",
+ "Decide on the reply bubble above.": "在上面的回复气泡里批准。",
+ "Decide in {name}'s chat.": "在 {name} 的聊天里批准。",
+ "Not sent": "未发出",
Expand Down
5 changes: 0 additions & 5 deletions patches/ds-bot/files/test/i18n-missing-entries.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"plugins/social/client.js:Anyone with the number can still join.",
"plugins/social/client.js:Ask them to share a Bot",
"plugins/social/client.js:Auto-send",
"plugins/social/client.js:Auto-send from now on#1",
"plugins/social/client.js:Auto-send from now on#2",
"plugins/social/client.js:Auto-send off",
"plugins/social/client.js:Auto-send on",
"plugins/social/client.js:Bot Social could not look up that link right now. Try again.",
Expand All @@ -18,7 +16,6 @@
"plugins/social/client.js:Could not copy. Select the link and copy it by hand.#1",
"plugins/social/client.js:Could not copy. Select the link and copy it by hand.#2",
"plugins/social/client.js:Could not reach FlyBot. Check that it is still running.",
"plugins/social/client.js:Decline",
"plugins/social/client.js:Declined {}.",
"plugins/social/client.js:Don't ask each time.#1",
"plugins/social/client.js:Don't ask each time.#2",
Expand Down Expand Up @@ -99,7 +96,6 @@
"plugins/social/client.js:Too many tries for now. Wait a minute and try again.",
"plugins/social/client.js:Waiting for others to join…#1",
"plugins/social/client.js:Waiting for others to join…#2",
"plugins/social/client.js:Waiting for the owner's approval",
"plugins/social/client.js:Which of your Bots talks",
"plugins/social/client.js:Which of your Bots to share",
"plugins/social/client.js:Who has joined#1",
Expand All @@ -110,7 +106,6 @@
"plugins/social/client.js:Your own Bots stay shared. {} can share it again.",
"plugins/social/client.js:mine#1",
"plugins/social/client.js:mine#2",
"plugins/social/client.js:pending",
"plugins/social/client.js:the group",
"plugins/social/client.js:the room",
"plugins/social/client.js:{} (you)",
Expand Down
11 changes: 6 additions & 5 deletions patches/ds-bot/files/test/i18n-missing-entries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,16 @@ test('glyphs, bare digits and separators drawn as children are not pins', () =>
})

// The same sentence drawn through an attribute and as a child is two positions in one file, so it
// keeps two pins in #3026's shape: the attribute `#1`, the child `#2`.
// keeps two pins in #3026's shape: the attribute `#1`, the child `#2`. The sample is a sentence with
// no zh entry; #3032 gave `Decline` one, so this test moved to a string that is still a gap.
test('a sentence drawn as an attribute and as a child keeps two pins', () => {
const source = [
"h(Button, { title: 'Decline' })",
"h(Button, null, 'Decline')",
"h(Button, { title: 'Reopen the room' })",
"h(Button, null, 'Reopen the room')",
].join('\n')
assert.deepEqual(baselineOf(missingCopy(source, 'plugins/sample/client.js')), [
'plugins/sample/client.js:Decline#1',
'plugins/sample/client.js:Decline#2',
'plugins/sample/client.js:Reopen the room#1',
'plugins/sample/client.js:Reopen the room#2',
])
})

Expand Down
10 changes: 5 additions & 5 deletions plugins/social/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ window.__ModuleLoader__.load({
: String(text).replace(/\{(\w+)\}/g, (_, key) => String(params?.[key] ?? '')))
const place = item.place
return h('div', { className: 'fs-hold fs-chat-approval', 'data-flybot': 'chat-approval', 'data-role': 'other', role: 'status' },
h('div', { className: 'fs-name' }, WAITING_OTHERS),
h('div', { className: 'fs-name' }, tr(WAITING_OTHERS)),
place?.bubble ? h('div', { className: 'fs-sub', 'data-flybot': 'waiting-place' }, tr('Decide on the reply bubble above.')) : null,
place?.chatId ? h('div', { className: 'fs-sub', 'data-flybot': 'waiting-place' }, tr("Decide in {name}'s chat.", { name: place.name })) : null,
place?.chatId && typeof onOpen === 'function'
Expand Down Expand Up @@ -2199,7 +2199,7 @@ window.__ModuleLoader__.load({
h('button', { type: 'button', className: 'fs-btn fs-btn-sm fs-btn-primary', disabled: !!busy, onClick: () => onDecide?.(item, 'approve') }, tr('Approve')),
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', disabled: !!busy, onClick: () => onDecide?.(item, 'reject') }, tr('Reject'))),
// Two buttons are the decision; the standing choice is a quiet link, not a third button (#260).
h('button', { type: 'button', className: 'fs-link fs-hold-always', 'data-flybot': 'hold-always', disabled: !!busy, onClick: () => onDecide?.(item, 'always') }, AUTO_SEND_LINK)))
h('button', { type: 'button', className: 'fs-link fs-hold-always', 'data-flybot': 'hold-always', disabled: !!busy, onClick: () => onDecide?.(item, 'always') }, tr(AUTO_SEND_LINK))))
}

function approvalsForOpenChat(items, { sessionId, room, bot, roster } = {}) {
Expand Down Expand Up @@ -2857,7 +2857,7 @@ window.__ModuleLoader__.load({
h('span', { className: 'fs-hold-decide' },
h('button', { type: 'button', className: 'fs-btn fs-btn-sm fs-btn-primary', disabled: busy, onClick: () => onDecide('approve') }, tr('Approve')),
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', disabled: busy, onClick: () => onDecide('reject') }, tr('Reject'))),
h('button', { type: 'button', className: 'fs-link fs-hold-always', 'data-flybot': 'hold-always', disabled: busy, onClick: () => onDecide('always') }, AUTO_SEND_LINK)))
h('button', { type: 'button', className: 'fs-link fs-hold-always', 'data-flybot': 'hold-always', disabled: busy, onClick: () => onDecide('always') }, tr(AUTO_SEND_LINK))))
}

function FriendBotRow({ bot, chat, renderBot, busy, onRemove }) {
Expand Down Expand Up @@ -3521,15 +3521,15 @@ window.__ModuleLoader__.load({
item.message ? h('span', { className: 'fs-sub fs-msg' }, item.message) : null),
h('span', { className: 'fs-actions' },
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', disabled: busy, onClick: () => respond(item, 'accept') }, tr('Accept')),
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', disabled: busy, onClick: () => respond(item, 'decline') }, 'Decline'))))) : null,
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', disabled: busy, onClick: () => respond(item, 'decline') }, tr('Decline')))))) : null,
outgoing.length ? h('div', { className: 'bt-social-outgoing' },
h('div', { className: 'fs-label' }, tr('Waiting for them to accept')),
outgoing.map(item => h('div', { key: item.relationshipId ?? item.handle, className: 'fs-row' },
h(FaceAvatar, { bot: faceLook({ member: { handle: item.handle, displayName: item.name } }), size: 24 }),
h('span', { className: 'fs-text' },
h('span', { className: 'fs-name' }, item.name ?? item.handle),
item.name ? h('span', { className: 'fs-sub' }, item.handle) : null),
h('span', { className: 'fs-tag' }, 'pending')))) : null,
h('span', { className: 'fs-tag' }, tr('pending'))))) : null,
onDone ? h('div', { className: 'fs-line', 'data-flybot': 'add-friend-done', style: { padding: '6px 10px 2px', justifyContent: 'flex-end' } },
h('button', { type: 'button', className: 'fs-btn fs-btn-sm', onClick: onDone }, tr('Done'))) : null)
}
Expand Down
44 changes: 41 additions & 3 deletions plugins/social/test/zh-approval-cards.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ const hostT = (text, params) => {
return String(hit).replace(/\{(\w+)\}/g, (_, key) => String(params?.[key] ?? ''))
}

function fixtures({ incoming = [], grants = [], friends = undefined } = {}) {
function fixtures({ incoming = [], outgoing = [], grants = [], friends = undefined } = {}) {
globalThis.__flybot__ = {
t: hostT,
call: (endpoint) => {
if (endpoint === 'social/access') return Promise.resolve({ grants, note: '' })
if (endpoint === 'social/overview') return Promise.resolve({ incoming, outgoing: [] })
if (endpoint === 'social/overview') return Promise.resolve({ incoming, outgoing })
if (endpoint === 'social/status') return Promise.resolve({ bots: [], home: '' })
if (endpoint === 'social/face-rooms') return Promise.resolve({ rooms: [] })
if (endpoint === 'social/settings') return Promise.resolve({})
Expand Down Expand Up @@ -218,6 +218,44 @@ test('#3004: the two inline confirmations speak the window’s language', async
} finally { delete globalThis.__flybot__ }
})

// #3032: the four controls #3004 left English — the other owner's card title, the per-pair Auto-send
// link on both cards, and the friend row's Decline and pending tag. Each one is drawn on the card a
// reader sees, so each is asserted where it is drawn and the English is asserted absent.
test('#3032: the last four approval-card controls speak the window’s language', async () => {
const app = loadApp()
const english = "Waiting for the owner's approval"
fixtures({ incoming: [{ relationshipId: 'rel9', handle: '@eve.home', name: 'Eve' }], outgoing: [{ relationshipId: 'rel2', handle: '@sam.home', name: 'Sam' }] })
try {
const mine = { hooks: {}, effects: [], props: { item: pendingItem, canDecide: true, onDecide() {} } }
const owner = drawn(render(app.ChatApproval, mine))
assert.ok(owner.includes(zh['Auto-send from now on']), `expected ${zh['Auto-send from now on']} on the owner card, saw ${JSON.stringify(owner)}`)
assert.ok(!owner.includes('Auto-send from now on'), 'the English Auto-send link is still drawn on the owner card')

const held = { hooks: {}, effects: [], props: { held: { id: 'h1', from: '@me.home', to: '@eve.home' }, decide: async () => {} } }
const bubble = drawn(render(app.HeldReplyCard, held))
assert.ok(bubble.includes(zh['Auto-send from now on']), `expected ${zh['Auto-send from now on']} on the held-reply card, saw ${JSON.stringify(bubble)}`)
assert.ok(!bubble.includes('Auto-send from now on'), 'the English Auto-send link is still drawn on the held-reply card')

// Another owner's card is the one the core dock renders with its own `t` prop (flybot-slots.js
// passes it), so the test hands it the same translator the dock does.
const other = { hooks: {}, effects: [], props: { item: pendingItem, canDecide: false, t: hostT } }
const peer = drawn(render(app.ChatApproval, other))
assert.ok(peer.includes(zh[english]), `expected ${zh[english]} on another owner's card, saw ${JSON.stringify(peer)}`)
assert.ok(!peer.includes(english), 'the English waiting line is still drawn on another owner’s card')

const friend = { hooks: {}, effects: [], props: { onDone() {} } }
render(app.AddFriend, friend)
runEffects(friend)
await tick()
await tick()
const words = drawn(render(app.AddFriend, friend))
for (const key of ['Decline', 'pending']) {
assert.ok(words.includes(zh[key]), `expected ${zh[key]} (${key}) on the friend panel, saw ${JSON.stringify(words)}`)
assert.ok(!words.includes(key), `the English ${JSON.stringify(key)} is still drawn on the friend panel`)
}
} finally { delete globalThis.__flybot__ }
})

// The other direction: with no translator bound, the same cards keep today's English byte for byte
// (a zh window is the only thing this change is allowed to move).
test('#3004: with no translator the cards keep today’s English', () => {
Expand All @@ -226,7 +264,7 @@ test('#3004: with no translator the cards keep today’s English', () => {
try {
const inst = { hooks: {}, effects: [], props: { item: pendingItem, canDecide: true, onDecide() {} } }
const words = drawn(render(app.ChatApproval, inst))
for (const key of ['Waiting for approval', 'Show more', 'Approve', 'Reject']) {
for (const key of ['Waiting for approval', 'Show more', 'Approve', 'Reject', 'Auto-send from now on']) {
assert.ok(words.includes(key), `expected ${JSON.stringify(key)}, saw ${JSON.stringify(words)}`)
}
} finally { delete globalThis.__flybot__ }
Expand Down
Loading