Add urgent scope and by_version method to SoftwareUpdate (#33470)
This commit is contained in:
@@ -18,6 +18,8 @@ class SoftwareUpdate < ApplicationRecord
|
||||
|
||||
enum :type, { patch: 0, minor: 1, major: 2 }, suffix: :type
|
||||
|
||||
scope :urgent, -> { where(urgent: true) }
|
||||
|
||||
def gem_version
|
||||
Gem::Version.new(version)
|
||||
end
|
||||
@@ -35,6 +37,10 @@ class SoftwareUpdate < ApplicationRecord
|
||||
Rails.configuration.x.mastodon.software_update_url.present?
|
||||
end
|
||||
|
||||
def by_version
|
||||
all.sort_by(&:gem_version)
|
||||
end
|
||||
|
||||
def pending_to_a
|
||||
return [] unless check_enabled?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user