Commit 595e28bf authored by Siddharth Asthana's avatar Siddharth Asthana

Fix Gitlab/DelegatePredicateMethods offenses

Changelog: other
parent 70a1dc76
...@@ -4,7 +4,6 @@ Gitlab/DelegatePredicateMethods: ...@@ -4,7 +4,6 @@ Gitlab/DelegatePredicateMethods:
- app/models/clusters/cluster.rb - app/models/clusters/cluster.rb
- app/models/clusters/platforms/kubernetes.rb - app/models/clusters/platforms/kubernetes.rb
- app/models/concerns/ci/metadatable.rb - app/models/concerns/ci/metadatable.rb
- app/models/concerns/diff_positionable_note.rb
- app/models/concerns/integrations/base_data_fields.rb - app/models/concerns/integrations/base_data_fields.rb
- app/models/concerns/resolvable_discussion.rb - app/models/concerns/resolvable_discussion.rb
- app/models/project.rb - app/models/project.rb
......
...@@ -3,7 +3,6 @@ module DiffPositionableNote ...@@ -3,7 +3,6 @@ module DiffPositionableNote
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
delegate :on_text?, :on_image?, to: :position, allow_nil: true
before_validation :set_original_position, on: :create before_validation :set_original_position, on: :create
before_validation :update_position, on: :create, if: :on_text?, unless: :importing? before_validation :update_position, on: :create, if: :on_text?, unless: :importing?
...@@ -34,6 +33,14 @@ module DiffPositionableNote ...@@ -34,6 +33,14 @@ module DiffPositionableNote
end end
end end
def on_text?
!!position&.on_text?
end
def on_image?
!!position&.on_image?
end
def supported? def supported?
for_commit? || self.noteable.has_complete_diff_refs? for_commit? || self.noteable.has_complete_diff_refs?
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment