Skip to content

A platform for community discussion. Free, open, simple.

FIX: Include tag slug in tag groups search response (#37751)

Krzysztof Kotlarekf065202715b8
diff --git a/app/controllers/tag_groups_controller.rb b/app/controllers/tag_groups_controller.rb
index 2b6253836a3..0da4fab14b6 100644
--- a/app/controllers/tag_groups_controller.rb
+++ b/app/controllers/tag_groups_controller.rb
@@ -105,7 +105,12 @@ class TagGroupsController < ApplicationController
matches.map do |x|
{
name: x.name,
- tags: x.tags.base_tags.pluck(:id, :name).map { |id, name| { id:, name: } },
+ tags:
+ x
+ .tags
+ .base_tags
+ .pluck(:id, :name, :slug)
+ .map { |id, name, slug| { id:, name:, slug: } },
}
end,
}
diff --git a/spec/requests/tag_groups_controller_spec.rb b/spec/requests/tag_groups_controller_spec.rb
index 7a49495c162..2266f12f1e7 100644
--- a/spec/requests/tag_groups_controller_spec.rb
+++ b/spec/requests/tag_groups_controller_spec.rb
@@ -76,8 +76,8 @@ RSpec.describe TagGroupsController do
results = JSON.parse(response.body, symbolize_names: true).fetch(:results)
expect(results).to contain_exactly(
- { name: tag_group.name, tags: [{ id: tag.id, name: tag.name }] },
- { name: tag_group2.name, tags: [{ id: tag.id, name: tag.name }] },
+ { name: tag_group.name, tags: [{ id: tag.id, name: tag.name, slug: tag.slug }] },
+ { name: tag_group2.name, tags: [{ id: tag.id, name: tag.name, slug: tag.slug }] },
)
end