fix rubocop offenses and provide NO_RESULT_CONDITION
This commit is contained in:
parent
d7f4ed09d2
commit
f0a2b23980
@ -281,7 +281,7 @@ module AdditionalsQueriesHelper
|
||||
end
|
||||
|
||||
def xlsx_hyperlink_cell?(token)
|
||||
return if token.blank? || !token.is_a?(String)
|
||||
return false if token.blank? || !token.is_a?(String)
|
||||
|
||||
# Match http, https or ftp URL
|
||||
if %r{\A[fh]tt?ps?://}.match?(token) ||
|
||||
|
@ -1,6 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module AdditionalsQuery
|
||||
NO_RESULT_CONDITION = '1=0'
|
||||
WITH_TRUE_CONDITION = '1=1'
|
||||
|
||||
def label_me_value
|
||||
self.class.label_me_value
|
||||
end
|
||||
@ -63,7 +66,7 @@ module AdditionalsQuery
|
||||
if ids.any?
|
||||
"#{queried_table_name}.id IN (#{ids.join ','})"
|
||||
else
|
||||
'1=0'
|
||||
NO_RESULT_CONDITION
|
||||
end
|
||||
else
|
||||
sql_for_field 'id', operator, value, queried_table_name, 'id'
|
||||
@ -222,7 +225,7 @@ module AdditionalsQuery
|
||||
|
||||
"#{queried_table_name}.is_private = #{self.class.connection.quoted_true}"
|
||||
else
|
||||
return '1=0' if value.count > 1
|
||||
return NO_RESULT_CONDITION if value.count > 1
|
||||
|
||||
"#{queried_table_name}.is_private = #{self.class.connection.quoted_false}"
|
||||
end
|
||||
|
@ -270,7 +270,7 @@ class Dashboard < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def deletable?(user = User.current)
|
||||
return unless editable? user
|
||||
return false unless editable? user
|
||||
|
||||
return !system_default_was if dashboard_type != DashboardContentProject::TYPE_NAME
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user