From 6b818fb855e7520f44e2fac2ebe7353d8f2f3357 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 21 Sep 2020 09:20:39 +0530 Subject: [PATCH] FIX: use normal logo in published pages if small not available. It was returning an error if small logo is not available. If both logos are not available then it will be hidden now. --- app/controllers/published_pages_controller.rb | 2 +- app/views/published_pages/show.html.erb | 10 ++++++---- spec/requests/published_pages_controller_spec.rb | 10 ++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/controllers/published_pages_controller.rb b/app/controllers/published_pages_controller.rb index 4ce11777097..a51776ada6c 100644 --- a/app/controllers/published_pages_controller.rb +++ b/app/controllers/published_pages_controller.rb @@ -31,7 +31,7 @@ class PublishedPagesController < ApplicationController @topic = pp.topic @canonical_url = @topic.url - @logo = SiteSetting.logo_small + @logo = SiteSetting.logo_small || SiteSetting.logo @site_url = Discourse.base_url @border_color = "#" + ColorScheme.base_colors["tertiary"] diff --git a/app/views/published_pages/show.html.erb b/app/views/published_pages/show.html.erb index 0f84c9c1fb1..7cf3b07c0bf 100644 --- a/app/views/published_pages/show.html.erb +++ b/app/views/published_pages/show.html.erb @@ -2,9 +2,11 @@
- - - + <%- if @logo.present? %> + + + + <%- end -%>

<%= @topic.title %>

@@ -23,4 +25,4 @@ <%= @topic.first_post.cooked.html_safe %> <%- end -%> - \ No newline at end of file + diff --git a/spec/requests/published_pages_controller_spec.rb b/spec/requests/published_pages_controller_spec.rb index d5fed80819e..5aa14705155 100644 --- a/spec/requests/published_pages_controller_spec.rb +++ b/spec/requests/published_pages_controller_spec.rb @@ -98,6 +98,16 @@ RSpec.describe PublishedPagesController do expect(response.status).to eq(200) end + it "works even if image logos are not available" do + SiteSetting.logo_small = nil + get published_page.path + expect(response.body).to include("") + + SiteSetting.logo = nil + get published_page.path + expect(response.body).not_to include("published-page-logo") + end + it "defines correct css classes on body" do get published_page.path expect(response.body).to include("")