diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/commit_status.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/issuable.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/mirror_authentication.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | app/models/notification_setting.rb | 5 |
5 files changed, 15 insertions, 2 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index f9101609f89..5a917588a33 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -200,6 +200,10 @@ class CommitStatus < ApplicationRecord update_all('processed=TRUE, lock_version=COALESCE(lock_version,0)+1') end + def self.locking_enabled? + false + end + def locking_enabled? will_save_change_to_status? end diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 653dc9c0b47..a6961df1b51 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -130,6 +130,10 @@ module Issuable strip_attributes :title + def self.locking_enabled? + false + end + # We want to use optimistic lock for cases when only title or description are involved # http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html def locking_enabled? diff --git a/app/models/concerns/mirror_authentication.rb b/app/models/concerns/mirror_authentication.rb index 948094221e5..4dbf4dcec77 100644 --- a/app/models/concerns/mirror_authentication.rb +++ b/app/models/concerns/mirror_authentication.rb @@ -37,6 +37,8 @@ module MirrorAuthentication end define_method("#{name}=") do |value| + credentials_will_change! + self.credentials ||= {} # Removal of the password, username, etc, generally causes an update of diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 3174a3269b4..62f34ae6525 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -712,7 +712,7 @@ class MergeRequest < ApplicationRecord end def validate_branch_name(attr) - return unless changes_include?(attr) + return unless will_save_change_to_attribute?(attr) branch = read_attribute(attr) diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index 2b3443f24d7..1447f822513 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -21,7 +21,10 @@ class NotificationSetting < ApplicationRecord # pending delete). # scope :for_projects, -> do - includes(:project).references(:projects).where(source_type: 'Project').where.not(projects: { id: nil, pending_delete: true }) + includes(:project).references(:projects) + .where(source_type: 'Project') + .where.not(projects: { id: nil }) + .where.not(projects: { pending_delete: true }) end EMAIL_EVENTS = [ |