* Update rubocop-todo.yml with new violations * Fix Layout/EmptyLine* rules * Fix Layout/Indentation* rules * Fix remaining Layout/* rules * Fix Lint/DuplicateMethods by removing unused accessor * Fix Lint/IneffectiveAccessModifier * Fix Lint/MissingCopEnableDirective * Re-run rubocop auto gen config * Fix Layout/RescueEnsureAlignment * Fix Naming/* rules * Fix some RSpec/* rules * Fix typos * Fix RSpec/LetBeforeExamples * Series should only be an attr_writer, not an attr_accessor * Fix RSpec/InstanceVariable * Fix RSpec/InstanceVariable * Fix RSpec/RepeatedDescription and RSpec/RepeatedExample * Fix Style/ClassAndModuleChildren * Fix Style/ConditionalAssignment * Fix some Style/* rules * Trigger Travis CI build because failing tests are not failing locally * Revert "Fix Style/ClassAndModuleChildren" This reverts commit 1686801d8a1516ba1894f79e24401a20dea65f99.
19 lines
581 B
Ruby
19 lines
581 B
Ruby
class BufferedArticlesController < ApplicationController
|
|
# No authorization required for entirely public controller
|
|
def index
|
|
@article_urls = buffered_article_urls
|
|
render json: {
|
|
urls: @article_urls
|
|
}.to_json
|
|
end
|
|
|
|
def buffered_article_urls
|
|
if Rails.env.production?
|
|
Article.
|
|
where("last_buffered > ? OR published_at > ?", 24.hours.ago, 20.minutes.ago).
|
|
map { |a| "https://#{ApplicationConfig['APP_DOMAIN']}#{a.path}" }
|
|
else
|
|
Article.all.map { |a| "https://#{ApplicationConfig['APP_DOMAIN']}#{a.path}" }
|
|
end
|
|
end
|
|
end
|