From a6d650d3e0094c9d70ce6ca98f0830a9ae0e8a53 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 21 Jul 2025 14:46:45 +0300 Subject: [PATCH] Restore Bootstrap "chat" icons for changeset comments https://icons.getbootstrap.com/icons/chat/ https://icons.getbootstrap.com/icons/chat-fill/ Undoes a part of 5e8576462633a9dacb00c580159fc62bf890ea31 that complicates comments icon logic by introducing a fill transform. The transform doesn't produce the same result if when opacity is less than 1, and it is less than 1. This happens because fill and stroke areas overlap. --- app/assets/images/icons/chat-fill.svg | 3 +++ app/assets/images/icons/chat.svg | 3 +++ app/assets/images/icons/comment.svg | 3 --- app/views/changesets/_changeset_line.html.erb | 2 +- config/initializers/inline_svg.rb | 9 --------- 5 files changed, 7 insertions(+), 13 deletions(-) create mode 100644 app/assets/images/icons/chat-fill.svg create mode 100644 app/assets/images/icons/chat.svg delete mode 100644 app/assets/images/icons/comment.svg diff --git a/app/assets/images/icons/chat-fill.svg b/app/assets/images/icons/chat-fill.svg new file mode 100644 index 000000000..266c84487 --- /dev/null +++ b/app/assets/images/icons/chat-fill.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/images/icons/chat.svg b/app/assets/images/icons/chat.svg new file mode 100644 index 000000000..c6c04efc1 --- /dev/null +++ b/app/assets/images/icons/chat.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/images/icons/comment.svg b/app/assets/images/icons/comment.svg deleted file mode 100644 index 283e2f514..000000000 --- a/app/assets/images/icons/comment.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/app/views/changesets/_changeset_line.html.erb b/app/views/changesets/_changeset_line.html.erb index e8e23ba00..1f03a0aa0 100644 --- a/app/views/changesets/_changeset_line.html.erb +++ b/app/views/changesets/_changeset_line.html.erb @@ -38,7 +38,7 @@ <%= tag.span :class => ["changeset_num_comments d-flex align-items-baseline gap-1 justify-content-end", { "opacity-50" => num_comments.zero? }], :title => t(".comments", :count => num_comments) do %> <%= num_comments %> - <%= inline_svg_tag "icons/comment.svg", :fill => num_comments.zero? ? "none" : "currentColor" %> + <%= inline_svg_tag num_comments.zero? ? "icons/chat.svg" : "icons/chat-fill.svg", :size => "12px" %> <% end %> <% end %> diff --git a/config/initializers/inline_svg.rb b/config/initializers/inline_svg.rb index a0878e458..9a117b13e 100644 --- a/config/initializers/inline_svg.rb +++ b/config/initializers/inline_svg.rb @@ -6,17 +6,8 @@ module OpenStreetMap end end end - - class SvgFillOverrideTransform < InlineSvg::CustomTransformation - def transform(doc) - with_svg(doc) do |svg| - svg.set_attribute("fill", value) - end - end - end end InlineSvg.configure do |config| config.add_custom_transformation(:attribute => :to_symbol, :transform => OpenStreetMap::SvgToSymbolTransform) - config.add_custom_transformation(:attribute => :fill, :transform => OpenStreetMap::SvgFillOverrideTransform) end -- 2.39.5