Skip to content

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

DEV: add tag hashtag data source style type (#33289)

David Battersby0eb6da387c87
diff --git a/app/services/tag_hashtag_data_source.rb b/app/services/tag_hashtag_data_source.rb
index 531a3b16add..b674f73bcd2 100644
--- a/app/services/tag_hashtag_data_source.rb
+++ b/app/services/tag_hashtag_data_source.rb
@@ -16,6 +16,10 @@ class TagHashtagDataSource
"tag"
end
+ def self.style_type
+ "icon"
+ end
+
def self.tag_to_hashtag_item(tag, guardian)
topic_count_column = Tag.topic_count_column(guardian)
@@ -31,6 +35,7 @@ class TagHashtagDataSource
item.slug = tag.name
item.relative_url = tag.url
item.icon = icon
+ item.style_type = style_type
item.id = tag.id
end
end
diff --git a/spec/lib/pretty_text/helpers_spec.rb b/spec/lib/pretty_text/helpers_spec.rb
index 5e4fff05c8a..5c9eeb0f9e7 100644
--- a/spec/lib/pretty_text/helpers_spec.rb
+++ b/spec/lib/pretty_text/helpers_spec.rb
@@ -37,7 +37,9 @@ RSpec.describe PrettyText::Helpers do
text: "somecooltag",
description: "Coolest things ever",
colors: nil,
+ emoji: nil,
icon: "tag",
+ style_type: "icon",
id: tag.id,
slug: "somecooltag",
ref: "somecooltag::tag",
@@ -94,7 +96,9 @@ RSpec.describe PrettyText::Helpers do
text: "somecooltag",
description: "Coolest things ever",
colors: nil,
+ emoji: nil,
icon: "tag",
+ style_type: "icon",
id: tag.id,
slug: "somecooltag",
ref: "somecooltag",
@@ -174,7 +178,9 @@ RSpec.describe PrettyText::Helpers do
text: "somecooltag",
description: "Coolest things ever",
colors: nil,
+ emoji: nil,
icon: "tag",
+ style_type: "icon",
id: tag.id,
slug: "somecooltag",
ref: "somecooltag::tag",
diff --git a/spec/requests/hashtags_controller_spec.rb b/spec/requests/hashtags_controller_spec.rb
index b0873a29929..e342c0b9a28 100644
--- a/spec/requests/hashtags_controller_spec.rb
+++ b/spec/requests/hashtags_controller_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe HashtagsController do
"text" => tag.name,
"description" => nil,
"colors" => nil,
- "style_type" => nil,
+ "style_type" => "icon",
"emoji" => nil,
"icon" => "tag",
"type" => "tag",
@@ -215,7 +215,7 @@ RSpec.describe HashtagsController do
"text" => tag.name,
"description" => nil,
"colors" => nil,
- "style_type" => nil,
+ "style_type" => "icon",
"emoji" => nil,
"icon" => "tag",
"type" => "tag",
@@ -279,7 +279,7 @@ RSpec.describe HashtagsController do
"text" => hidden_tag.name,
"description" => nil,
"colors" => nil,
- "style_type" => nil,
+ "style_type" => "icon",
"emoji" => nil,
"icon" => "tag",
"type" => "tag",
@@ -379,7 +379,7 @@ RSpec.describe HashtagsController do
"text" => tag_2.name,
"description" => nil,
"colors" => nil,
- "style_type" => nil,
+ "style_type" => "icon",
"emoji" => nil,
"icon" => "tag",
"type" => "tag",
@@ -435,7 +435,7 @@ RSpec.describe HashtagsController do
"relative_url" => hidden_tag.url,
"text" => hidden_tag.name,
"description" => nil,
- "style_type" => nil,
+ "style_type" => "icon",
"emoji" => nil,
"icon" => "tag",
"colors" => nil,