mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 04:02:07 +01:00
Add “A Mastodon update is available.” message on admin dashboard for non-bugfix updates (#32106)
This commit is contained in:
parent
ee2d966080
commit
513f187daf
3 changed files with 9 additions and 4 deletions
|
@ -14,14 +14,16 @@ class Admin::SystemCheck::SoftwareVersionCheck < Admin::SystemCheck::BaseCheck
|
||||||
def message
|
def message
|
||||||
if software_updates.any?(&:urgent?)
|
if software_updates.any?(&:urgent?)
|
||||||
Admin::SystemCheck::Message.new(:software_version_critical_check, nil, admin_software_updates_path, true)
|
Admin::SystemCheck::Message.new(:software_version_critical_check, nil, admin_software_updates_path, true)
|
||||||
else
|
elsif software_updates.any?(&:patch_type?)
|
||||||
Admin::SystemCheck::Message.new(:software_version_patch_check, nil, admin_software_updates_path)
|
Admin::SystemCheck::Message.new(:software_version_patch_check, nil, admin_software_updates_path)
|
||||||
|
else
|
||||||
|
Admin::SystemCheck::Message.new(:software_version_check, nil, admin_software_updates_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def software_updates
|
def software_updates
|
||||||
@software_updates ||= SoftwareUpdate.pending_to_a.filter { |update| update.urgent? || update.patch_type? }
|
@software_updates ||= SoftwareUpdate.pending_to_a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -875,6 +875,9 @@ en:
|
||||||
message_html: You haven't defined any server rules.
|
message_html: You haven't defined any server rules.
|
||||||
sidekiq_process_check:
|
sidekiq_process_check:
|
||||||
message_html: No Sidekiq process running for the %{value} queue(s). Please review your Sidekiq configuration
|
message_html: No Sidekiq process running for the %{value} queue(s). Please review your Sidekiq configuration
|
||||||
|
software_version_check:
|
||||||
|
action: See available updates
|
||||||
|
message_html: A Mastodon update is available.
|
||||||
software_version_critical_check:
|
software_version_critical_check:
|
||||||
action: See available updates
|
action: See available updates
|
||||||
message_html: A critical Mastodon update is available, please update as quickly as possible.
|
message_html: A critical Mastodon update is available, please update as quickly as possible.
|
||||||
|
|
|
@ -51,8 +51,8 @@ RSpec.describe Admin::SystemCheck::SoftwareVersionCheck do
|
||||||
Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: false)
|
Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns true' do
|
it 'returns false' do
|
||||||
expect(check.pass?).to be true
|
expect(check.pass?).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue