Skip to content

fix(widgetrestapi): use the resolved theme id when re-rendering a single message - #2418

Merged
remdex merged 1 commit into
LiveHelperChat:masterfrom
VincentBorgers:fix-fetchmessage-theme-alias
Oct 7, 2026
Merged

remdex merged 1 commit into
LiveHelperChat:masterfrom
VincentBorgers:fix-fetchmessage-theme-alias

Conversation

@VincentBorgers

Copy link
Copy Markdown
Contributor

Problem

widgetrestapi/fetchmessage resolves the theme with extractTheme(), but then fetches it with the raw request value:

if (isset($requestPayload['theme']) && ($themeId = erLhcoreClassChat::extractTheme($requestPayload['theme'])) !== false) {
    $tpl->set('theme',erLhAbstractModelWidgetTheme::fetch($requestPayload['theme']));
}

When a widget theme has an alias, the embed code passes the alias, and extractTheme() refuses the numeric id for that theme. fetch('my-alias') looks the alias up as a primary key and returns false, so the message is rendered without a theme.

The widget calls this endpoint whenever it refreshes a single message row (lhinst.updateMessageRow): after a visitor reaction, an operator edit or delete, or a translation. On an alias theme the refreshed row loses everything that depends on the theme. The message time and the reaction toolbar disappear, so a visitor who clicks a reaction sees it vanish instead of being selected.

fetchmessages and the other endpoints already use $themeId.

Fix

Fetch the theme by the id extractTheme() returned.

How I tested

On a clean install of current master (PHP 8.3, MariaDB 11) with a widget theme that has an alias, message time visible for all messages, and visitor reactions enabled:

  • fetchmessages returns the operator row with its time and two reaction buttons.
  • fetchmessage for the same row returned no time and no reaction buttons before this change, and the same row as fetchmessages after it.
  • In the embedded widget, clicking a reaction on an operator message removed the time and the reactions from that row before the change. With the change the row keeps both and the reaction is marked as selected.

Before and after clicking a reaction on an alias theme

@remdex
remdex merged commit e94e07e into LiveHelperChat:master Oct 7, 2026
@VincentBorgers
VincentBorgers deleted the fix-fetchmessage-theme-alias branch October 7, 2026 09:32
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