Skip to content

fix(support/chat): differentiate customer vs support/bot bubbles#596

Merged
TaprootFreak merged 1 commit into
RealUnitCH:integration/realunit-registrationfrom
Blume1977:fix/support-chat-author-detection
May 28, 2026
Merged

fix(support/chat): differentiate customer vs support/bot bubbles#596
TaprootFreak merged 1 commit into
RealUnitCH:integration/realunit-registrationfrom
Blume1977:fix/support-chat-author-detection

Conversation

@Blume1977
Copy link
Copy Markdown
Contributor

Summary

The support-chat bubble shipped with a broken sender check —
isFromSupport => author == null — that never matched, because the
backend always sends a non-null author string:

Sender author value (from support-message.entity.ts)
Customer 'Customer' (the CustomerAuthor constant)
Bot 'AutoResponder'
Support agent clerk name from the supportClerks setting (fallback 'Support')

As a result every message — including the auto-responder's "Hi Jana, …"
template — was rendered as a user message: right-aligned, in
realUnitBlue. The screenshot below the PR description shows the visual
collision.

Changes

  • support_message.dart: introduce customerAuthor constant (mirroring the
    API), expose isFromCustomer getter, redefine isFromSupport as its
    inverse. Anything that is not the literal 'Customer' string (agent name,
    AutoResponder, or a defensive null) now counts as support.
  • support_chat_message_bubble.dart: switch the bubble's alignment / colour
    branch on isFromCustomer. Render a small Support label above the
    bubble for non-customer messages so the user can tell agent/bot replies
    apart from their own.
  • assets/languages/strings_{de,en}.arb: add supportChatSupportLabel
    (alphabetically inserted between supportChat and supportCreateTicket).
  • Model + widget tests rewritten with realistic wire values
    ('Customer', 'Robin', 'AutoResponder') — the previous fixtures
    ('alice', 'user-1', null) hid the bug.

Test plan

  • flutter analyze clean on touched files
  • flutter test test/screens/support test/packages/service/dfx/models/support — 73 tests pass
  • dart run tool/generate_localization.dart regenerates lib/generated/i18n.dart (gitignored)
  • Manual: open a ticket in the app, send a message, confirm the
    AutoResponder reply now lands on the left with the Support label
  • Manual: confirm a real agent reply renders identically (left, grey,
    Support label)

The previous `isFromSupport => author == null` check never matched —
the API always sends a non-null author: `'Customer'` for the user,
`'AutoResponder'` for the bot, and the agent name for support staff.
As a result, every message was rendered as a user message (right-aligned,
blue), making it impossible to tell who sent what.

Detect the customer by comparing against the API's `CustomerAuthor`
constant, then render anything else (agent name or `AutoResponder`)
on the left in the existing neutral bubble, with a `Support` label
above it.
@TaprootFreak TaprootFreak changed the base branch from develop to integration/realunit-registration May 28, 2026 07:31
Copy link
Copy Markdown
Contributor

@TaprootFreak TaprootFreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. Bug-Diagnose stimmt (alter author == null-Check matchte nie, Backend liefert immer non-null), neue isFromCustomer-Logik ist defensiv korrekt. i18n alphabetisch, Styling konform, Tests decken Customer/Agent/Bot/null ab.

@TaprootFreak TaprootFreak marked this pull request as ready for review May 28, 2026 07:35
@TaprootFreak TaprootFreak merged commit 2e5559a into RealUnitCH:integration/realunit-registration May 28, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants