mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 04:38:47 +08:00
FIX: Edit title respects min trust to edit post
This fix ensures that the site setting `post_edit_time_limit` does not bypass the limit of the site setting `min_trust_to_edit_post`. This prevents a bug where users that did not meet the minimum trust level to edit could edit the title of topics.
This commit is contained in:
@ -1362,6 +1362,13 @@ describe Guardian do
|
||||
expect(Guardian.new(trust_level_4).can_edit?(post)).to eq(false)
|
||||
end
|
||||
|
||||
it 'returns false when trying to edit a topic with no trust' do
|
||||
SiteSetting.min_trust_to_edit_post = 2
|
||||
post.user.trust_level = 1
|
||||
|
||||
expect(Guardian.new(topic.user).can_edit?(topic)).to be_falsey
|
||||
end
|
||||
|
||||
it 'returns false when trying to edit a post with no trust' do
|
||||
SiteSetting.min_trust_to_edit_post = 2
|
||||
post.user.trust_level = 1
|
||||
|
Reference in New Issue
Block a user