fix(mesh): don't mark our own channel post as unread

An app-originated channel send (mirrored into the on-device history)
bumped that channel's unread badge whenever the device's own UI
wasn't already showing that exact channel -- unlike an on-device
compose, which sidesteps this by forcing itself into that channel's
view right before sending. Adds an explicit own_message flag through
addChannelMsg (MessageHistory -> AbstractUITask -> UITask ->
MessagesScreen) so an own post is never counted unread regardless of
what's on screen when it's sent.

Found the same bug in MyMeshBot.h's three auto-reply-into-channel call
sites (Remote Bot's own reply showing as unread on itself) and fixed
those with the same mechanism.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-08-30 20:26:57 +02:00
co-authored by Claude Sonnet 5
parent bdd2ed379d
commit ba3c3cc91f
7 changed files with 29 additions and 13 deletions
+5 -1
View File
@@ -2033,7 +2033,11 @@ void MyMesh::handleCmdFrame(size_t len) {
int tlen = len - i;
if (tlen > MAX_TEXT_LEN) tlen = MAX_TEXT_LEN;
snprintf(entry, sizeof(entry), "Me: %.*s", tlen, text);
int pos = _ui->addChannelMsg(channel_idx, entry, msg_timestamp);
// own_message=true: this is our own post, so it must never bump the
// channel's unread badge even though the device's own UI isn't
// necessarily showing this channel right now (unlike an on-device
// compose, which is always looking at the channel it just sent to).
int pos = _ui->addChannelMsg(channel_idx, entry, msg_timestamp, nullptr, 0, true);
// Same "relayed into mesh" marker an on-device channel send arms (see
// MessagesScreen::afterSend): sendGroupMessage above already went
// through sendFloodScoped(GroupChannel&, ...), which calls