From 513f187dafd8ff441479a6de12c61f8bb8d4c5bf Mon Sep 17 00:00:00 2001
From: Claire <claire.github-309c@sitedethib.com>
Date: Thu, 26 Sep 2024 21:27:57 +0200
Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9CA=20Mastodon=20update=20is=20ava?=
 =?UTF-8?q?ilable.=E2=80=9D=20message=20on=20admin=20dashboard=20for=20non?=
 =?UTF-8?q?-bugfix=20updates=20(#32106)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/lib/admin/system_check/software_version_check.rb       | 6 ++++--
 config/locales/en.yml                                      | 3 +++
 spec/lib/admin/system_check/software_version_check_spec.rb | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/app/lib/admin/system_check/software_version_check.rb b/app/lib/admin/system_check/software_version_check.rb
index e142feddf..e5cacfe35 100644
--- a/app/lib/admin/system_check/software_version_check.rb
+++ b/app/lib/admin/system_check/software_version_check.rb
@@ -14,14 +14,16 @@ class Admin::SystemCheck::SoftwareVersionCheck < Admin::SystemCheck::BaseCheck
   def message
     if software_updates.any?(&:urgent?)
       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)
+    else
+      Admin::SystemCheck::Message.new(:software_version_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? }
+    @software_updates ||= SoftwareUpdate.pending_to_a
   end
 end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9c3bab6ba..bf45dff33 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -875,6 +875,9 @@ en:
         message_html: You haven't defined any server rules.
       sidekiq_process_check:
         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:
         action: See available updates
         message_html: A critical Mastodon update is available, please update as quickly as possible.
diff --git a/spec/lib/admin/system_check/software_version_check_spec.rb b/spec/lib/admin/system_check/software_version_check_spec.rb
index 1affaa3a9..8460d9066 100644
--- a/spec/lib/admin/system_check/software_version_check_spec.rb
+++ b/spec/lib/admin/system_check/software_version_check_spec.rb
@@ -51,8 +51,8 @@ RSpec.describe Admin::SystemCheck::SoftwareVersionCheck do
         Fabricate(:software_update, version: '99.99.99', type: 'major', urgent: false)
       end
 
-      it 'returns true' do
-        expect(check.pass?).to be true
+      it 'returns false' do
+        expect(check.pass?).to be false
       end
     end