style(rubocop): fix all safe auto correctable offenses

This commit is contained in:
Charlie Smurthwaite
2023-03-16 15:50:53 +00:00
parent 02c93a4850
commit fd289c46fd
204 changed files with 2611 additions and 2486 deletions
+11 -11
View File
@@ -24,19 +24,19 @@ class Webhook < ApplicationRecord
include HasUUID
belongs_to :server
has_many :webhook_events, :dependent => :destroy
has_many :webhook_events, dependent: :destroy
has_many :webhook_requests
validates :name, :presence => true
validates :url, :presence => true, :format => {:with => /\Ahttps?\:\/\/[a-z0-9\-\.\_\?\=\&\/\+:%@]+\z/i, :allow_blank => true}
validates :name, presence: true
validates :url, presence: true, format: { with: /\Ahttps?:\/\/[a-z0-9\-._?=&\/+:%@]+\z/i, allow_blank: true }
scope :enabled, -> { where(:enabled => true) }
scope :enabled, -> { where(enabled: true) }
after_save :save_events
when_attribute :all_events, :changes_to => true do
when_attribute :all_events, changes_to: true do
after_save do
self.webhook_events.destroy_all
webhook_events.destroy_all
end
end
@@ -49,12 +49,12 @@ class Webhook < ApplicationRecord
end
def save_events
if @events
@events.each do |event|
webhook_events.where(:event => event).first_or_create!
end
webhook_events.where.not(:event => @events).destroy_all
return unless @events
@events.each do |event|
webhook_events.where(event: event).first_or_create!
end
webhook_events.where.not(event: @events).destroy_all
end
end