A platform for community discussion. Free, open, simple.
DEV: add channel hashtag style type (#33284)
David Battersbyf138f78f50b4
diff --git a/plugins/chat/lib/chat/channel_hashtag_data_source.rb b/plugins/chat/lib/chat/channel_hashtag_data_source.rbindex 6a1bebb8b66..e6de7d9d0e4 100644--- a/plugins/chat/lib/chat/channel_hashtag_data_source.rb+++ b/plugins/chat/lib/chat/channel_hashtag_data_source.rb@@ -14,12 +14,17 @@ module Chat"channel"end+ def self.style_type+ "icon"+ end+def self.channel_to_hashtag_item(guardian, channel)HashtagAutocompleteService::HashtagItem.new.tap do |item|item.text = channel.titleitem.description = channel.descriptionitem.slug = channel.slugitem.icon = icon+ item.style_type = style_typeitem.colors = [channel.category.color] if channel.category_channel?item.relative_url = channel.relative_urlitem.type = "channel"diff --git a/plugins/chat/spec/lib/chat/channel_hashtag_data_source_spec.rb b/plugins/chat/spec/lib/chat/channel_hashtag_data_source_spec.rbindex 21f05445f05..c46f1b1246b 100644--- a/plugins/chat/spec/lib/chat/channel_hashtag_data_source_spec.rb+++ b/plugins/chat/spec/lib/chat/channel_hashtag_data_source_spec.rb@@ -59,7 +59,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Zany Things",description: "Just weird stuff",colors: [channel1.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel1.id,type: "channel",ref: nil,@@ -83,7 +85,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Secret Stuff",description: nil,colors: [channel2.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel2.id,type: "channel",ref: nil,@@ -102,7 +106,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Zany Things",description: "Just weird stuff",colors: [channel1.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel1.id,type: "channel",ref: nil,@@ -123,7 +129,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Secret Stuff",description: nil,colors: [channel2.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel2.id,type: "channel",ref: nil,@@ -146,7 +154,9 @@ RSpec.describe Chat::ChannelHashtagDataSource doexpect(described_class.lookup(guardian, %w[music random]).map(&:to_h)).to contain_exactly({description: "Just weird stuff",+ emoji: nil,icon: "comment",+ style_type: "icon",colors: [category.color],id: channel1.id,ref: nil,@@ -157,7 +167,9 @@ RSpec.describe Chat::ChannelHashtagDataSource do},{description: "A place for music lovers",+ emoji: nil,icon: "comment",+ style_type: "icon",colors: [category.color],id: channel3.id,ref: nil,@@ -185,7 +197,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Zany Things",description: "Just weird stuff",colors: [channel1.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel1.id,type: "channel",ref: nil,@@ -202,7 +216,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Zany Things",description: "Just weird stuff",colors: [channel1.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel1.id,type: "channel",ref: nil,@@ -222,7 +238,9 @@ RSpec.describe Chat::ChannelHashtagDataSource dotext: "Secret Stuff",description: nil,colors: [channel2.chatable.color],+ emoji: nil,icon: "comment",+ style_type: "icon",id: channel2.id,type: "channel",ref: nil,