From 1826da1e0a64c2e73b0f95057a56276aae313012 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 30 May 2023 21:58:02 +0200 Subject: [PATCH] Allow navigation items to have their badge persist if they have a Stimulus controller This fixes a bug which caused the PWA app badge to persist even though the user's inbox was empty. --- app/helpers/bootstrap_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/bootstrap_helper.rb b/app/helpers/bootstrap_helper.rb index d1cda2a0..54278249 100644 --- a/app/helpers/bootstrap_helper.rb +++ b/app/helpers/bootstrap_helper.rb @@ -24,7 +24,7 @@ module BootstrapHelper "#{content_tag(:i, '', class: "fa fa-#{options[:icon]}")} #{body}" end end - unless options[:badge].nil? + if options.has_key?(:badge) || options.dig(:badge_attr, :data)&.has_key?(:controller) badge_class = [ "badge", ("badge-#{options[:badge_color]}" unless options[:badge_color].nil?),