Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/sent_notification.rb')
-rw-r--r--app/models/sent_notification.rb27
1 files changed, 6 insertions, 21 deletions
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 580e4cd277c..c2fd8b20942 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -3,7 +3,7 @@
class SentNotification < ApplicationRecord
include IgnorableColumns
- serialize :position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize
+ ignore_column %i[line_code note_type position], remove_with: '16.3', remove_after: '2023-07-22'
belongs_to :project
belongs_to :noteable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
@@ -46,7 +46,11 @@ class SentNotification < ApplicationRecord
commit_id: commit_id
)
- create(attrs)
+ # Non-sticky write is used as `.record` is only used in ActionMailer
+ # where there are no queries to SentNotification.
+ ::Gitlab::Database::LoadBalancing::Session.without_sticky_writes do
+ create(attrs)
+ end
end
def record_note(note, recipient_id, reply_key = self.reply_key, attrs = {})
@@ -80,25 +84,6 @@ class SentNotification < ApplicationRecord
end
end
- def position=(new_position)
- if new_position.is_a?(String)
- new_position = begin
- Gitlab::Json.parse(new_position)
- rescue StandardError
- nil
- end
- end
-
- if new_position.is_a?(Hash)
- new_position = new_position.with_indifferent_access
- new_position = Gitlab::Diff::Position.new(new_position)
- else
- new_position = nil
- end
-
- super(new_position)
- end
-
def to_param
self.reply_key
end