mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
When users search for tags in the composer, certain tags are silently excluded by backend filtering rules (one_per_topic groups, parent tag requirements, category restrictions, synonyms). The user sees "No matches found" with no explanation, making it appear as though the tag doesn't exist. This commit shows excluded tags as disabled rows in the autocomplete dropdown with an inline explanation of why they can't be used. This covers all exclusion reasons: - One per topic: "Only one tag from the 'X' group is allowed per topic" <img width="942" height="363" alt="2026-04-02 @ 12 31 34" src="https://github.com/user-attachments/assets/1a181c7b-8ed2-4d6e-a22d-75ed6740db69" /> - Parent tag: "Requires the 'Y' tag to use tags from the 'X' group" <img width="949" height="293" alt="2026-04-02 @ 12 32 55" src="https://github.com/user-attachments/assets/3a6fe68d-66fd-4fe3-8d55-40342b0f8f0a" /> - Category restriction: "'tag' is restricted to the 'X' category" <img width="783" height="321" alt="2026-04-02 @ 12 31 54" src="https://github.com/user-attachments/assets/2f3601e2-d495-4906-8092-4a0bebcbbe52" /> - Synonyms: "This is a synonym for 'X'. Use 'X' instead." <img width="807" height="326" alt="2026-04-02 @ 12 31 16" src="https://github.com/user-attachments/assets/a26a89e0-5b96-49b1-9e62-e1bf41631e7a" /> The implementation extracts the tag search logic into a `Tags::Search` service, queries for visible tags that match the search term but were excluded from the allowed results, determines the exclusion reason for each, and returns them as disabled items in the results array. On the frontend, disabled rows are styled with reduced opacity on the tag name and an italic reason line below. Click and keyboard selection are blocked on disabled rows. The mini-tag-chooser now also passes `excludeSynonyms` so synonyms appear as disabled rather than selectable. A `guardian.can_see_tag?` check prevents leaking the existence of staff-only tags, and hidden parent tag names are not exposed to users who can't see them. Ref - t/181010 |
||
|---|---|---|
| .. | ||
| admin | ||
| users | ||
| about_controller.rb | ||
| application_controller.rb | ||
| associated_groups_controller.rb | ||
| badges_controller.rb | ||
| bookmarks_controller.rb | ||
| bootstrap_controller.rb | ||
| calendar_subscriptions_controller.rb | ||
| categories_controller.rb | ||
| clicks_controller.rb | ||
| composer_controller.rb | ||
| composer_messages_controller.rb | ||
| dev_mode_controller.rb | ||
| directory_columns_controller.rb | ||
| directory_items_controller.rb | ||
| do_not_disturb_controller.rb | ||
| drafts_controller.rb | ||
| edit_directory_columns_controller.rb | ||
| email_controller.rb | ||
| embed_controller.rb | ||
| emojis_controller.rb | ||
| exceptions_controller.rb | ||
| export_csv_controller.rb | ||
| extra_locales_controller.rb | ||
| finish_installation_controller.rb | ||
| form_templates_controller.rb | ||
| forums_controller.rb | ||
| groups_controller.rb | ||
| hashtags_controller.rb | ||
| highlight_js_controller.rb | ||
| home_page_controller.rb | ||
| inline_onebox_controller.rb | ||
| invites_controller.rb | ||
| list_controller.rb | ||
| metadata_controller.rb | ||
| new_invite_controller.rb | ||
| new_topic_controller.rb | ||
| notifications_controller.rb | ||
| offline_controller.rb | ||
| onebox_controller.rb | ||
| pageview_controller.rb | ||
| permalinks_controller.rb | ||
| post_action_users_controller.rb | ||
| post_actions_controller.rb | ||
| post_localizations_controller.rb | ||
| post_readers_controller.rb | ||
| posts_controller.rb | ||
| presence_controller.rb | ||
| published_pages_controller.rb | ||
| push_notification_controller.rb | ||
| qunit_controller.rb | ||
| reviewable_claimed_topics_controller.rb | ||
| reviewable_notes_controller.rb | ||
| reviewables_controller.rb | ||
| robots_txt_controller.rb | ||
| safe_mode_controller.rb | ||
| search_controller.rb | ||
| session_controller.rb | ||
| sidebar_sections_controller.rb | ||
| similar_topics_controller.rb | ||
| site_controller.rb | ||
| sitemap_controller.rb | ||
| slugs_controller.rb | ||
| static_controller.rb | ||
| steps_controller.rb | ||
| stylesheets_controller.rb | ||
| svg_sprite_controller.rb | ||
| tag_groups_controller.rb | ||
| tag_localizations_controller.rb | ||
| tags_controller.rb | ||
| test_requests_controller.rb | ||
| theme_javascripts_controller.rb | ||
| topic_localizations_controller.rb | ||
| topic_view_stats_controller.rb | ||
| topics_controller.rb | ||
| uploads_controller.rb | ||
| user_actions_controller.rb | ||
| user_api_key_clients_controller.rb | ||
| user_api_keys_controller.rb | ||
| user_avatars_controller.rb | ||
| user_badges_controller.rb | ||
| user_status_controller.rb | ||
| users_controller.rb | ||
| users_email_controller.rb | ||
| webhooks_controller.rb | ||
| wizard_controller.rb | ||