mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 23:53:56 +08:00
FIX: Disable "Make Personal Message" if they are disabled
This commit is contained in:
parent
b11dd21356
commit
cd6c5fc5fb
@ -84,6 +84,7 @@ module TopicGuardian
|
||||
end
|
||||
|
||||
def can_convert_topic?(topic)
|
||||
return false unless SiteSetting.enable_personal_messages?
|
||||
return false if topic.blank?
|
||||
return false if topic && topic.trashed?
|
||||
return false if Category.where("topic_id = ?", topic.id).exists?
|
||||
|
@ -1095,6 +1095,11 @@ describe Guardian do
|
||||
it 'returns true when an admin' do
|
||||
expect(Guardian.new(admin).can_convert_topic?(topic)).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns false when personal messages are disabled' do
|
||||
SiteSetting.enable_personal_messages = false
|
||||
expect(Guardian.new(admin).can_convert_topic?(topic)).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
describe 'can_edit?' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user