From 4187373d4e1a43024389cbbc69e3b75778defd91 Mon Sep 17 00:00:00 2001 From: Damian Legawiec Date: Wed, 22 May 2024 20:52:13 +0200 Subject: [PATCH] Don't call spreecloud in test env in admin (#317) * Don't call spreecloud in test env in admin * Update base_helper.rb --- app/helpers/spree/admin/base_helper.rb | 6 +++++- app/views/spree/admin/shared/_version.html.erb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/helpers/spree/admin/base_helper.rb b/app/helpers/spree/admin/base_helper.rb index ad054c383f..85c0f7b791 100644 --- a/app/helpers/spree/admin/base_helper.rb +++ b/app/helpers/spree/admin/base_helper.rb @@ -287,8 +287,12 @@ def taxon_wysiwyg_editor_enabled? Spree::Backend::Config[:taxon_wysiwyg_editor_enabled] end + def spree_admin_show_version? + can?(:admin, current_store) && Spree::Backend::RuntimeConfig[:admin_show_version] + end + def spree_update_available? - @spree_update_available ||= Spree::Admin::Updater.update_available? + @spree_update_available ||= !Rails.env.test? && Spree::Admin::Updater.update_available? end end end diff --git a/app/views/spree/admin/shared/_version.html.erb b/app/views/spree/admin/shared/_version.html.erb index 7c5795940d..ce6eb71b1e 100644 --- a/app/views/spree/admin/shared/_version.html.erb +++ b/app/views/spree/admin/shared/_version.html.erb @@ -1,10 +1,10 @@ -<% if can?(:admin, current_store) && Spree::Backend::RuntimeConfig[:admin_show_version] %> +<% if spree_admin_show_version? %>
- <%= link_to Spree.version, "https://github.com/spree/spree/releases/tag/v#{Spree.version.gsub(/\.beta|\.rc\d+/, '')}", target: '_blank' %> + <%= link_to Spree.version, "https://github.com/spree/spree/releases/tag/v#{Spree.version}", target: '_blank' %> <% if spree_update_available? %>