mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
FIX: Update search index after renaming user within posts
This commit is contained in:
parent
02cb84847c
commit
8232aba743
@ -24,6 +24,8 @@ module Jobs
|
||||
|
||||
# update without running validations and hooks
|
||||
post.update_columns(raw: post.raw, cooked: post.cooked)
|
||||
|
||||
SearchIndexer.index(post, force: true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,6 +120,14 @@ describe UsernameChanger do
|
||||
expect(post.cooked).to eq(%Q(<p>Hello <a class="mention" href="/u/bar">@bar</a></p>))
|
||||
end
|
||||
|
||||
it 'removes the username from the search index' do
|
||||
SearchIndexer.enable
|
||||
create_post_and_change_username(raw: "Hello @foo")
|
||||
|
||||
results = Search.execute('foo', min_search_term_length: 1)
|
||||
expect(results.posts).to be_empty
|
||||
end
|
||||
|
||||
it 'ignores case when replacing mentions' do
|
||||
post = create_post_and_change_username(raw: "There's no difference between @foo and @Foo")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user