0
0
Fork 0

Add urgent scope and by_version method to SoftwareUpdate (#33470)

This commit is contained in:
Matt Jankowski 2025-01-06 13:23:57 -05:00 committed by GitHub
parent 4cf031ee13
commit ef39398b82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 3 deletions

View file

@ -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?