2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 22:05:52 +08:00
discourse/spec/requests
Régis Hanol 5f6e69f64f
UX: Display interpolation keys as interactive pills in admin editors (#37254)
When editing site texts or email templates, admins need to know which
interpolation keys are available and whether they're being used
correctly.
Previously there was no UI for this.

Show interpolation keys as clickable pill buttons below the editor:
- Unused keys are dimmed — clicking inserts %{key} at the last cursor
position
- Used keys are highlighted green to confirm they're present in the text
- Invalid keys (typos or unknown keys) appear in red as non-clickable
pills

Implementation:
- New `<AdminInterpolationKeys>` template-only component renders the
pills
- New `interpolationKeysWithStatus()` utility in admin/lib centralizes
the
logic for computing key statuses (used/unused/invalid) across both
editors
- Controllers track textarea focus and cursor position via private
fields
  (no @Tracked — these are only read imperatively on pill click)
- Uses document.execCommand("insertText") for native undo/redo support
- Fix duplicate keys in backend by using Array#| (set union) instead of
Array#+

<img width="1662" height="1355" alt="2026-02-26 @ 17 09 32"
src="https://github.com/user-attachments/assets/05497832-4e17-4eb2-b4c1-e9e0e036304a"
/>

<img width="1662" height="1355" alt="2026-02-26 @ 17 09 19"
src="https://github.com/user-attachments/assets/f13271ad-511e-4fa1-9bec-eb6fbc7a66d8"
/>


Ref - t/172375
2026-02-27 21:21:26 +01:00
..
admin UX: Display interpolation keys as interactive pills in admin editors (#37254) 2026-02-27 21:21:26 +01:00
api UX: when SMTP is not configured, show email disabled banner selectively (#38002) 2026-02-24 12:25:01 -05:00
examples
about_controller_spec.rb
application_controller_spec.rb FIX: Cache banners per locale (#37561) 2026-02-05 17:21:12 +08:00
associate_accounts_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
badges_controller_spec.rb FIX: Non-listable and disabled badges exposed via XHR JSON requests (#37869) 2026-02-17 16:17:01 +11:00
bookmarks_controller_spec.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
categories_controller_spec.rb FIX: Authorization gap in move allows reordering categories the actor cannot see (#37865) 2026-02-18 07:16:46 +11:00
clicks_controller_spec.rb
composer_controller_spec.rb FIX: correct Discourse.InvalidParameters usage (#37690) 2026-02-11 10:28:12 +01:00
composer_messages_controller_spec.rb
crawler_hreflang_spec.rb FEATURE: Append locale to links in crawler view if present (#34466) 2025-08-22 08:46:33 +08:00
default_headers_spec.rb
dev_mode_controller_spec.rb DEV: Add /dev-mode endpoint for MiniProfiler auth cookie (#37027) 2026-01-12 10:01:20 +08:00
directory_columns_controller_spec.rb
directory_items_controller_spec.rb SECURITY: Filter private user fields in directory items endpoint 2026-02-26 12:22:54 +00:00
discourse_id_controller_spec.rb FIX: Revocation endpoint is blocked when login_required is enabled, preventing session invalidation (#37859) 2026-02-17 09:12:14 -05:00
do_not_disturb_controller_spec.rb
drafts_controller_spec.rb DEV: Expand top_tags, topic.tags, etc, to return an array of tag objects instead of tag names (#36678) 2026-02-02 10:03:02 +08:00
edit_directory_columns_controller_spec.rb
email_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
embed_controller_spec.rb FEATURE: Full Ember app embed mode for blog comments (#36613) 2026-02-18 18:22:57 -03:00
emojis_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
exceptions_controller_spec.rb FIX: Respect forced color mode for logo on server-rendered pages (#37032) 2026-01-09 11:33:06 +01:00
export_csv_controller_spec.rb FIX: Missing requires_login — authentication relies solely on guardian call (#37716) 2026-02-11 12:25:58 +01:00
extra_locales_controller_spec.rb DEV: Refactor locale bundle loading (#37114) 2026-01-16 11:45:14 +00:00
finish_installation_controller_spec.rb DEV: Allow new instances to be set up directly with Discourse ID (#36731) 2025-12-23 12:13:36 -05:00
form_templates_controller_spec.rb DEV: Rename experimental_ upcoming change settings (#37589) 2026-02-10 10:34:37 +10:00
forums_controller_spec.rb
groups_controller_spec.rb FIX: Enforce allow_membership_requests setting in groups controller (#38017) 2026-02-24 14:11:32 +01:00
hashtags_controller_spec.rb
highlightjs_controller_spec.rb
home_page_controller_spec.rb
inline_onebox_controller_spec.rb
invites_controller_spec.rb FIX: update and create_multiple actions missing from requires_login (#37715) 2026-02-11 12:21:32 +01:00
list_controller_spec.rb UX: Remove Bootstrap Mode (#37694) 2026-02-17 16:46:32 -03:00
metadata_controller_spec.rb SECURITY: Error responses missing Cache-Control header 2025-10-28 14:40:41 +08:00
net_http_header_spec.rb
net_http_timeout_spec.rb DEV: fix a large amount of typos (#37428) 2026-02-02 16:31:58 +11:00
noscript_escape_spec.rb
notifications_controller_spec.rb FIX: Hide badge notifications for disabled badges or when badges are disabled (#36987) 2026-01-07 15:28:43 +08:00
offline_controller_spec.rb
omniauth_callbacks_controller_spec.rb DEV: Show unauthorized message when OAuth::Unauthorized is hit (#37776) 2026-02-12 13:41:33 -05:00
onebox_controller_spec.rb
permalinks_controller_spec.rb SECURITY: prevent permalink redirects from leaking restricted slugs 2026-01-28 17:11:14 +00:00
post_action_users_controller_spec.rb FIX: likes are not visible when rejecting PMs (#35753) 2025-11-03 16:23:32 +11:00
post_actions_controller_spec.rb FIX: prevents destroy post action to leak post (#38015) 2026-02-24 11:15:06 +01:00
post_localizations_controller_spec.rb FEATURE: Allow post authors to localize their own posts (#36178) 2025-11-25 11:02:22 +08:00
post_readers_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
posts_controller_spec.rb UX: When diffs error, show a nicer UI (#38104) 2026-02-27 10:53:26 -05:00
presence_controller_spec.rb
published_pages_controller_spec.rb FIX: ensures only staff can check slugs (#37846) 2026-02-16 18:23:46 +01:00
push_notification_controller_spec.rb
qunit_controller_spec.rb DEV: Cache AssetProcessor code in development (#38036) 2026-02-25 11:24:41 +00:00
reviewable_claimed_topics_controller_spec.rb FIX: Only log unclaimed history when topic was claimed (#36949) 2026-01-06 14:52:55 +08:00
reviewable_notes_controller_spec.rb SECURITY: scope reviewable notes to user-visible reviewables 2026-02-26 12:22:54 +00:00
reviewables_controller_spec.rb DEV: Remove unused transition_to and transition_to_id from reviewable serializer (#37135) 2026-01-15 15:04:53 +08:00
robots_txt_controller_spec.rb
safe_mode_controller_spec.rb
search_controller_spec.rb DEV: fix a large amount of typos (#37428) 2026-02-02 16:31:58 +11:00
session_controller_spec.rb FIX: Passkey login not outputting error messages with suspended user and screened IP checks (#37827) 2026-02-16 09:28:03 -05:00
sidebar_sections_controller_spec.rb FIX: raise 404 when sidebar section doesn't exist (#37675) 2026-02-10 15:47:49 +01:00
similar_topics_controller_spec.rb
site_controller_spec.rb
sitemap_controller_spec.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
slugs_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
static_controller_spec.rb FIX: Path boundary check in serve_asset can escape intended public/assets directory boundary (#37863) 2026-02-18 07:17:11 +11:00
steps_controller_spec.rb UX: One step wizard (#36082) 2025-11-25 13:35:32 -05:00
stylesheets_controller_spec.rb
svg_sprite_controller_spec.rb
tag_groups_controller_spec.rb FIX: Include tag slug in tag groups search response (#37751) 2026-02-12 15:06:56 +08:00
tag_localizations_controller_spec.rb FEATURE: Introduce tag localizations with API, without UI yet (#36754) 2025-12-18 18:25:58 +08:00
tags_controller_spec.rb DEV: Setup backend for dedicated tag settings page (#37804) 2026-02-13 17:14:49 +08:00
theme_javascripts_controller_spec.rb DEV: Use rollup for theme JS compilation (#33103) 2025-07-25 12:02:29 +01:00
topic_localizations_controller_spec.rb UX: Use inline title editor instead of composer when editing translation (#36847) 2025-12-24 00:56:36 +08:00
topic_view_stats_controller_spec.rb
topics_controller_spec.rb SECURITY: prevent regular users from promoting topics to banners 2026-02-26 12:22:54 +00:00
uploads_controller_multisite_spec.rb FIX: Multisite prevent anons from downloading files (#37979) 2026-02-24 10:49:14 +10:00
uploads_controller_spec.rb SECURITY: Download allowlist for uploaded files 2026-01-28 17:11:14 +00:00
user_actions_controller_spec.rb DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
user_api_key_clients_controller_spec.rb FIX: Empty-scopes bypass allows untrusted client registration and downstream scope/redirect policy bypass (#37855) 2026-02-17 12:39:09 +11:00
user_api_keys_controller_spec.rb DEV: Do not show auth_redirect note for discourse://auth_redirect (#37212) 2026-01-20 09:29:38 -05:00
user_avatars_controller_spec.rb PERF: extract shared DiskCacheEviction utility for disk caches (#37842) 2026-02-16 12:24:38 +01:00
user_badges_controller_spec.rb FIX: enforces logged in, in badges actions (#37666) 2026-02-10 12:00:56 +01:00
user_status_controller_spec.rb FEATURE: Prevent silenced users from liking and using reactions (#37040) 2026-01-13 13:59:57 +01:00
users_controller_spec.rb UX: Remove Bootstrap Mode (#37694) 2026-02-17 16:46:32 -03:00
users_email_controller_spec.rb FIX: enforces login for create in user emails controller (#37770) 2026-02-12 17:10:43 +01:00
webhooks_controller_spec.rb SECURITY: harden webooks endpoints 2026-02-26 12:22:54 +00:00
wizard_controller_spec.rb