Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-12-11 18:15:16 +00:00
parent 87f9516e78
commit 57e8835f30
2 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -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
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