Skip to content

[stable-25.1.x] fix(chat): keep the reply count of a thread up to date - #7059

Merged
mahibi merged 4 commits into
stable-25.1.xfrom
backport/7034/stable-25.1.x
Nov 19, 2026
Merged

mahibi merged 4 commits into
stable-25.1.xfrom
backport/7034/stable-25.1.x

Conversation

@backportbot

@backportbot backportbot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Backport of #7034

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot Bot added bug Something isn't working 3. to review Waiting for reviews feature: chat 🗨️ AI assisted labels Nov 17, 2026
@backportbot backportbot Bot added this to the 25.1.1 milestone Nov 17, 2026
AndyScherzinger and others added 4 commits November 17, 2026 20:23
The "x replies" label of a thread root is read from the cached root
message, which only changed when the root message itself was fetched
again. The server sends the current reply count of the thread with
every message of the thread, over the chat API and the chat relay
alike, but it was only stored on the reply itself. Replies fetched by
the background prefetch or while the chat was open therefore never
reached the label.

When messages are stored, copy the reply count of the newest message
of each thread onto the cached root message. Every sync path stores
messages through upsertChatMessagesAndDeleteTemp, so HTTP polling,
signaling and the background prefetch are all covered.

Counts that are already stale in the cache are not touched by that, as
no new message of the thread may arrive. Opening the main chat
therefore also fetches the recently active threads of the conversation
and writes their reply counts into the cached roots, the way the web
client takes them from its thread list.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The reply count of a thread is taken from the server, so the local
count of replies by parent message is no longer used anywhere. Remove
the query and its repository and preview wrappers.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Inside a thread, the "x replies" subtitle of the toolbar was taken from
the thread endpoint, which is only asked once when the thread is
opened. Replies that arrived while the thread was open never reached
it.

The cached root message of the thread already follows the chat, as
every stored thread message carries the thread's current reply count
over to it. Observe that root and show its count in the toolbar. The
higher of the root's count and the endpoint's count is shown, as a
thread's reply count only grows and the root may not be cached yet.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Each stored batch of messages wrote the count of its newest thread
message onto the thread root, so a response that took longer than a
relayed reply could lower the count again until the next reply. A
thread's reply count only grows on the server, so only raise the
stored count, and write all counts through one path.

Inside a thread, the reply count in the toolbar was read from the
cached root message only, so it did not follow the chat when the root
was not cached, e.g. for a thread opened from a notification whose
root is older than the loaded messages. Read the highest count of all
cached messages of the thread instead, as every message of a thread
carries the thread's count.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger force-pushed the backport/7034/stable-25.1.x branch from 9cdb800 to b01ab05 Compare November 17, 2026 19:27
@github-actions

Copy link
Copy Markdown
Contributor

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit b01ab05
Version 7059
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@github-actions

Copy link
Copy Markdown
Contributor

Codacy

Lint

TypemasterPR
Warnings17138
Errors015

SpotBugs

CategoryBaseNew
Bad practice77
Correctness88
Dodgy code4040
Internationalization33
Malicious code vulnerability33
Performance77
Security1111
Total7979

@AndyScherzinger
AndyScherzinger marked this pull request as ready for review November 17, 2026 22:09
@mahibi
mahibi merged commit 7b6e2e2 into stable-25.1.x Nov 19, 2026
16 of 17 checks passed
@mahibi
mahibi deleted the backport/7034/stable-25.1.x branch November 19, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted bug Something isn't working feature: chat 🗨️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants