mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: properly omit inactive and silenced users from directory
This commit is contained in:
@@ -18,6 +18,35 @@ describe DirectoryItem do
|
||||
end
|
||||
end
|
||||
|
||||
context 'inactive and silenced users' do
|
||||
it 'removes silenced users correctly' do
|
||||
post = create_post
|
||||
DirectoryItem.refresh_period!(:daily)
|
||||
|
||||
count = DirectoryItem.where(user_id: post.user_id).count
|
||||
expect(count).to eq(1)
|
||||
|
||||
post.user.update_columns(active: false)
|
||||
DirectoryItem.refresh_period!(:daily)
|
||||
|
||||
count = DirectoryItem.where(user_id: post.user_id).count
|
||||
expect(count).to eq(0)
|
||||
|
||||
post.user.update_columns(active: true)
|
||||
DirectoryItem.refresh_period!(:daily)
|
||||
|
||||
count = DirectoryItem.where(user_id: post.user_id).count
|
||||
expect(count).to eq(1)
|
||||
|
||||
post.user.update_columns(silenced_till: 1.year.from_now)
|
||||
DirectoryItem.refresh_period!(:daily)
|
||||
|
||||
count = DirectoryItem.where(user_id: post.user_id).count
|
||||
expect(count).to eq(0)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context 'refresh' do
|
||||
before do
|
||||
UserActionCreator.enable
|
||||
|
||||
Reference in New Issue
Block a user