Refactor articles_controller (#11122)

Refactor unless statement and remove unused variables from controller
This commit is contained in:
WenYu 2020-10-28 05:34:52 +08:00 committed by GitHub
parent 75fe6fd245
commit b0ee1c3905
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,16 +30,11 @@ class ArticlesController < ApplicationController
@articles.where(featured: true).includes(:user)
end
unless @articles&.any?
not_found
end
not_found unless @articles&.any?
set_surrogate_key_header "feed"
set_cache_control_headers(10.minutes.to_i, stale_while_revalidate: 30, stale_if_error: 1.day.to_i)
@allowed_tags = FEED_ALLOWED_TAGS
@allowed_attributes = FEED_ALLOWED_ATTRIBUTES
render layout: false, locals: {
articles: @articles,
user: @user,