oficina / base Public

Stop naming Equipo in Ask Base's chat, setup and Settings

Apply Paul's approved rewording (Review 8, copy-review
c3ipwcupsvwv7rpbj2kdbgrsyy, unchanged): the chat, the setup page and the
Settings row say Ask Base and never Equipo. The header's menu with
"Open Equipo" goes (D12), with its script and styles. The runner notes
keep their links. Tests: TestAskNamesNoEquipo, TestAskApprovedWords.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 179847c28e0651066b98b9dbecfc9e2742ab605e parent edd6089
14 files changed, +211 −143
  • docs/copy-pending.md +29 −0
  • internal/browsertest/ask_test.go +9 −46
  • internal/browsertest/mobile_test.go +3 −10
  • internal/browsertest/scroll_test.go +2 −2
  • internal/equipo/equipotest/chat.go +4 −0
  • internal/look/static/app.css +2 −12
  • internal/look/static/ask.js +4 −26
  • internal/web/ask.go +3 −3
  • internal/web/ask_connect.go +2 −2
  • internal/web/templates/ask_connect.html +6 −6
  • internal/web/templates/partials/chat.html +11 −13
  • internal/web/templates/settings.html +1 −1
  • internal/webtest/ask_test.go +132 −19
  • internal/webtest/settings_test.go +3 −3
