Add urgent
scope and by_version
method to SoftwareUpdate
(#33470)
This commit is contained in:
parent
4cf031ee13
commit
ef39398b82
4 changed files with 32 additions and 3 deletions
|
@ -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?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue