mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 15:05:25 -05:00
FIX: only de-prioritise exact matches in mentions (#11843)
Not when doing a site-wide search like we do in the Directory.
This solves the following specfailure:
1) DirectoryItemsController with data finds user by name
Failure/Error: expect(json['directory_items'].length).to eq(1)
expected: 1
got: 0
(compared using ==)
# ./spec/requests/directory_items_controller_spec.rb:88:in `block (3 levels) in <main>'
# ./spec/rails_helper.rb:271:in `block (2 levels) in <top (required)>'
# ./bundle/ruby/2.7.0/gems/webmock-3.11.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
This commit is contained in:
@@ -212,13 +212,13 @@ describe UserSearch do
|
||||
expect(results).to eq [mr_b, mr_brown, mr_blue].map(&:username)
|
||||
end
|
||||
|
||||
it "doesn't prioritises exact matches for users who haven't been seen in more than 1 year" do
|
||||
it "doesn't prioritises exact matches mentions for users who haven't been seen in over a year" do
|
||||
abcdef = Fabricate(:user, username: "abcdef", last_seen_at: 2.days.ago)
|
||||
abcde = Fabricate(:user, username: "abcde", last_seen_at: 2.weeks.ago)
|
||||
abcd = Fabricate(:user, username: "abcd", last_seen_at: 2.months.ago)
|
||||
abc = Fabricate(:user, username: "abc", last_seen_at: 2.years.ago)
|
||||
|
||||
results = search_for("abc")
|
||||
results = search_for("abc", topic_id: topic.id)
|
||||
expect(results).to eq [abcdef, abcde, abcd, abc].map(&:username)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user