mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 08:12:46 +08:00
FIX: do not filter on category name (#22442)
This commit is contained in:
parent
cfdf5b9518
commit
2ce9364c08
|
@ -45,7 +45,7 @@ module Chat
|
|||
end
|
||||
|
||||
def fetch_memberships(guardian:, **)
|
||||
context.memberships = Chat::ChannelMembershipManager.all_for_user(guardian.user)
|
||||
context.memberships = ::Chat::ChannelMembershipManager.all_for_user(guardian.user)
|
||||
end
|
||||
|
||||
def fetch_users(guardian:, **)
|
||||
|
@ -58,8 +58,10 @@ module Chat
|
|||
return if context.mode == :user
|
||||
|
||||
context.category_channels =
|
||||
Chat::ChannelFetcher.secured_public_channels(
|
||||
::Chat::ChannelFetcher.secured_public_channel_search(
|
||||
guardian,
|
||||
filter_on_category_name: false,
|
||||
match_filter_on_starts_with: false,
|
||||
filter: context.term,
|
||||
status: :open,
|
||||
limit: 10,
|
||||
|
@ -76,7 +78,7 @@ module Chat
|
|||
end
|
||||
|
||||
channels =
|
||||
Chat::ChannelFetcher.secured_direct_message_channels_search(
|
||||
::Chat::ChannelFetcher.secured_direct_message_channels_search(
|
||||
guardian.user.id,
|
||||
guardian,
|
||||
limit: 10,
|
||||
|
@ -97,7 +99,7 @@ module Chat
|
|||
end
|
||||
|
||||
def search_users(term, guardian)
|
||||
user_search = UserSearch.new(term, limit: 10)
|
||||
user_search = ::UserSearch.new(term, limit: 10)
|
||||
|
||||
if term.blank?
|
||||
user_search.scoped_users.includes(:user_option)
|
||||
|
|
|
@ -235,6 +235,22 @@ RSpec.describe "New message", type: :system do
|
|||
|
||||
before { channel_1.add(current_user) }
|
||||
|
||||
context "when query is the name of the category" do
|
||||
fab!(:category) { Fabricate(:category, name: "dev") }
|
||||
fab!(:channel_1) { Fabricate(:category_channel, chatable: category, name: "something dev") }
|
||||
fab!(:channel_2) { Fabricate(:category_channel, chatable: category, name: "something else") }
|
||||
|
||||
it "favors the channel name" do
|
||||
visit("/")
|
||||
chat_page.open_new_message
|
||||
|
||||
chat_page.message_creator.filter("dev")
|
||||
|
||||
expect(chat_page.message_creator).to be_listing(channel_1)
|
||||
expect(chat_page.message_creator).to be_not_listing(channel_2)
|
||||
end
|
||||
end
|
||||
|
||||
context "with no prefix" do
|
||||
it "lists all matching content" do
|
||||
visit("/")
|
||||
|
|
Loading…
Reference in New Issue
Block a user