0
0
Fork 0

Add admin notifications for new Mastodon versions (#26582)

This commit is contained in:
Claire 2023-09-01 17:47:07 +02:00 committed by GitHub
parent be991f1d18
commit 16681e0f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 892 additions and 8 deletions

View file

@ -0,0 +1,27 @@
# frozen_string_literal: true
class Admin::SystemCheck::SoftwareVersionCheck < Admin::SystemCheck::BaseCheck
include RoutingHelper
def skip?
!current_user.can?(:view_devops) || !SoftwareUpdate.check_enabled?
end
def pass?
software_updates.empty?
end
def message
if software_updates.any?(&:urgent?)
Admin::SystemCheck::Message.new(:software_version_critical_check, nil, admin_software_updates_path, true)
else
Admin::SystemCheck::Message.new(:software_version_patch_check, nil, admin_software_updates_path)
end
end
private
def software_updates
@software_updates ||= SoftwareUpdate.pending_to_a.filter { |update| update.urgent? || update.patch_type? }
end
end