A platform for community discussion. Free, open, simple.
FIX: Minor hashtag autocomplete fixes (#19173)
Martin Brennana34838d671b1
diff --git a/app/assets/stylesheets/common/components/hashtag.scss b/app/assets/stylesheets/common/components/hashtag.scssindex 35d40724676..6bae5c75bad 100644--- a/app/assets/stylesheets/common/components/hashtag.scss+++ b/app/assets/stylesheets/common/components/hashtag.scss@@ -30,8 +30,8 @@ a.hashtag-cooked {}.hashtag-autocomplete {- max-height: 300px;- overflow-y: scroll;+ max-height: 210px;+ overflow-y: auto;.hashtag-autocomplete__option {.hashtag-autocomplete__link {@@ -46,6 +46,9 @@ a.hashtag-cooked {.hashtag-autocomplete__text {flex: 1;margin-left: 0;+ text-overflow: ellipsis;+ white-space: nowrap;+ overflow: hidden;.emoji {width: 15px;diff --git a/plugins/chat/lib/chat_channel_fetcher.rb b/plugins/chat/lib/chat_channel_fetcher.rbindex 129c64cb6c6..55a2341cb23 100644--- a/plugins/chat/lib/chat_channel_fetcher.rb+++ b/plugins/chat/lib/chat_channel_fetcher.rb@@ -99,8 +99,15 @@ module Chat::ChatChannelFetcherchannels = channels.where(status: options[:status]) if options[:status].present?if options[:filter].present?+ category_filter = \+ if options[:filter_on_category_name]+ "OR categories.name ILIKE :filter"+ else+ ""+ end+sql =- "chat_channels.name ILIKE :filter OR chat_channels.slug ILIKE :filter OR categories.name ILIKE :filter"+ "chat_channels.name ILIKE :filter OR chat_channels.slug ILIKE :filter #{category_filter}"channels =channels.where(sql, filter: "%#{options[:filter].downcase}%").order("chat_channels.name ASC, categories.name ASC",@@ -142,7 +149,7 @@ module Chat::ChatChannelFetcherchannels =secured_public_channel_search(guardian,- options.merge(include_archives: true),+ options.merge(include_archives: true, filter_on_category_name: true),)decorate_memberships_with_tracking_data(guardian, channels, memberships)channels = channels.to_adiff --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 b00948be7b0..4c383f4a171 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@@ -55,20 +55,10 @@ RSpec.describe Chat::ChatChannelHashtagDataSource doenddescribe "#search" do- it "finds a channel by category name" do+ it "does not find channels by category name" docategory.update!(name: "Randomizer")result = described_class.search(guardian, "randomiz", 10).first- expect(result.to_h).to eq(- {- relative_url: channel1.relative_url,- text: "Zany Things",- description: "Just weird stuff",- icon: "comment",- type: "channel",- ref: nil,- slug: "random",- },- )+ expect(result.to_h).to eq({})endit "finds a channel by slug" do