mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Admins should only see their own PMs when searching in:all
Admins are technically allowed to access all PMs, but it can be confusing to include them all in search. Follow-up to e0605029dc
This commit is contained in:
parent
885a3ca42c
commit
c344f43211
@ -828,7 +828,7 @@ class Search
|
|||||||
end
|
end
|
||||||
elsif opts[:type_filter] === "all_topics"
|
elsif opts[:type_filter] === "all_topics"
|
||||||
private_posts = posts.where("topics.archetype = ?", Archetype.private_message)
|
private_posts = posts.where("topics.archetype = ?", Archetype.private_message)
|
||||||
private_posts = private_posts.private_posts_for_user(@guardian.user) unless @guardian.is_admin?
|
private_posts = private_posts.private_posts_for_user(@guardian.user)
|
||||||
|
|
||||||
posts = posts.where("topics.archetype <> ?", Archetype.private_message).or(private_posts)
|
posts = posts.where("topics.archetype <> ?", Archetype.private_message).or(private_posts)
|
||||||
else
|
else
|
||||||
|
@ -348,11 +348,11 @@ describe Search do
|
|||||||
guardian: Guardian.new(u3))
|
guardian: Guardian.new(u3))
|
||||||
expect(results.posts.length).to eq(1)
|
expect(results.posts.length).to eq(1)
|
||||||
|
|
||||||
# Admin
|
# Admin doesn't see private topic
|
||||||
results = Search.execute('spam',
|
results = Search.execute('spam',
|
||||||
type_filter: 'all_topics',
|
type_filter: 'all_topics',
|
||||||
guardian: Guardian.new(u4))
|
guardian: Guardian.new(u4))
|
||||||
expect(results.posts.length).to eq(2)
|
expect(results.posts.length).to eq(1)
|
||||||
|
|
||||||
# same keyword for different users
|
# same keyword for different users
|
||||||
results = Search.execute('ham',
|
results = Search.execute('ham',
|
||||||
|
Loading…
Reference in New Issue
Block a user