diff --git a/lib/svg_sprite.rb b/lib/svg_sprite.rb index f3b1491a99..49bcb6939a 100644 --- a/lib/svg_sprite.rb +++ b/lib/svg_sprite.rb @@ -318,6 +318,7 @@ module SvgSprite "Bad XML in custom sprite in theme with ID=#{theme_id}. Error info: #{e.inspect}", ) end + symbols end end @@ -397,8 +398,8 @@ License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL symbols = svgs_for(SiteSetting.default_theme_id) symbols.slice!(*icons) if only_available - symbols.delete_if! { |icon_id, sym| !icon_id.include?(keyword) } unless keyword.empty? - symbols.sort_by(&:first).map(&:second) + symbols.reject! { |icon_id, sym| !icon_id.include?(keyword) } unless keyword.empty? + symbols.sort_by(&:first).map { |icon_id, symbol| { id: icon_id, symbol: symbol } } end # For use in no_ember .html.erb layouts diff --git a/spec/models/theme_field_spec.rb b/spec/models/theme_field_spec.rb index cde2bcea1a..412d09774d 100644 --- a/spec/models/theme_field_spec.rb +++ b/spec/models/theme_field_spec.rb @@ -612,7 +612,7 @@ HTML describe "SVG sprite theme fields" do let :svg_content do - "" + "" end let :upload_file do @@ -651,10 +651,10 @@ HTML it "clears SVG sprite cache when upload is deleted" do theme_field - expect(SvgSprite.custom_svg_sprites(theme.id).size).to eq(1) + expect(SvgSprite.custom_svgs(theme.id).size).to eq(1) theme_field.destroy! - expect(SvgSprite.custom_svg_sprites(theme.id).size).to eq(0) + expect(SvgSprite.custom_svgs(theme.id).size).to eq(0) end it "crashes gracefully when svg is invalid" do