mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
Merge pull request #5226 from tgxworld/allow_user_to_disable_private_messages
FEATURE: Allow users to disable new PMs.
This commit is contained in:
@ -6,6 +6,7 @@ require_dependency 'post_destroyer'
|
||||
describe Topic do
|
||||
let(:now) { Time.zone.local(2013, 11, 20, 8, 0) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:topic) { Fabricate(:topic) }
|
||||
|
||||
context 'validations' do
|
||||
let(:topic) { Fabricate.build(:topic) }
|
||||
@ -2061,4 +2062,23 @@ describe Topic do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#remove_allowed_user' do
|
||||
let(:another_user) { Fabricate(:user) }
|
||||
|
||||
describe 'removing oneself' do
|
||||
it 'should remove onself' do
|
||||
topic.allowed_users << another_user
|
||||
|
||||
expect(topic.remove_allowed_user(another_user, another_user)).to eq(true)
|
||||
expect(topic.allowed_users.include?(another_user)).to eq(false)
|
||||
|
||||
post = Post.last
|
||||
|
||||
expect(post.user).to eq(Discourse.system_user)
|
||||
expect(post.post_type).to eq(Post.types[:small_action])
|
||||
expect(post.action_code).to eq('user_left')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user