webui v168: scroll to the tunnel status line when it lands

"Tunnel is secured. You can talk!" was appended to the conversation
without scrolling to it, so on a phone it sat below the fold and the
tunnel looked stuck on connecting. Same for "Your partner closed the
conversation". Scroll when the line is really new (the helper drops
duplicates) and the contact is still the one on screen.
This commit is contained in:
jolavillette 2026-08-29 19:02:00 +02:00
parent efdc5edd39
commit a04c3f4bee
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
const m = require('mithril');
// Bumped at every change of the web UI (two places used to carry it).
const WEBUI_VERSION = 'v167';
const WEBUI_VERSION = 'v168';
const login = require('login');
const rs = require('rswebui');

View File

@ -407,14 +407,19 @@ function pollDistantChatStatus() {
if (session) {
session.status = detail.info;
// A status line is a message like any other: when one really lands
// (the helper drops what is already there) the pane has to follow it,
// or "You can talk" sits below the fold and the tunnel looks stuck.
let statusLineAdded = false;
if (detail.info.status === 2) {
addSessionSystemMessage(session, 'Tunnel is secured. You can talk!');
statusLineAdded = addSessionSystemMessage(session, 'Tunnel is secured. You can talk!');
// The tunnel just went up: anything the peer sent while it was still
// pending is waiting in the event buffer.
drainBufferedChatMessages(session);
} else if (detail.info.status === 3) {
addSessionSystemMessage(session, 'Your partner closed the conversation.');
statusLineAdded = addSessionSystemMessage(session, 'Your partner closed the conversation.');
}
if (statusLineAdded && State.selectedId === askedFor) scrollChatToBottom();
}
m.redraw();
}