Allow a configurable delay to keep diary entries from being published in feeds
This is to provide another tool to help spam fighting. The configuration value is set to zero hours for new deploys in order to be 'least surprising'. You can change the setting without interfering with your test suite.
This commit is contained in:
parent
21bf5d79d6
commit
6ed749e7eb
4 changed files with 29 additions and 1 deletions
|
@ -664,6 +664,18 @@ class DiaryEntriesControllerTest < ActionController::TestCase
|
|||
assert_match "<title><script></title>", response.body
|
||||
end
|
||||
|
||||
def test_feed_delay
|
||||
create(:diary_entry, :created_at => 7.hours.ago)
|
||||
create(:diary_entry, :created_at => 5.hours.ago)
|
||||
get :rss, :params => { :format => :rss }
|
||||
assert_select "rss>channel>item", :count => 2
|
||||
|
||||
with_diary_feed_delay(6) do
|
||||
get :rss, :params => { :format => :rss }
|
||||
assert_select "rss>channel>item", :count => 1
|
||||
end
|
||||
end
|
||||
|
||||
def test_show
|
||||
user = create(:user)
|
||||
suspended_user = create(:user, :suspended)
|
||||
|
@ -897,4 +909,13 @@ class DiaryEntriesControllerTest < ActionController::TestCase
|
|||
assert_select "a[href=?]", "/user/#{ERB::Util.u(entry.user.display_name)}/diary/#{entry.id}"
|
||||
end
|
||||
end
|
||||
|
||||
def with_diary_feed_delay(value)
|
||||
diary_feed_delay = Settings.diary_feed_delay
|
||||
Settings.diary_feed_delay = value
|
||||
|
||||
yield
|
||||
|
||||
Settings.diary_feed_delay = diary_feed_delay
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue