mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow category moderators to set auto deletion topic timers (#19383)
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
This commit is contained in:
committed by
GitHub
parent
86d49f4fb1
commit
9f3760cfd8
@@ -3999,6 +3999,9 @@ RSpec.describe TopicsController do
|
||||
end
|
||||
|
||||
context 'when logged in as a TL4 user' do
|
||||
before do
|
||||
SiteSetting.enable_category_group_moderation = true
|
||||
end
|
||||
it "raises an error if the user can't see the topic" do
|
||||
user.update!(trust_level: TrustLevel[4])
|
||||
sign_in(user)
|
||||
@@ -4013,6 +4016,46 @@ RSpec.describe TopicsController do
|
||||
expect(response.status).to eq(403)
|
||||
expect(response.parsed_body["error_type"]).to eq('invalid_access')
|
||||
end
|
||||
|
||||
it "allows a category moderator to create a delete timer" do
|
||||
user.update!(trust_level: TrustLevel[4])
|
||||
topic.category.update!(reviewable_by_group: user.groups.first)
|
||||
|
||||
sign_in(user)
|
||||
|
||||
post "/t/#{topic.id}/timer.json", params: {
|
||||
time: 10,
|
||||
status_type: 'delete'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "raises an error setting a delete timer" do
|
||||
user.update!(trust_level: TrustLevel[4])
|
||||
sign_in(user)
|
||||
|
||||
post "/t/#{topic.id}/timer.json", params: {
|
||||
time: 10,
|
||||
status_type: 'delete'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response.parsed_body["error_type"]).to eq('invalid_access')
|
||||
end
|
||||
|
||||
it "raises an error setting delete_replies timer" do
|
||||
user.update!(trust_level: TrustLevel[4])
|
||||
sign_in(user)
|
||||
|
||||
post "/t/#{topic.id}/timer.json", params: {
|
||||
time: 10,
|
||||
status_type: 'delete_replies'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response.parsed_body["error_type"]).to eq('invalid_access')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user