mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: when composing a message do not suggest deleted posts users (#15488)
This commit is contained in:
parent
748e08830f
commit
554ff07786
@ -83,7 +83,7 @@ class UserSearch
|
|||||||
# 2. in topic
|
# 2. in topic
|
||||||
if @topic_id
|
if @topic_id
|
||||||
in_topic = filtered_by_term_users
|
in_topic = filtered_by_term_users
|
||||||
.where('users.id IN (SELECT user_id FROM posts WHERE topic_id = ? AND post_type = ?)', @topic_id, Post.types[:regular])
|
.where('users.id IN (SELECT user_id FROM posts WHERE topic_id = ? AND post_type = ? AND deleted_at IS NULL)', @topic_id, Post.types[:regular])
|
||||||
|
|
||||||
if @searching_user.present?
|
if @searching_user.present?
|
||||||
in_topic = in_topic.where('users.id <> ?', @searching_user.id)
|
in_topic = in_topic.where('users.id <> ?', @searching_user.id)
|
||||||
|
@ -176,6 +176,12 @@ describe UserSearch do
|
|||||||
expect(results).to eq [mr_blue.username]
|
expect(results).to eq [mr_blue.username]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not include deleted posts users" do
|
||||||
|
post4.trash!
|
||||||
|
results = search_for("", topic_id: topic.id)
|
||||||
|
expect(results).to eq [mr_orange, mr_b].map(&:username)
|
||||||
|
end
|
||||||
|
|
||||||
it "only reveals topic participants to people with permission" do
|
it "only reveals topic participants to people with permission" do
|
||||||
pm_topic = Fabricate(:private_message_post).topic
|
pm_topic = Fabricate(:private_message_post).topic
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user