mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: New post editing period for >= tl2 users (#8070)
* FEATURE: Add tl2 threshold for editing new posts * Adds a new setting and for tl2 editing posts (30 days same as old value) * Sets the tl0/tl1 editing period as 1 day * FIX: Spec uses wrong setting * Fix site setting on guardian spec * FIX: post editing period specs * Avoid shared examples * Use update_columns to avoid callbacks on user during tests
This commit is contained in:
committed by
Robin Ward
parent
103629d257
commit
6bbd83067d
@@ -313,8 +313,26 @@ describe PostsController do
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
it 'does not allow to update when edit time limit expired' do
|
||||
it 'does not allow TL0 or TL1 to update when edit time limit expired' do
|
||||
SiteSetting.post_edit_time_limit = 5
|
||||
SiteSetting.tl2_post_edit_time_limit = 30
|
||||
|
||||
post = Fabricate(:post, created_at: 10.minutes.ago, user: user)
|
||||
|
||||
user.update_columns(trust_level: 1)
|
||||
|
||||
put "/posts/#{post.id}.json", params: update_params
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
expect(JSON.parse(response.body)['errors']).to include(I18n.t('too_late_to_edit'))
|
||||
end
|
||||
|
||||
it 'does not allow TL2 to update when edit time limit expired' do
|
||||
SiteSetting.post_edit_time_limit = 12
|
||||
SiteSetting.tl2_post_edit_time_limit = 8
|
||||
|
||||
user.update_columns(trust_level: 2)
|
||||
|
||||
post = Fabricate(:post, created_at: 10.minutes.ago, user: user)
|
||||
|
||||
put "/posts/#{post.id}.json", params: update_params
|
||||
|
||||
Reference in New Issue
Block a user