Skip to content

Commit

Permalink
refactored AdditionalsQuery adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Aug 26, 2024
1 parent 0586ce9 commit d9c4ea0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/additional_tags/patches/agile_query_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module AgileQueryPatch
extend ActiveSupport::Concern

included do
include AdditionalsQuery
include Additionals::Concerns::Query
include InstanceMethods

alias_method :initialize_available_filters_without_tags, :initialize_available_filters
Expand Down
2 changes: 1 addition & 1 deletion lib/additional_tags/patches/issue_query_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module IssueQueryPatch
extend ActiveSupport::Concern

included do
include AdditionalsQuery
include Additionals::Concerns::Query
prepend InstanceOverwriteMethods
include InstanceMethods

Expand Down
4 changes: 2 additions & 2 deletions lib/additional_tags/patches/query_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def build_sql_for_tags_field_with_permission(klass:, operator:, values:, permiss
when '=', '!'
ids_list = klass.tagged_with(values, any: true).ids
# special case: filter with deleted tag
return AdditionalsQuery::NO_RESULT_CONDITION if ids_list.blank? && values.present? && operator == '='
return Additionals::SQL_NO_RESULT_CONDITION if ids_list.blank? && values.present? && operator == '='
else
allowed_projects = Project.where(Project.allowed_to_condition(User.current, permission))
.select(:id)
Expand All @@ -90,7 +90,7 @@ def build_sql_for_tags_field(klass:, operator:, values:)
"(#{klass.table_name}.id #{compare} (#{ids_list.join ','}))"
elsif values.present? && operator == '='
# special case: filter with deleted tag
AdditionalsQuery::NO_RESULT_CONDITION
Additionals::SQL_NO_RESULT_CONDITION
end
else
entries = ActsAsTaggableOn::Tagging.where taggable_type: klass.name
Expand Down
2 changes: 1 addition & 1 deletion lib/additional_tags/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def tag_access(permission, user, skip_pre_condition: false)
if projects_allowed.present?
"#{Project.table_name}.id IN (#{projects_allowed.join ','})" unless projects_allowed.empty?
else
AdditionalsQuery::NO_RESULT_CONDITION
Additionals::SQL_NO_RESULT_CONDITION
end
end
end
Expand Down

0 comments on commit d9c4ea0

Please sign in to comment.