Check for presence rather than falsey when detecting tag color (#15356)

Fallback on empty string as well as nil to the site default tag color
This commit is contained in:
Daniel Uber 2021-11-11 14:53:32 -06:00 committed by GitHub
parent 09db50b296
commit 89ac6f1b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -298,7 +298,7 @@ module ApplicationHelper
end
def render_tag_link(tag, filled: false, monochrome: false, classes: "")
color = tag_colors(tag)[:background] || Settings::UserExperience.primary_brand_color_hex
color = tag_colors(tag)[:background].presence || Settings::UserExperience.primary_brand_color_hex
color_faded = Color::CompareHex.new([color]).opacity(0.1)
label = safe_join([content_tag(:span, "#", class: "crayons-tag__prefix"), tag])