From e3ead459c053eb876f14e3a7151e1add720b84aa Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 15 Feb 2020 22:47:00 +0100 Subject: [PATCH] linting --- app/controllers/dois_controller.rb | 2 +- app/controllers/metadata_controller.rb | 8 ++++---- app/controllers/old_events_controller.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index d9ee477f1..1ab0f8ac6 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -466,7 +466,7 @@ def random def get_url @doi = Doi.where(doi: params[:id]).first fail ActiveRecord::RecordNotFound if @doi.blank? - + authorize! :get_url, @doi if !@doi.is_registered_or_findable? || %w(europ crossref medra jalc kisti op).include?(@doi.provider_id) || %w(Crossref mEDRA).include?(@doi.agency) diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index 47c7d5772..54da6c408 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -6,7 +6,7 @@ class MetadataController < ApplicationController def index @doi = Doi.where(doi: params[:doi_id]).first - fail ActiveRecord::RecordNotFound unless @doi.present? + fail ActiveRecord::RecordNotFound if @doi.blank? collection = @doi.metadata total = @doi.cached_metadata_count.reduce(0) { |sum, d| sum + d[:count].to_i } @@ -90,15 +90,15 @@ def destroy def set_doi @doi = Doi.where(doi: params[:doi_id]).first - fail ActiveRecord::RecordNotFound unless @doi.present? + fail ActiveRecord::RecordNotFound if @doi.blank? end def set_metadata id = Base32::URL.decode(URI.decode(params[:id])) - fail ActiveRecord::RecordNotFound unless id.present? + fail ActiveRecord::RecordNotFound if id.blank? @metadata = Metadata.where(id: id.to_i).first - fail ActiveRecord::RecordNotFound unless @metadata.present? + fail ActiveRecord::RecordNotFound if @metadata.blank? end def set_include diff --git a/app/controllers/old_events_controller.rb b/app/controllers/old_events_controller.rb index 7749d7928..79a68113b 100644 --- a/app/controllers/old_events_controller.rb +++ b/app/controllers/old_events_controller.rb @@ -19,7 +19,7 @@ def create exists = @event.present? # create event if it doesn't exist already - @event = Event.new(safe_params.except(:format)) unless @event.present? + @event = Event.new(safe_params.except(:format)) if @event.blank? authorize! :create, @event