diff --git a/docs/copy-pending.md b/docs/copy-pending.md
index 0aead62..e4046c1 100644
--- a/docs/copy-pending.md
+++ b/docs/copy-pending.md
@@ -16,6 +16,8 @@ Review 6 (Base's "Publishing failed.", reviewed with Equipo's publish strings) a
Review 7 (the Assistant: Base's operations and their errors, the runner notes, "Connected as", the Assistant wording, README and roadmap) and Review 6's "Jump to latest" approved by Paul on 2026-11-13, unchanged (copy-review 7omq3rnlcdgc7pto7smfmpynfm).
+Review 8 (Base never names Equipo in the chat, setup or Settings) approved by Paul on 2026-11-13, unchanged (copy-review c3ipwcupsvwv7rpbj2kdbgrsyy).
+
| File | Context | Text |
|---|---|---|
| internal/web/templates/signin.html | Sign-in page, title and heading | Sign in to {Base name} |
@@ -333,3 +335,30 @@ Review 7 (approved 2026-11-13): Base's operations for Equipo's Assistant. The As
| internal/web/templates/ask_connect.html | CHANGED (as above): the connect page before connecting | ~~Connect Equipo, and its coordinator answers you in Base.~~ → Connect Equipo, and its Assistant answers you in Base. |
| README.md | Settings: the BASE_EQUIPO_ORIGIN bullet, its first sentence (changed) and the new lines after it | `BASE_EQUIPO_ORIGIN` is the Equipo whose Assistant answers "Ask Base anything" (was: whose coordinator answers). New: When a person connects, Base tells Equipo its own address (`BASE_ORIGIN`) and gives it a token for that person alone. Equipo's Assistant uses the token to read Base's apps, people and settings as that person. Connecting again replaces the token, and disconnecting withdraws it. Equipo takes the address only if its operator lists it in `EQUIPO_ASSISTANT_HOSTS`. Until then the chat still works, but the Assistant can't see Base: Base logs `host_not_allowed` and tries again the next time the person opens the chat. |
| docs/roadmap.md | Working notes, steps 4 to 6 (lines 8 to 10), each changed to point at the Assistant's spec and slice 1 plan | 4: "What can I do": Equipo's Assistant learns what's in Base. Slice 1 of the Assistant, with step 6: spec … (§8, steps 1 to 4), plan …. Built (branch assistant, in Base and Equipo); Equipo's release to staging and the live check pending. / 5: the Assistant's `oficina` provider, the spec's §8 step 5, after slice 1. Needs oficina-connect deployed. / 6: "Build me a quick website": the Assistant hands it to the team, then asks "Publish it?". In slice 1 with step 4 (same spec and plan). |
+
+Review 8 (approved 2026-11-13): Base never names Equipo in the chat, setup or Settings.
+
+| File | Context | Text |
+|---|---|---|
+| partials/chat.html, ask_connect.html | CHANGED (Review 8): the lead before setup (the default, and the setup page's) | ~~Connect Equipo, and its Assistant answers you here. / …in Base.~~ → Set up Ask Base to start asking. |
+| partials/chat.html, ask_connect.html (title, heading, button), settings.html button | CHANGED (Review 8): setup button and the setup page's title and heading | ~~Connect Equipo~~ → Set up Ask Base |
+| partials/chat.html | CHANGED (Review 8): setup started | ~~You started connecting Equipo. Approve it there to start asking.~~ → You started setting up Ask Base. Approve it to start asking. |
+| partials/chat.html, settings.html button | CHANGED (Review 8): finish button | ~~Finish connecting~~ → Finish setting up |
+| partials/chat.html, ask_connect.html | CHANGED (Review 8): setup lost | ~~Base's connection to Equipo expired or was removed.~~ → Ask Base needs setting up again. |
+| partials/chat.html, ask_connect.html, settings.html button | CHANGED (Review 8): set up again button | ~~Reconnect Equipo~~ → Set it up again |
+| ask_connect.html | CHANGED (Review 8): the setup page, above the code | ~~In Equipo, check the request is from {{.Label}}, then type this code:~~ → Check the request is from {{.Label}}, then type this code: |
+| ask_connect.html | CHANGED (Review 8): the setup page's button to the page where the code is typed | ~~Open Equipo~~ → Approve it |
+| ask_connect.html | CHANGED (Review 8): the setup page, approval turned down | ~~Equipo didn't accept that request. Start again.~~ → That request wasn't accepted. Start again. |
+| ask.go, ask.js | CHANGED (Review 8): status while an answer is on its way | ~~Equipo is answering…~~ → Thinking… |
+| ask.go, ask.js | CHANGED (Review 8): status while the message is saved and nothing can answer yet | ~~Equipo can't answer right now. It will as soon as it can.~~ → Ask Base can't answer right now. It will as soon as it can. |
+| ask.go, ask.js | CHANGED (Review 8): a message did not send | ~~Equipo didn't get that. Try again.~~ → That didn't send. Try again. |
+| partials/chat.html, ask_connect.go | CHANGED (Review 8): the service behind Ask Base can't be reached | ~~Equipo isn't answering. Try again in a minute.~~ → Ask Base isn't answering. Try again in a minute. |
+| ask_connect.go | CHANGED (Review 8): the same during setup | ~~Equipo isn't answering. Base will keep trying.~~ → Ask Base isn't answering. It will keep trying. |
+| partials/chat.html | CHANGED (Review 8): no runner (the bracketed text is the link, still opening Equipo in a new tab) | ~~Ask Base needs a runner of your own to answer. [Add one in Equipo], then try again.~~ → Ask Base isn't set up for you yet. [Finish setting it up], then try again. |
+| partials/chat.html | CHANGED (Review 8): runner too old (the bracketed text is the link, as above) | ~~Your runner needs an update for this. [Update it in Equipo], then try again.~~ → Ask Base needs an update first. [Update it], then try again. |
+| settings.html | CHANGED (Review 8): the row's name | ~~Equipo~~ → Ask Base |
+| settings.html | CHANGED (Review 8): the row's value while waiting | ~~Waiting for your approval in Equipo~~ → Waiting for your approval |
+| settings.html | CHANGED (Review 8): the row's value when setup was lost | ~~Connection expired or removed~~ → Needs setting up again |
+| settings.html | CHANGED (Review 8): the row's value before setup | ~~Not connected~~ → Not set up |
+| ask_connect.html | Reused on the setup page (D12): the lead above takes the page's default wording and its Set up Ask Base heading and button, so the page and the chat say the same words | Set up Ask Base to start asking. |
+| partials/chat.html | REMOVED (D12, the ⋯ menu goes; Base never sends the person into Equipo as a step): the Ask panel header's ⋯ menu and its link | ~~Open Equipo~~ |
diff --git a/internal/browsertest/ask_test.go b/internal/browsertest/ask_test.go
index 4e84818..cf63b1a 100644
--- a/internal/browsertest/ask_test.go
+++ b/internal/browsertest/ask_test.go
@@ -37,7 +37,7 @@ func TestAskFieldOffIsGlass(t *testing.T) {
}
// askBase is Base answered by a fake Equipo, the owner signed in and
-// connected to it from Settings: Connect Equipo, approve the code in
+// connected to it from Settings: Set up Ask Base, approve the code in
// Equipo, Check again.
func askBase(t *testing.T) (*harness.Rig, *equipotest.Fake) {
t.Helper()
@@ -80,7 +80,7 @@ func askBaseOn(t *testing.T, tweak func(*config.Config), view chromedp.Action[ch
connect := `form[action="/ask/connect"] button`
drive(t, rig, chromedp.Navigate(rig.Origin+"/settings"), chromedp.WaitVisible(chromedp.CSS(connect)),
chromedp.Click(chromedp.CSS(connect)), chromedp.WaitVisible(chromedp.CSS(`p.code`)))
- rig.Screen(".card", "Connect Equipo, waiting for approval")
+ rig.Screen(".card", "Set up Ask Base, waiting for approval")
code := harness.Evaluate[string](rig, `document.querySelector("p.code").textContent`)
if !regexp.MustCompile(`^[A-Z0-9]{8}$`).MatchString(code) {
t.Fatalf("code %q", code)
@@ -93,7 +93,7 @@ func askBaseOn(t *testing.T, tweak func(*config.Config), view chromedp.Action[ch
}
drive(t, rig, chromedp.Click(chromedp.CSS(`form[action="/ask/connect/check"] button`)),
chromedp.WaitVisible(chromedp.CSS(`form[action="/ask/disconnect"]`)))
- rig.Screen(".sheet", "Settings, Equipo connected")
+ rig.Screen(".sheet", "Settings, Ask Base set up")
return rig, f, b
}
@@ -120,7 +120,7 @@ func TestAskPanelSendsOnce(t *testing.T) {
f.FailNextSend()
drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-text`), "Put a meeting in my calendar with doc@tito.io for 2pm on Tuesday"),
chromedp.Click(chromedp.CSS(send)),
- chromedp.Poll[chromedp.Void](`document.querySelector("#ask-panel .ask-status").textContent.includes("didn't get that")`, chromedp.WithPollingTimeout(5*time.Second)),
+ chromedp.Poll[chromedp.Void](`document.querySelector("#ask-panel .ask-status").textContent.includes("didn't send")`, chromedp.WithPollingTimeout(5*time.Second)),
chromedp.Click(chromedp.CSS(send)),
// A send that got its answer clears the field.
chromedp.Poll[chromedp.Void](`document.querySelector("#ask-text").value === ""`, chromedp.WithPollingTimeout(5*time.Second)))
@@ -145,7 +145,7 @@ func TestAskPanelNoRunner(t *testing.T) {
old := `#ask-panel .ask-runner[data-when="oldrunner"]`
drive(t, rig, chromedp.WaitVisible(chromedp.CSS(note)))
if !harness.Evaluate[bool](rig, `!!document.querySelector(`+strconv.Quote(note+` a[href="`+f.URL+`/"][target="_blank"]`)+`)`) {
- t.Fatal("the no-runner note has no link to Equipo")
+ t.Fatal("the no-runner note has no link to finish setting up")
}
rig.Screen("#ask-panel", "the panel without a runner")
// Each send moves the panel from one note to the other.
@@ -217,46 +217,9 @@ func TestAskPanel(t *testing.T) {
}
}
- // The ⋯ menu holds Open Equipo. Escape closes the menu (not the panel)
- // and gives focus back to ⋯; a click elsewhere closes it too.
- more, menuLink := `#ask-panel summary[aria-label="More"]`, `#ask-panel .ask-menu a[href^="`+f.URL+`"][target="_blank"][rel="noopener"]`
- drive(t, rig, chromedp.Click(chromedp.CSS(more)), chromedp.WaitVisible(chromedp.CSS(menuLink)))
- if got := harness.Evaluate[string](rig, `document.querySelector(`+strconv.Quote(menuLink)+`).textContent`); got != "Open Equipo" {
- t.Errorf("menu item %q", got)
- }
- drive(t, rig, chromedp.KeyEvent("\u001b"), chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel details.ask-more").open`, chromedp.WithPollingTimeout(3*time.Second)),
- chromedp.Poll[chromedp.Void](`document.activeElement.matches("summary")`, chromedp.WithPollingTimeout(3*time.Second)))
- if !harness.Evaluate[bool](rig, `document.querySelector("#ask-panel").open`) {
- t.Fatal("Escape in the menu closed the panel")
- }
- drive(t, rig, chromedp.Click(chromedp.CSS(more)), chromedp.WaitVisible(chromedp.CSS(menuLink)),
- chromedp.Click(chromedp.CSS(`#ask-panel .thread`)), chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel details.ask-more").open`, chromedp.WithPollingTimeout(3*time.Second)))
-
- // A click elsewhere (here, into the message field) closes the menu and
- // leaves focus where the person clicked; only Escape goes back to ⋯.
- drive(t, rig, chromedp.Click(chromedp.CSS(more)), chromedp.WaitVisible(chromedp.CSS(menuLink)),
- chromedp.Click(chromedp.CSS(`#ask-text`)),
- chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel details.ask-more").open`, chromedp.WithPollingTimeout(3*time.Second)),
- chromedp.Sleep(100*time.Millisecond))
- if got := harness.Evaluate[string](rig, `document.activeElement.id || document.activeElement.outerHTML.slice(0, 60)`); got != "ask-text" {
- t.Errorf("after clicking the message field with the menu open, focus is on %s", got)
- }
-
- // With the menu open and focus moved on past Open Equipo to Close, the
- // first Escape still closes only the menu and puts focus back on ⋯.
- drive(t, rig, chromedp.Click(chromedp.CSS(more)), chromedp.WaitVisible(chromedp.CSS(menuLink)),
- chromedp.KeyEvent("\t"), chromedp.KeyEvent("\t"),
- chromedp.Poll[chromedp.Void](`document.activeElement.matches("#ask-panel .close")`, chromedp.WithPollingTimeout(3*time.Second)),
- chromedp.KeyEvent("\u001b"),
- chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel details.ask-more").open`, chromedp.WithPollingTimeout(3*time.Second)),
- chromedp.Sleep(200*time.Millisecond))
- if got := harness.Evaluate[string](rig, `(() => {
- const p = [];
- if (!document.querySelector("#ask-panel").open) p.push("the panel closed");
- if (!document.activeElement.matches("#ask-panel summary")) p.push("focus is on " + document.activeElement.outerHTML.slice(0, 60));
- return p.join("; ");
- })()`); got != "" {
- t.Fatalf("Escape with the menu open and focus on Close: %s", got)
+ // There is no ⋯ menu: the header holds the title and Close.
+ if harness.Evaluate[bool](rig, `!!document.querySelector("#ask-panel .ask-head summary, #ask-panel .ask-head a")`) {
+ t.Error("the panel's header still has a menu or a link")
}
// The next Escape closes the panel.
@@ -334,7 +297,7 @@ func TestAskComposerSendAndStop(t *testing.T) {
const others = [...document.querySelectorAll("#ask-panel button")].filter(x => x !== b && /Stop/.test(x.textContent) && x.checkVisibility());
if (others.length) p.push(others.length + " other Stop buttons");
const st = document.querySelector("#ask-panel .ask-status");
- if (st.textContent !== "Equipo is answering…") p.push("status " + st.textContent);
+ if (st.textContent !== "Thinking…") p.push("status " + st.textContent);
if (st.getBoundingClientRect().bottom > document.querySelector("#ask-text").getBoundingClientRect().top + 0.5) p.push("status not above the field");
return p.join("; ");
})()`); got != "" {
diff --git a/internal/browsertest/mobile_test.go b/internal/browsertest/mobile_test.go
index 04670e6..204d89f 100644
--- a/internal/browsertest/mobile_test.go
+++ b/internal/browsertest/mobile_test.go
@@ -149,17 +149,14 @@ func TestMobile(t *testing.T) {
if (head.top < 0 || head.top > 1) problems.push("header at " + head.top);
const c = document.querySelector("#ask-panel form.composer").getBoundingClientRect();
if (c.top < 0 || c.bottom > vh + 0.5 || c.height === 0) problems.push("composer at " + c.top + "-" + c.bottom + " of " + vh);
- const more = document.querySelector("#ask-panel .ask-head summary");
- if (!more || more.getAttribute("aria-label") !== "More") problems.push("no ⋯ button");
- const link = document.querySelector("#ask-panel .ask-head a[target=_blank]");
- if (link && link.checkVisibility()) problems.push("Open Equipo shows in the header");
+ if (document.querySelector("#ask-panel .ask-head summary, #ask-panel .ask-head a")) problems.push("the header has a menu or a link");
if (head.height > 64) problems.push("header is " + head.height + "px tall");
// Send shows once something is typed.
const ta = document.querySelector("#ask-text");
ta.value = "x";
ta.dispatchEvent(new Event("input"));
for (const a of document.querySelector("#ask-panel form.composer button.send").getAnimations()) a.finish(); // measured once it has grown in
- for (const el of document.querySelectorAll("#ask-panel .ask-head summary, #ask-panel .ask-head .close, #ask-panel form.composer button.send, #ask-panel textarea")) {
+ for (const el of document.querySelectorAll("#ask-panel .ask-head .close, #ask-panel form.composer button.send, #ask-panel textarea")) {
const r = el.getBoundingClientRect();
if (r.height < 44 || r.width < 44) problems.push((el.getAttribute("aria-label") || el.textContent.trim()) + " is " + r.width + "x" + r.height);
}
@@ -169,7 +166,7 @@ func TestMobile(t *testing.T) {
ta.dispatchEvent(new Event("input"));
if (field.left > 12 || vw - send.right > 12) problems.push("composer gaps " + field.left + " and " + (vw - send.right));
const st = document.querySelector("#ask-panel .ask-status");
- st.textContent = "Equipo is answering…";
+ st.textContent = "Thinking…";
if (Math.abs(st.getBoundingClientRect().left - field.left) > 1) problems.push("status at " + st.getBoundingClientRect().left + ", composer at " + field.left);
st.textContent = "";
const m = document.querySelector("#ask-panel .msg.coordinator").getBoundingClientRect();
@@ -186,10 +183,6 @@ func TestMobile(t *testing.T) {
t.Errorf("Home behind the open sheet: %s, want scaled to 0.94 and blurred", got)
}
mobileShot(t, rig, "4c-panel-tight")
- mobileShot(t, rig, "4d-panel-menu-closed")
- drive(t, rig, chromedp.Click(chromedp.CSS(`#ask-panel summary`)), chromedp.WaitVisible(chromedp.CSS(`#ask-panel .ask-menu a`)))
- mobileShot(t, rig, "4e-panel-menu-open")
- drive(t, rig, chromedp.Click(chromedp.CSS(`#ask-panel summary`)), chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel details.ask-more").open`, chromedp.WithPollingTimeout(3*time.Second)))
drive(t, rig, chromedp.KeyEvent("\u001b"),
chromedp.Poll[chromedp.Void](`!document.querySelector("#ask-panel").open`, chromedp.WithPollingTimeout(3*time.Second)))
// Focus goes back once the close event has run.
diff --git a/internal/browsertest/scroll_test.go b/internal/browsertest/scroll_test.go
index 412cd71..34cdf18 100644
--- a/internal/browsertest/scroll_test.go
+++ b/internal/browsertest/scroll_test.go
@@ -68,7 +68,7 @@ func TestAskScrollFollowsNewest(t *testing.T) {
}
// Send while the coordinator has not started: the person's bubble
- // is wholly above "Equipo is answering…" and Stop.
+ // is wholly above "Thinking…" and Stop.
send := func(text string) {
t.Helper()
// Enter sends, as a person does on a keyboard; scrolled to the
@@ -93,7 +93,7 @@ func TestAskScrollFollowsNewest(t *testing.T) {
f.Hold = false
// Send: the log goes to the bottom, and stays there as the reply
- // streams in under "Equipo is answering…".
+ // streams in under "Thinking…".
send("What can I do")
wait(`(() => { const d = document.querySelector("#ask-panel .msg.draft"); return d && d.textContent.length > 120 })()`)
if got := harness.Evaluate[string](rig, lastVisible); got != "" {
diff --git a/internal/equipo/equipotest/chat.go b/internal/equipo/equipotest/chat.go
index 65b942f..54f51c3 100644
--- a/internal/equipo/equipotest/chat.go
+++ b/internal/equipo/equipotest/chat.go
@@ -395,6 +395,10 @@ func (f *Fake) answerTurn(id, text string) {
f.emit("turn", "turn", id, t.Revision, id, *t)
}
+// WaitTurn puts the turn with id in the waiting state: saved, with nothing
+// yet able to answer it.
+func (f *Fake) WaitTurn(id string) { f.setTurn(id, "waiting", "") }
+
func (f *Fake) setTurn(id, state, reason string) {
f.cmu.Lock()
defer f.cmu.Unlock()
diff --git a/internal/look/static/app.css b/internal/look/static/app.css
index 5f74336..d109e0d 100644
--- a/internal/look/static/app.css
+++ b/internal/look/static/app.css
@@ -451,21 +451,11 @@ dialog.ask-panel[open] { display: flex; transform: none; opacity: 1; }
dialog.ask-panel::backdrop { background: transparent; }
.ask-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--rule); }
.ask-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; font-variation-settings: "STYL" 0; }
-/* The header's round glass buttons: ⋯ (a menu holding Open Equipo) and close. */
+/* The header's round glass button: close. */
.ask-head .round { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
color: var(--frost); background: var(--chip); box-shadow: inset 0 0 0 1px var(--chip-edge); transition: background .2s, box-shadow .2s; }
-.ask-head .round:hover, .ask-more[open] > summary { background: var(--chip-hover); box-shadow: inset 0 0 0 1px var(--accent-edge); }
+.ask-head .round:hover { background: var(--chip-hover); box-shadow: inset 0 0 0 1px var(--accent-edge); }
.ask-head .round svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; fill: none; }
-.ask-more summary svg { width: 22px; height: 22px; stroke-width: 3.2; }
-.ask-more { position: relative; }
-.ask-more > summary { list-style: none; }
-.ask-more > summary::-webkit-details-marker { display: none; }
-.ask-menu { position: absolute; z-index: 2; right: 0; top: calc(100% + 6px); min-width: 180px; padding: 6px; border-radius: 12px;
- background: linear-gradient(var(--menu-1), var(--menu-2)), var(--menu-base);
- box-shadow: inset 0 1px 0 var(--menu-shine), 0 18px 40px -12px var(--menu-shadow); }
-.ask-menu a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--frost);
- text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; }
-.ask-menu a:hover, .ask-menu a:focus-visible { background: var(--hover); }
.ask-note { padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.ask-note p { margin: 0; color: var(--haze); }
.ask-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js
index a1896c1..a8620ef 100644
--- a/internal/look/static/ask.js
+++ b/internal/look/static/ask.js
@@ -234,8 +234,8 @@ function start(root) {
cancel.action = `/ask/turns/${encodeURIComponent(t.id)}/cancel`;
paint();
status.textContent = line || (t.state === "waiting"
- ? "Equipo can't answer right now. It will as soon as it can."
- : "Equipo is answering…");
+ ? "Ask Base can't answer right now. It will as soon as it can."
+ : "Thinking…");
return;
}
if (t && turn && t.id !== turn.id) return;
@@ -347,9 +347,9 @@ function start(root) {
// Otherwise the conversation stays, with a line to try again (a 409
// is stale: the next events show how things are).
if (["connect", "pending", "reconnect", ...runnerless].includes(out.state)) show(out.state);
- else if (res.status !== 409) status.textContent = "Equipo didn't get that. Try again.";
+ else if (res.status !== 409) status.textContent = "That didn't send. Try again.";
} catch {
- status.textContent = "Equipo didn't get that. Try again.";
+ status.textContent = "That didn't send. Try again.";
} finally {
req.busy = false;
if (known) sending.delete(form);
@@ -409,28 +409,6 @@ function start(root) {
if (out.turn) setTurn(out.turn);
});
- // The ⋯ menu: Escape and a click elsewhere close it. Escape gives focus
- // back to ⋯; a click leaves it where the person clicked. Without scripts
- // it is a plain <details>.
- const menus = [...root.querySelectorAll("details.ask-more")];
- for (const menu of menus) {
- document.addEventListener("click", (e) => {
- if (menu.open && !menu.contains(e.target)) menu.open = false;
- });
- menu.querySelector(".ask-menu a").addEventListener("click", () => { menu.open = false; });
- }
- // Escape anywhere in the panel (or the /ask page) closes an open menu
- // first, wherever focus is; only a later Escape closes the panel.
- // Cancelling the keydown stops the dialog's close request.
- (dialog || document).addEventListener("keydown", (e) => {
- if (e.key !== "Escape") return;
- const menu = menus.find((m) => m.open);
- if (!menu) return;
- e.preventDefault();
- menu.open = false;
- menu.querySelector("summary").focus();
- }, true);
-
if (!dialog) {
load();
return;
diff --git a/internal/web/ask.go b/internal/web/ask.go
index a412356..62d4967 100644
--- a/internal/web/ask.go
+++ b/internal/web/ask.go
@@ -176,9 +176,9 @@ func turnStatus(t *equipo.Turn) string {
case t == nil:
return ""
case t.State == equipo.TurnWaiting:
- return "Equipo can't answer right now. It will as soon as it can."
+ return "Ask Base can't answer right now. It will as soon as it can."
}
- return "Equipo is answering…"
+ return "Thinking…"
}
// fill puts a snapshot in the view: the messages, the cards to show and
@@ -250,7 +250,7 @@ func (a *app) askPageView(w http.ResponseWriter, r *http.Request) {
a.askSnapshot(r, me, l, sec.Token, &v)
}
if r.URL.Query().Get("problem") != "" && v.State == askReady {
- v.Problem = "Equipo didn't get that. Try again."
+ v.Problem = "That didn't send. Try again."
}
w.Header().Set("Cache-Control", "no-store")
a.render(w, r, "ask", askPage{Name: a.cfg.Name, Ask: v})
diff --git a/internal/web/ask_connect.go b/internal/web/ask_connect.go
index 60bf668..b170928 100644
--- a/internal/web/ask_connect.go
+++ b/internal/web/ask_connect.go
@@ -66,7 +66,7 @@ func (a *app) askConnectStart(w http.ResponseWriter, r *http.Request) {
if err != nil {
a.logger.Warn("ask: begin device", "err", err)
a.renderConnect(w, r, http.StatusBadGateway, connectView{State: askConnect, Next: next,
- Problem: "Equipo isn't answering. Try again in a minute."})
+ Problem: "Ask Base isn't answering. Try again in a minute."})
return
}
sealed, err := a.sealSecrets(me.ID, deviceSecrets{Seed: key.Seed(), Secret: ch.DeviceSecret,
@@ -123,7 +123,7 @@ func (a *app) askConnectPage(w http.ResponseWriter, r *http.Request) {
v.State = ended
}
if q.Get("problem") != "" && state == askPending {
- v.Problem = "Equipo isn't answering. Base will keep trying."
+ v.Problem = "Ask Base isn't answering. It will keep trying."
}
a.renderConnect(w, r, http.StatusOK, v)
}
diff --git a/internal/web/templates/ask_connect.html b/internal/web/templates/ask_connect.html
index 3204dc9..c871295 100644
--- a/internal/web/templates/ask_connect.html
+++ b/internal/web/templates/ask_connect.html
@@ -1,16 +1,16 @@
-{{define "title"}}Connect Equipo · {{.Name}}{{end}}
+{{define "title"}}Set up Ask Base · {{.Name}}{{end}}
{{define "main"}}<main class="signin">
<div class="card glass">
<div class="wordmark">base</div>
-<h2>Connect Equipo</h2>
-{{if eq .State "pending"}}<p>In Equipo, check the request is from {{.Label}}, then type this code:</p>
+<h2>Set up Ask Base</h2>
+{{if eq .State "pending"}}<p>Check the request is from {{.Label}}, then type this code:</p>
<p class="code" aria-label="Your code">{{.Code}}</p>
-<a class="btn full" href="{{.Verify}}" target="_blank" rel="noopener">Open Equipo</a>
+<a class="btn full" href="{{.Verify}}" target="_blank" rel="noopener">Approve it</a>
<p class="alt">Once you've approved it, come back and press Check again.</p>
<form method="post" action="/ask/connect/check" data-connect-check><input type="hidden" name="next" value="{{.Next}}"><button class="btn ghost full" type="submit">Check again</button></form>
<script type="module" src="{{asset "static/ask-connect.js"}}"></script>
-{{else}}<p>{{if eq .State "expired"}}That code expired. Start again to get a new one.{{else if eq .State "refused"}}Equipo didn't accept that request. Start again.{{else if eq .State "failed"}}That didn't work. Start again.{{else if eq .State "reconnect"}}Base's connection to Equipo expired or was removed.{{else}}Connect Equipo, and its Assistant answers you in Base.{{end}}</p>
-<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn full" type="submit">{{if eq .State "connect"}}Connect Equipo{{else if eq .State "reconnect"}}Reconnect Equipo{{else}}Start again{{end}}</button></form>
+{{else}}<p>{{if eq .State "expired"}}That code expired. Start again to get a new one.{{else if eq .State "refused"}}That request wasn't accepted. Start again.{{else if eq .State "failed"}}That didn't work. Start again.{{else if eq .State "reconnect"}}Ask Base needs setting up again.{{else}}Set up Ask Base to start asking.{{end}}</p>
+<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn full" type="submit">{{if eq .State "connect"}}Set up Ask Base{{else if eq .State "reconnect"}}Set it up again{{else}}Start again{{end}}</button></form>
<a class="btn ghost full" href="{{.Back}}">Back</a>
{{end}}{{with .Problem}}<p class="status" role="alert">{{.}}</p>{{end}}
</div>
diff --git a/internal/web/templates/partials/chat.html b/internal/web/templates/partials/chat.html
index 8cb7a37..3f0a925 100644
--- a/internal/web/templates/partials/chat.html
+++ b/internal/web/templates/partials/chat.html
@@ -1,9 +1,7 @@
{{/* The chat behind "Ask Base anything": the panel over Home, and /ask. Every state's block is drawn and the one for .State shows; the panel's script moves between them. */}}
-{{define "ask-head"}}<div class="ask-head"><h2 id="ask-title">Ask Base</h2>{{template "ask-more" .}}</div>{{end}}
-{{/* Open Equipo, behind a ⋯ menu: a <details>, so it opens without scripts. */}}
-{{define "ask-more"}}<details class="ask-more"><summary class="round" aria-label="More"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 12h.01M12 12h.01M18 12h.01"/></svg></summary><div class="ask-menu glass"><a href="{{.Equipo}}" target="_blank" rel="noopener">Open Equipo</a></div></details>{{end}}
+{{define "ask-head"}}<div class="ask-head"><h2 id="ask-title">Ask Base</h2></div>{{end}}
{{define "ask-panel"}}<dialog id="ask-panel" class="ask-panel glass" aria-labelledby="ask-title" data-ask data-state="{{.State}}">
-<div class="ask-head"><h2 id="ask-title">Ask Base</h2>{{template "ask-more" .}}<button class="round close" type="button" data-ask-close aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>
+<div class="ask-head"><h2 id="ask-title">Ask Base</h2><button class="round close" type="button" data-ask-close aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>
{{template "ask-body" .}}</dialog>{{end}}
{{/* A card, drawn from its fields alone: the question, a link per link, a button per option (its label, posting its value) while it is open, and the line saying how it ended. The panel's script draws the same (ask.js, addCard). */}}
{{define "ask-card"}}<li class="msg card card-{{.Kind}}" data-card="{{.ID}}" data-revision="{{.Revision}}"><p>{{.Question}}</p>
@@ -11,19 +9,19 @@
{{- if and .Open .Options}}<form class="choices" method="post" action="/ask/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="key" value="{{newKey}}">{{range .Options}}<button class="btn ghost" type="submit" name="choice" value="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}
{{- with .Result}}<p class="card-state">{{.}}</p>{{end}}</li>{{end}}
{{define "ask-body"}}<div class="ask-note" data-when="connect"{{if not (.Shows "connect")}} hidden{{end}}>
-<p>Connect Equipo, and its Assistant answers you here.</p>
-<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn" type="submit">Connect Equipo</button></form>
+<p>Set up Ask Base to start asking.</p>
+<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn" type="submit">Set up Ask Base</button></form>
</div>
<div class="ask-note" data-when="pending"{{if not (.Shows "pending")}} hidden{{end}}>
-<p>You started connecting Equipo. Approve it there to start asking.</p>
-<a class="btn" href="/ask/connect?next={{.Next}}">Finish connecting</a>
+<p>You started setting up Ask Base. Approve it to start asking.</p>
+<a class="btn" href="/ask/connect?next={{.Next}}">Finish setting up</a>
</div>
<div class="ask-note" data-when="reconnect"{{if not (.Shows "reconnect")}} hidden{{end}}>
-<p>Base's connection to Equipo expired or was removed.</p>
-<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn" type="submit">Reconnect Equipo</button></form>
+<p>Ask Base needs setting up again.</p>
+<form method="post" action="/ask/connect"><input type="hidden" name="next" value="{{.Next}}"><button class="btn" type="submit">Set it up again</button></form>
</div>
<div class="ask-note" data-when="unavailable"{{if not (.Shows "unavailable")}} hidden{{end}}>
-<p>Equipo isn't answering. Try again in a minute.</p>
+<p>Ask Base isn't answering. Try again in a minute.</p>
</div>
<div class="ask-chat" data-when="ready norunner oldrunner"{{if not (.Shows "ready norunner oldrunner")}} hidden{{end}}>
<div class="log"><ol class="thread" role="log" aria-label="Conversation">
@@ -33,8 +31,8 @@
<button class="jump" type="button" hidden>Jump to latest</button></div>
<p class="ask-empty" data-empty{{if or .Messages .Cards}} hidden{{end}}>Ask about your work, or ask Base to get something done.</p>
{{with .Problem}}<p class="ask-problem" role="alert">{{.}}</p>{{end}}
-{{/* Without a runner that can answer, the conversation shows and says so; what the person wrote stays in the field. */}}<p class="ask-problem ask-runner" data-when="norunner"{{if not (.Shows "norunner")}} hidden{{end}} role="alert">Ask Base needs a runner of your own to answer. <a href="{{.Equipo}}" target="_blank" rel="noopener">Add one in Equipo</a>, then try again.</p>
-<p class="ask-problem ask-runner" data-when="oldrunner"{{if not (.Shows "oldrunner")}} hidden{{end}} role="alert">Your runner needs an update for this. <a href="{{.Equipo}}" target="_blank" rel="noopener">Update it in Equipo</a>, then try again.</p>
+{{/* Without a runner that can answer, the conversation shows and says so; what the person wrote stays in the field. */}}<p class="ask-problem ask-runner" data-when="norunner"{{if not (.Shows "norunner")}} hidden{{end}} role="alert">Ask Base isn't set up for you yet. <a href="{{.Equipo}}" target="_blank" rel="noopener">Finish setting it up</a>, then try again.</p>
+<p class="ask-problem ask-runner" data-when="oldrunner"{{if not (.Shows "oldrunner")}} hidden{{end}} role="alert">Ask Base needs an update first. <a href="{{.Equipo}}" target="_blank" rel="noopener">Update it</a>, then try again.</p>
<div class="ask-foot">
<p class="ask-status" role="status">{{.Status}}</p>
</div>
diff --git a/internal/web/templates/settings.html b/internal/web/templates/settings.html
index 626ae4b..ab15db6 100644
--- a/internal/web/templates/settings.html
+++ b/internal/web/templates/settings.html
@@ -8,7 +8,7 @@
<li><div class="who">Signed in as<small>{{.Address}}</small></div></li>
<li><div class="who" id="appearance">Appearance</div><form class="segmented" method="post" action="/settings/appearance" role="group" aria-labelledby="appearance">{{range .Themes}}<button type="submit" name="theme" value="{{.Value}}" aria-pressed="{{.On}}">{{.Label}}</button>{{end}}</form></li>
<li><div class="who">Passkeys<small id="passkeys">{{if .Passkeys}}{{.Passkeys}} added{{else}}None yet{{end}}</small></div>{{if .CanAddPasskey}}{{/* Hidden until the script finds the browser can make a passkey, so with scripts off there is no dead button. */}}<button class="btn ghost" type="button" hidden data-passkey-add data-module="{{.ModuleURL}}" data-begin="{{.RegisterBegin}}" data-finish="{{.RegisterEnd}}" data-rp-name="{{.Name}}" data-user-id="{{.UserID}}" data-user-name="{{.Address}}" data-done="/settings?passkey=added" data-cancelled="No passkey was added." data-failed="That didn't work. Try again." aria-describedby="passkey-msg">Add a passkey</button>{{end}}</li>
-{{with .Equipo}}<li><div class="who">Equipo<small>{{if eq . "ready"}}{{with $.EquipoPerson}}Connected as {{.}}{{else}}Connected{{end}}{{else if eq . "pending"}}Waiting for your approval in Equipo{{else if eq . "reconnect"}}Connection expired or removed{{else}}Not connected{{end}}</small></div>{{if eq . "ready"}}<form method="post" action="/ask/disconnect"><button class="btn ghost" type="submit">Disconnect</button></form>{{else if eq . "pending"}}<a class="btn ghost" href="/ask/connect?next=settings">Finish connecting</a>{{else}}<form method="post" action="/ask/connect"><input type="hidden" name="next" value="settings"><button class="btn ghost" type="submit">{{if eq . "reconnect"}}Reconnect Equipo{{else}}Connect Equipo{{end}}</button></form>{{end}}</li>
+{{with .Equipo}}<li><div class="who">Ask Base<small>{{if eq . "ready"}}{{with $.EquipoPerson}}Connected as {{.}}{{else}}Connected{{end}}{{else if eq . "pending"}}Waiting for your approval{{else if eq . "reconnect"}}Needs setting up again{{else}}Not set up{{end}}</small></div>{{if eq . "ready"}}<form method="post" action="/ask/disconnect"><button class="btn ghost" type="submit">Disconnect</button></form>{{else if eq . "pending"}}<a class="btn ghost" href="/ask/connect?next=settings">Finish setting up</a>{{else}}<form method="post" action="/ask/connect"><input type="hidden" name="next" value="settings"><button class="btn ghost" type="submit">{{if eq . "reconnect"}}Set it up again{{else}}Set up Ask Base{{end}}</button></form>{{end}}</li>
{{end}}{{if .Connect}}<li><div class="who">Oficina account<small>Not connected</small></div><a class="btn ghost" href="/account/home">{{.ConnectLabel}}</a></li>
{{end}}</ul>
{{if .PasskeyAdded}}<p class="status" role="status" id="passkey-added">Passkey added. Next time, sign in with it.</p>
diff --git a/internal/webtest/ask_test.go b/internal/webtest/ask_test.go
index 5bfccd9..2bba741 100644
--- a/internal/webtest/ask_test.go
+++ b/internal/webtest/ask_test.go
@@ -138,7 +138,7 @@ func TestAskFieldOpensChat(t *testing.T) {
}
}
settings := a.get("/settings").Body
- for _, want := range []string{"Equipo<small>Not connected</small>", `action="/ask/connect"`, ">Connect Equipo</button>"} {
+ for _, want := range []string{"Ask Base<small>Not set up</small>", `action="/ask/connect"`, ">Set up Ask Base</button>"} {
if !strings.Contains(settings, want) {
t.Errorf("Settings lacks %q:\n%s", want, settings)
}
@@ -189,7 +189,7 @@ func TestConnectEquipo(t *testing.T) {
t.Fatal("the bearer is stored in the clear")
}
settings := a.get("/settings").Body
- if !strings.Contains(settings, "Equipo<small>Connected</small>") || !strings.Contains(settings, `action="/ask/disconnect"`) {
+ if !strings.Contains(settings, "Ask Base<small>Connected</small>") || !strings.Contains(settings, `action="/ask/disconnect"`) {
t.Errorf("Settings after connecting:\n%s", settings)
}
a.noLeak(token)
@@ -506,14 +506,14 @@ func TestAskNeedsReconnectAfter401(t *testing.T) {
a.connectEquipo(f)
f.RevokeAll()
page := a.get("/ask").Body
- if !strings.Contains(page, ">Reconnect Equipo</button>") {
+ if !strings.Contains(page, ">Set it up again</button>") {
t.Fatalf("no reconnect:\n%s", page)
}
l, _, _ := store.EquipoLinkFor(context.Background(), a.DB, a.ownerID())
if l.State != store.EquipoLost {
t.Fatalf("state %q", l.State)
}
- if s := a.get("/settings").Body; !strings.Contains(s, ">Reconnect Equipo</button>") {
+ if s := a.get("/settings").Body; !strings.Contains(s, ">Set it up again</button>") {
t.Errorf("Settings:\n%s", s)
}
var st struct{ State string }
@@ -529,7 +529,7 @@ func TestAskExpiredBearerNeedsReconnect(t *testing.T) {
t.Fatal(err)
}
before := len(f.Calls(""))
- if page := a.get("/ask").Body; !strings.Contains(page, ">Reconnect Equipo</button>") {
+ if page := a.get("/ask").Body; !strings.Contains(page, ">Set it up again</button>") {
t.Fatalf("no reconnect:\n%s", page)
}
if len(f.Calls("")) != before {
@@ -552,7 +552,7 @@ func TestDisconnectRevokesDevice(t *testing.T) {
if _, ok, _ := store.EquipoLinkFor(context.Background(), a.DB, a.ownerID()); ok {
t.Fatal("link kept")
}
- if s := a.get("/settings").Body; !strings.Contains(s, "Equipo<small>Not connected</small>") {
+ if s := a.get("/settings").Body; !strings.Contains(s, "Ask Base<small>Not set up</small>") {
t.Errorf("Settings:\n%s", s)
}
}
@@ -692,22 +692,135 @@ func TestConnectStoreFailureRevokes(t *testing.T) {
}
}
-// "Open Equipo" sits behind a ⋯ menu, a <details> so it works without
-// scripts, in the panel and on /ask.
-func TestAskMoreMenu(t *testing.T) {
- a, f := newAskApp(t)
+var tagRE = regexp.MustCompile(`(?s)<[^>]*>`)
+
+// textOf is a page's text: its tags, and so every attribute value, gone.
+func textOf(body string) string {
+ body = linkTagRE.ReplaceAllString(body, "")
+ return html.UnescapeString(tagRE.ReplaceAllString(body, " "))
+}
+
+var linkTagRE = regexp.MustCompile(`</?a(\s[^>]*)?>`)
+
+// askStates puts the owner's Ask in each state in turn and calls fn with
+// the pages of that state: Home, /ask, the connect page, Settings.
+func askStates(t *testing.T, fn func(state string, pages map[string]string)) {
+ t.Helper()
+ pages := func(a *testApp, connect string) map[string]string {
+ return map[string]string{"/": a.get("/").Body, "/ask": a.get("/ask").Body,
+ connect: a.get(connect).Body, "/settings": a.get("/settings").Body}
+ }
+ a, _ := newAskApp(t)
+ fn("connect", pages(a, "/ask/connect?next=ask"))
+ for _, ended := range []string{"expired", "refused", "failed"} {
+ fn("connect "+ended, map[string]string{"connect": a.get("/ask/connect?next=ask&ended=" + ended).Body})
+ }
+ a.post("/ask/connect", url.Values{"next": {"ask"}})
+ fn("pending", pages(a, "/ask/connect?next=ask"))
+ fn("pending, problem", map[string]string{"/ask/connect": a.get("/ask/connect?next=ask&problem=1").Body})
+ var f *equipotest.Fake
+ a, f = newAskApp(t)
+ f.FailNextBegin()
+ r := a.post("/ask/connect", url.Values{"next": {"ask"}})
+ fn("unavailable", map[string]string{"/ask/connect": r.Body})
+ a, f = newAskApp(t)
a.connectEquipo(f)
- menu := regexp.MustCompile(`(?s)<details class="ask-more"><summary class="round" aria-label="More">.*?</summary>.*?<a href="` +
- regexp.QuoteMeta(f.URL) + `/" target="_blank" rel="noopener">Open Equipo</a>.*?</details>`)
- for _, page := range []string{"/", "/ask"} {
- body := a.get(page).Body
- if !menu.MatchString(body) {
- t.Errorf("%s has no ⋯ menu holding Open Equipo:\n%s", page, body)
+ fn("ready", pages(a, "/ask/connect?next=ask"))
+ fn("ready, problem", map[string]string{"/ask": a.get("/ask?problem=1").Body})
+ f.NoRunner()
+ fn("norunner", pages(a, "/ask/connect?next=ask"))
+ f.RunnerTooOld()
+ fn("oldrunner", pages(a, "/ask/connect?next=ask"))
+ f.RevokeAll()
+ fn("reconnect", pages(a, "/ask/connect?next=ask"))
+}
+
+// Base never names Equipo in the chat, its setup or Settings: no word of it
+// in any page's text, and no ⋯ menu.
+func TestAskNamesNoEquipo(t *testing.T) {
+ askStates(t, func(state string, pages map[string]string) {
+ for page, body := range pages {
+ if strings.Contains(strings.ToLower(textOf(body)), "equipo") {
+ t.Errorf("%s in state %s names Equipo:\n%s", page, state, textOf(body))
+ }
+ if strings.Contains(body, "ask-more") || strings.Contains(body, "ask-menu") {
+ t.Errorf("%s in state %s has the ⋯ menu", page, state)
+ }
+ }
+ })
+}
+
+// Every approved text shows where Paul's table puts it.
+func TestAskApprovedWords(t *testing.T) {
+ want := map[string][]string{
+ "connect": {"Set up Ask Base to start asking.", "Set up Ask Base"},
+ "connect expired": {"That code expired. Start again to get a new one."},
+ "connect refused": {"That request wasn't accepted. Start again."},
+ "pending": {"You started setting up Ask Base. Approve it to start asking.", "Finish setting up",
+ "Check the request is from", "then type this code:", "Approve it"},
+ "pending, problem": {"Ask Base isn't answering. It will keep trying."},
+ "unavailable": {"Ask Base isn't answering. Try again in a minute."},
+ "ready, problem": {"That didn't send. Try again."},
+ "norunner": {"Ask Base isn't set up for you yet. Finish setting it up, then try again."},
+ "oldrunner": {"Ask Base needs an update first. Update it, then try again."},
+ "reconnect": {"Ask Base needs setting up again.", "Set it up again", "Needs setting up again"},
+ }
+ askStates(t, func(state string, pages map[string]string) {
+ for _, w := range want[state] {
+ found := false
+ for _, body := range pages {
+ found = found || strings.Contains(strings.Join(strings.Fields(textOf(body)), " "), w)
+ }
+ if !found {
+ t.Errorf("state %s shows no %q", state, w)
+ }
+ }
+ })
+ a, f := newAskApp(t)
+ set := func(page, row string) {
+ t.Helper()
+ if s := a.get("/settings").Body; !strings.Contains(s, row) {
+ t.Errorf("%s: Settings lacks %q:\n%s", page, row, s)
}
- if strings.Count(body, ">Open Equipo</a>") != 1 {
- t.Errorf("%s shows Open Equipo outside the menu", page)
+ }
+ set("none", `Ask Base<small>Not set up</small>`)
+ set("none", `>Set up Ask Base</button>`)
+ a.post("/ask/connect", url.Values{"next": {"settings"}})
+ set("pending", `Ask Base<small>Waiting for your approval</small>`)
+ set("pending", `>Finish setting up</a>`)
+ a.approveEquipo(f)
+ // The statuses while a turn runs, and the words the panel's script uses.
+ f.Hold = true
+ a.post("/ask/messages", url.Values{"text": {"Can we fix a bug in Tito?"}})
+ status := regexp.MustCompile(`<p class="ask-status" role="status">([^<]*)</p>`)
+ if m := status.FindStringSubmatch(a.get("/ask").Body); m == nil || m[1] != "Thinking…" {
+ t.Errorf("status while answering: %q", m)
+ }
+ turn := regexp.MustCompile(`/ask/turns/([^/"]+)/cancel`).FindStringSubmatch(a.get("/ask").Body)
+ if turn == nil {
+ t.Fatal("no turn running")
+ }
+ f.WaitTurn(turn[1])
+ a.pollable()
+ if m := status.FindStringSubmatch(a.get("/ask").Body); m == nil || html.UnescapeString(m[1]) != "Ask Base can't answer right now. It will as soon as it can." {
+ t.Errorf("status while waiting: %q", m)
+ }
+ f.RevokeAll()
+ a.get("/ask")
+ set("reconnect", `Ask Base<small>Needs setting up again</small>`)
+ set("reconnect", `>Set it up again</button>`)
+ js, err := os.ReadFile("../look/static/ask.js")
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, w := range []string{"Thinking…", "Ask Base can't answer right now. It will as soon as it can.", "That didn't send. Try again."} {
+ if !strings.Contains(string(js), w) {
+ t.Errorf("ask.js lacks %q", w)
}
}
+ if regexp.MustCompile(`"[^"\n]*Equipo[^"\n]*"|ask-more`).MatchString(string(js)) {
+ t.Error("ask.js still words Equipo to the person, or draws the ⋯ menu")
+ }
}
// cardItem is the card with id as /ask draws it.
@@ -1023,7 +1136,7 @@ func TestDisconnectDropsHostToken(t *testing.T) {
t.Fatal("connecting again registered nothing")
}
f.RevokeAll()
- if page := a.get("/ask").Body; !strings.Contains(page, ">Reconnect Equipo</button>") {
+ if page := a.get("/ask").Body; !strings.Contains(page, ">Set it up again</button>") {
t.Fatalf("no reconnect:\n%s", page)
}
if a.hostMember(token) != "" {
diff --git a/internal/webtest/settings_test.go b/internal/webtest/settings_test.go
index 1f055a5..e6bd4cf 100644
--- a/internal/webtest/settings_test.go
+++ b/internal/webtest/settings_test.go
@@ -125,18 +125,18 @@ func TestSettingsShowsEquipoPerson(t *testing.T) {
f.SetAddress("ana@equipo.example")
a.connectEquipo(f)
a.get("/ask")
- if s := a.get("/settings").Body; !strings.Contains(s, "Equipo<small>Connected as ana@equipo.example</small>") {
+ if s := a.get("/settings").Body; !strings.Contains(s, "Ask Base<small>Connected as ana@equipo.example</small>") {
t.Fatalf("Settings:\n%s", s)
}
f.SetAddress("bea@equipo.example")
a.get("/ask/state")
- if s := a.get("/settings").Body; !strings.Contains(s, "Equipo<small>Connected as bea@equipo.example</small>") {
+ if s := a.get("/settings").Body; !strings.Contains(s, "Ask Base<small>Connected as bea@equipo.example</small>") {
t.Fatalf("Settings after a change:\n%s", s)
}
// Connecting again may be someone else: until Base reads who, it says
// only that it is connected.
a.approveEquipo(f)
- if s := a.get("/settings").Body; !strings.Contains(s, "Equipo<small>Connected</small>") {
+ if s := a.get("/settings").Body; !strings.Contains(s, "Ask Base<small>Connected</small>") {
t.Fatalf("Settings after reconnecting:\n%s", s)
}
}