mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 14:55:15 +08:00
The `findReactionUsers` model method built its query string via plain
template-literal concatenation, e.g. `?reaction_value=${value}`. For
reactions whose value contains URL-reserved characters — most notably
the default `+1` (thumbs-up) — this produced `?reaction_value=+1`, which
Rack decodes as `reaction_value=" 1"`. The controller then queried for
that mangled value, returned an empty `reaction_users` array, and the
hover tooltip on the small emoji in the post reactions counter rendered
its loading spinner indefinitely (the `{{#each ... else}}` branch fires
when the users collection stays undefined).
Switch to passing the value through ajax's `data:` option so jQuery
serializes it via `$.param` (which uses `encodeURIComponent`). This
matches what the sibling `fetchReactionsUsersList` (new menu) already
does and means the request reaches the backend as `%2B1`.
While here, update the `PostReactionsList` page object to use
`[id="..."]` instead of the bare `#id` CSS selector, so it tolerates
reaction values that contain characters disallowed in unescaped ID
selectors. This unlocks a regression spec that hovers over a `+1`
reaction and verifies the user list populates.
Ref - t/184216
|
||
|---|---|---|
| .. | ||
| post_reactions_button.rb | ||
| post_reactions_list.rb | ||
| post_reactions_popup.rb | ||