From b0ee1c39052f1379db1032c473a67ea86a7d3949 Mon Sep 17 00:00:00 2001 From: WenYu Date: Wed, 28 Oct 2020 05:34:52 +0800 Subject: [PATCH] Refactor articles_controller (#11122) Refactor unless statement and remove unused variables from controller --- app/controllers/articles_controller.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index d89705f23..d75045f07 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -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,