Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): cap a quoted line by the room in its box

Yudhi Armyndharisf04b1221cfbb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79fbcde85..7f5bad076 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -140,7 +140,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Apply a delete for everyone, an edit or a reaction that reaches a whatsapp-web.js message on SQLite while its contact or media is still being fetched, instead of hooking, storing and announcing the message with its deleted or unedited content.
- Store a Baileys reaction to a message that is still downloading its media with the message on SQLite, as on PostgreSQL, and announce it and an edit of the same window once the gateway has the message.
- Keep Baileys chat pin, mute and archive state from reverting, or coming back for a deleted or unlinked chat, or reading as defaults for a lid-addressed contact, when a restore, a session start or a chat-list read overlaps a change; a change written under a contact's lid while its state is merged onto the phone number, or in the same millisecond as the phone entry, is no longer lost.
-- Refuse a chat id that is not in the form `localpart@host` in the MCP tools `SessionSubscribePresence`, `SessionMarkChatRead` and `SessionMarkChatUnread`, as their REST routes do.
+- Refuse a chat id that is not in the form `localpart@host` in the MCP tools `SessionSubscribePresence`, `SessionMarkChatRead`, `SessionMarkChatUnread` and `SessionSendChatState`, as their REST routes do.
- Send the method of a raw `client.Do` (Go) or `client.request` (JavaScript) call in upper case, so a lowercase verb no longer reaches the gateway as `patch` and answers 400, from SDK 0.7.0.
- Refuse every spelling of `/` (`//`, `/.`, `/..`, a link to `/`, `<link to />/..`) for `OPENWA_DATA_DIR`, the state directories, `MAIN_DATABASE_NAME`, `DATABASE_NAME` and `BOOTSTRAP_KEY_FILE` in `scripts/restore.sh`, and resolve `..` after a symlink as the kernel does; run as root, its safety snapshot could copy the filesystem into itself.
- Describe the 400 of `POST /api/sessions/{id}/messages/react` and `/delete` as `Session not active or invalid request` in the OpenAPI schema; a missing message answers 404.
diff --git a/dashboard/src/bidi.test.ts b/dashboard/src/bidi.test.ts
index 0acf69099..673ff9dc3 100644
--- a/dashboard/src/bidi.test.ts
+++ b/dashboard/src/bidi.test.ts
@@ -74,7 +74,10 @@ test('cut text that a flex column stretches hugs the start edge, where its sibli
assert.match(rule, /align-self:\s*flex-start/, selector);
assert.match(rule, /max-width:\s*100%/, `${selector} needs a cap, or the ellipsis never shows`);
}
- assert.match(body('pages/Chats.css', '.chats-page .quote-body'), /width:\s*fit-content/);
+ const quote = body('pages/Chats.css', '.chats-page .quote-body');
+ assert.match(quote, /width:\s*fit-content/);
+ // A long nowrap quote is as wide as its text, so the cap has to follow the room in the box, not only 250px.
+ assert.match(quote, /max-width:\s*min\(250px,\s*100%\)/);
});
test('chart plots stay left to right on a right to left page', () => {
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index 40d784f6d..a95099cb6 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -1490,7 +1490,9 @@
overflow: hidden;
text-overflow: ellipsis;
unicode-bidi: plaintext;
- max-width: 250px;
+ /* The cap is the smaller of 250px and the room in the quote box: under nowrap the shrink-to-fit width is the
+ whole text, so a bare 250px cap let a long quote paint past a narrow bubble. */
+ max-width: min(250px, 100%);
width: fit-content;
}
diff --git a/dashboard/src/utils/shortenLabel.ts b/dashboard/src/utils/shortenLabel.ts
index f786e7f03..225468b71 100644
--- a/dashboard/src/utils/shortenLabel.ts
+++ b/dashboard/src/utils/shortenLabel.ts
@@ -1,5 +1,5 @@
// Graphemes, not code points: a flag, a family emoji or a letter with combining marks is several code points
-// and must not be cut inside. Segmenter is in every browser the dashboard supports; code points are the fallback.
+// and must not be cut inside. A browser without Segmenter (Firefox before 125) counts code points instead.
const segmenter =
typeof Intl.Segmenter === 'function' ? new Intl.Segmenter(undefined, { granularity: 'grapheme' }) : null;